Merge branch 'pull/master'
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Fri, 19 Oct 2007 07:23:57 +0000 (09:23 +0200)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Fri, 19 Oct 2007 07:23:57 +0000 (09:23 +0200)
contrib/README
contrib/exec-smartctl [new file with mode: 0755]

index 685903b..2e9cbf5 100644 (file)
@@ -38,6 +38,11 @@ should look something like this:
   datadir: "/var/lib/collectd/rrd/"
   libdir: "/usr/lib/collectd/"
 
+exec-smartctl
+-------------
+  Sample script for the exec plugin. Please refer to the documentation in the
+file - you will have to adapt it to your needs anyway.
+
 extractDS.px
 ------------
   Creates a new RRD-file with only one data-source (DS) of the source-RRD-
@@ -58,3 +63,12 @@ been renamed) and others have bee split up into multiple files. This script
 prints a bash-script to STDOUT which should do most of the work for you. You
 may still need to do some things by hand, read `README.migration' for more
 details.
+
+snmp-data.conf
+--------------
+  Sample configuration for the SNMP plugin. This config includes a few standard
+<Data ..> definitions that you can include in your own config using the
+`Include' statement (available since version 4.2.0). The config includes some
+data that is defined in the IF-MIB, e. g. octet or packet counters, UPS-MIB and
+whatever people have send in. If you have some more definitions please send
+them in, so others can profit from it.
diff --git a/contrib/exec-smartctl b/contrib/exec-smartctl
new file mode 100755 (executable)
index 0000000..d469816
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+# Sample script for the exec plugin (collectd-exec(5))
+#
+# This script uses smartctl(8) to read HDD temperatures. The drives are
+# attached to a 3ware RAID controller which hddtempd can't handle.
+# Unfortunately the smartmontools don't have a library so we can't write a
+# C-plugin, at least not easily.
+# Please note that only root can read the SMART attributes from harddrives,
+# because special ``capabilities'' are necessary. However, the exec plugin will
+# refuse to run scripts as root, which is why `sudo' is used here for
+# fine-grained root privileges for the user `smart'. This isn't as straigt
+# forward as one might hope, but we think that the gained security is worth it.
+
+# The sudo configuration looks something like this:
+# -- 8< --
+# Cmnd_Alias      SMARTCTL = /usr/sbin/smartctl -d 3ware\,0 -A /dev/twe0, /usr/sbin/smartctl -d 3ware\,1 -A /dev/twe0, /usr/sbin/smartctl -d ata -A /dev/sda
+# smart   ALL = (root) NOPASSWD: SMARTCTL
+# -- >8 --
+
+HOST="huhu"
+INTERVAL=60
+
+while true
+do
+       TEMP=$((sudo smartctl -d 3ware,0 -A /dev/twe0 | grep Temperature_Celsius | awk '{ print $10; }') 2>/dev/null);
+       if [ $? -ne 0 ]
+       then
+               TEMP="U"
+       fi
+       echo "$HOST/exec-smart/temperature-3ware_0 interval=$INTERVAL N:$TEMP"
+
+       TEMP=$((sudo smartctl -d 3ware,1 -A /dev/twe0 | grep Temperature_Celsius | awk '{ print $10; }') 2>/dev/null);
+       if [ $? -ne 0 ]
+       then
+               TEMP="U"
+       fi
+       echo "$HOST/exec-smart/temperature-3ware_1 interval=$INTERVAL N:$TEMP"
+
+       TEMP=$((sudo smartctl -d ata -A /dev/sda | grep Temperature_Celsius | awk '{ print $10; }') 2>/dev/null);
+       if [ $? -ne 0 ]
+       then
+               TEMP="U"
+       fi
+       echo "$HOST/exec-smart/temperature-sata_0 interval=$INTERVAL N:$TEMP"
+
+       sleep $INTERVAL
+done