Я использую MRTG для захвата данных с датчиков сервера ubuntu 12.04, с этим скриптом.
#!/bin/bash
SENSORS=/usr/bin/sensors
UPTIME=$(uptime | awk -F, '{print $3}' )
TEXT="Graphic Card Temperature"
GPCTEMP1=$( ${SENSORS} | grep "temp1" | awk '{print int($3)}' )
# http://people.ee.ethz.ch/~oetiker/webtools/mrtg/reference.html
# "The external command must return 4 lines of output:
# Line 1
# current state of the first variable, normally 'incoming bytes count'
# Line 2
# current state of the second variable, normally 'outgoing bytes count'
# Line 3
# string (in any human readable format), telling the uptime of the target.
# Line 4
# string, telling the name of the target. "
echo ${GPCTEMP1}
echo ${GPCTEMP1}
echo ${UPTIME}
echo ${TEXT}
К сожалению, есть две «temp1», когда я запускаю датчики, есть два датчика с name "temp1"
/etc/mrtg/cfg/mrtg-scripts$ sensors
adt7490-i2c-0-2e
Adapter: SMBus I801 adapter at f000
in0: +1.12 V (min = +0.00 V, max = +3.31 V)
Vcore: +1.09 V (min = +0.00 V, max = +2.99 V)
+3.3V: +3.25 V (min = +2.96 V, max = +3.61 V)
+5V: +5.03 V (min = +4.48 V, max = +5.50 V)
+12V: +11.90 V (min = +0.00 V, max = +15.69 V)
in5: +2.10 V (min = +0.00 V, max = +4.48 V)
fan1: 1312 RPM (min = 0 RPM)
fan2: 0 RPM (min = 0 RPM)
fan3: 0 RPM (min = 0 RPM)
fan4: 0 RPM (min = 0 RPM)
temp1: +38.5°C (low = +5.0°C, high = +65.0°C)
(crit = +70.0°C, hyst = +66.0°C)
M/B Temp: +39.8°C (low = +5.0°C, high = +65.0°C)
(crit = +70.0°C, hyst = +66.0°C)
temp3: +42.2°C (low = +5.0°C, high = +65.0°C)
(crit = +70.0°C, hyst = +66.0°C)
coretemp-isa-0000
Adapter: ISA adapter
Core 0: +59.0°C (high = +74.0°C, crit = +100.0°C)
Core 1: +55.0°C (high = +74.0°C, crit = +100.0°C)
Core 2: +55.0°C (high = +74.0°C, crit = +100.0°C)
Core 3: +57.0°C (high = +74.0°C, crit = +100.0°C)
radeon-pci-0100
Adapter: PCI adapter
temp1: +60.5°C
Я хочу захватить информацию о radeon-pci-0100, но как я могу это сделать?
Это результат, когда я использую [ f4] с grep
/etc/mrtg/cfg/mrtg-scripts$ sensors | grep "temp1"
temp1: +38.8°C (low = +5.0°C, high = +65.0°C)
temp1: +60.5°C
Самый простой ответ - установить mrtgutils-sensors, который включает пакет mrtg-sensors, который автоматически анализирует выходные данные датчиков.
mrtg-sensors radeon-pci-0100 temp1
даст правильный ответ.