--- smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias.userparam_sensors 2009-04-20 11:35:22.000000000 +0200 +++ smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias 2009-04-20 12:25:18.000000000 +0200 @@ -1,5 +1,5 @@ { -my $runasroot = '/usr/bin/mysqladmin status, /sbin/e-smith/db yum_updates show'; +my $runasroot = '/usr/bin/mysqladmin status, /sbin/e-smith/db yum_updates show, /var/lib/zabbix/bin/sensors *'; if ( -x '/opt/MegaRAID/MegaCli/MegaCli' ){ $runasroot .= ', /opt/MegaRAID/MegaCli/MegaCli -ldinfo -Lall -Aall'; } --- smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_sensors.userparam_sensors 2009-04-20 11:36:10.000000000 +0200 +++ smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_sensors 2009-04-20 12:21:12.000000000 +0200 @@ -0,0 +1,11 @@ + +# Description: Temperature +# Type: Agent or Agent (active) +# Key: sensors[mb] (for example) +# Type of information: Numeric (float) +# Units: °C +# Custom multiplier: Do not use +# Store Value: As is + +UserParameter=sensors[*],/usr/bin/sudo /var/lib/zabbix/bin/sensors $1 + --- smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/sensors.userparam_sensors 2009-04-20 14:27:38.000000000 +0200 +++ smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/sensors 2009-04-20 15:42:04.000000000 +0200 @@ -0,0 +1,47 @@ +#!/bin/bash + +KEY=$1 + +case $KEY in + cpu0) + # Here are some examples on how to retrieve temperatures + # of your system: + # + # If your motherboard support IPMI and you have the ipmitool package + # You can use this: + # Of course, you'll have to adapt this + # /usr/bin/ipmitool sdr | grep 'P1 Therm Margin' | cut -d'|' -f 2 | awk '{print $1'} + + # Else, if your motherboard support lm_sensor, you can use something + # like this: + # /usr/bin/sensors | grep temp1 | awk '{print $2'} | sed -e "s/+//g" -e "s/.C//g" + + # You can also try to get your CPU temperature with acpi: + # cat /proc/acpi/thermal_zone/THRM/temperature | awk '{print $2}' + + # The default for now is to use IPMI + /usr/bin/ipmitool sdr | grep 'P1 Therm Margin' | cut -d'|' -f 2 | awk '{print $1'} + + ;; + cpu1) + # This will be the same as the above, but for the second CPU + + /usr/bin/ipmitool sdr | grep 'P2 Therm Margin' | cut -d'|' -f 2 | awk '{print $1'} + + ;; + mb) + # AFAIK, motherboard temperature can be retrieved only with lm_sensor or IPMI + + /usr/bin/ipmitool sdr | grep 'Baseboard' | cut -d'|' -f 2 | awk '{print $1'} + + ;; + sd*) + # Here, we want a harddrive temperature, so we'll use hddtemp + /usr/sbin/hddtemp /dev/$KEY | cut -d':' -f 3 | sed -e "s/.C//g" + ;; + *) + # Else, we tell the server the item is not supported + echo 'ZBX_NOTSUPPORTED' + ;; +esac +