1 |
--- smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias.userparam_sensors 2009-04-20 11:35:22.000000000 +0200 |
2 |
+++ smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias 2009-04-20 12:25:18.000000000 +0200 |
3 |
@@ -1,5 +1,5 @@ |
4 |
{ |
5 |
-my $runasroot = '/usr/bin/mysqladmin status, /sbin/e-smith/db yum_updates show'; |
6 |
+my $runasroot = '/usr/bin/mysqladmin status, /sbin/e-smith/db yum_updates show, /var/lib/zabbix/bin/sensors *'; |
7 |
if ( -x '/opt/MegaRAID/MegaCli/MegaCli' ){ |
8 |
$runasroot .= ', /opt/MegaRAID/MegaCli/MegaCli -ldinfo -Lall -Aall'; |
9 |
} |
10 |
--- 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 |
11 |
+++ 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 |
12 |
@@ -0,0 +1,11 @@ |
13 |
+ |
14 |
+# Description: Temperature |
15 |
+# Type: Agent or Agent (active) |
16 |
+# Key: sensors[mb] (for example) |
17 |
+# Type of information: Numeric (float) |
18 |
+# Units: °C |
19 |
+# Custom multiplier: Do not use |
20 |
+# Store Value: As is |
21 |
+ |
22 |
+UserParameter=sensors[*],/usr/bin/sudo /var/lib/zabbix/bin/sensors $1 |
23 |
+ |
24 |
--- smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/sensors.userparam_sensors 2009-04-20 14:27:38.000000000 +0200 |
25 |
+++ smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/sensors 2009-04-20 15:42:04.000000000 +0200 |
26 |
@@ -0,0 +1,47 @@ |
27 |
+#!/bin/bash |
28 |
+ |
29 |
+KEY=$1 |
30 |
+ |
31 |
+case $KEY in |
32 |
+ cpu0) |
33 |
+ # Here are some examples on how to retrieve temperatures |
34 |
+ # of your system: |
35 |
+ # |
36 |
+ # If your motherboard support IPMI and you have the ipmitool package |
37 |
+ # You can use this: |
38 |
+ # Of course, you'll have to adapt this |
39 |
+ # /usr/bin/ipmitool sdr | grep 'P1 Therm Margin' | cut -d'|' -f 2 | awk '{print $1'} |
40 |
+ |
41 |
+ # Else, if your motherboard support lm_sensor, you can use something |
42 |
+ # like this: |
43 |
+ # /usr/bin/sensors | grep temp1 | awk '{print $2'} | sed -e "s/+//g" -e "s/.C//g" |
44 |
+ |
45 |
+ # You can also try to get your CPU temperature with acpi: |
46 |
+ # cat /proc/acpi/thermal_zone/THRM/temperature | awk '{print $2}' |
47 |
+ |
48 |
+ # The default for now is to use IPMI |
49 |
+ /usr/bin/ipmitool sdr | grep 'P1 Therm Margin' | cut -d'|' -f 2 | awk '{print $1'} |
50 |
+ |
51 |
+ ;; |
52 |
+ cpu1) |
53 |
+ # This will be the same as the above, but for the second CPU |
54 |
+ |
55 |
+ /usr/bin/ipmitool sdr | grep 'P2 Therm Margin' | cut -d'|' -f 2 | awk '{print $1'} |
56 |
+ |
57 |
+ ;; |
58 |
+ mb) |
59 |
+ # AFAIK, motherboard temperature can be retrieved only with lm_sensor or IPMI |
60 |
+ |
61 |
+ /usr/bin/ipmitool sdr | grep 'Baseboard' | cut -d'|' -f 2 | awk '{print $1'} |
62 |
+ |
63 |
+ ;; |
64 |
+ sd*) |
65 |
+ # Here, we want a harddrive temperature, so we'll use hddtemp |
66 |
+ /usr/sbin/hddtemp /dev/$KEY | cut -d':' -f 3 | sed -e "s/.C//g" |
67 |
+ ;; |
68 |
+ *) |
69 |
+ # Else, we tell the server the item is not supported |
70 |
+ echo 'ZBX_NOTSUPPORTED' |
71 |
+ ;; |
72 |
+esac |
73 |
+ |