Coder Social home page Coder Social logo

matteocorti / check_lm_sensors Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 9.0 104 KB

check_lm_sensors is a Nagios plugin to monitor the values of on board sensors and hard disk temperatures on Linux systems

Home Page: http://matteocorti.github.io/check_lm_sensors/

License: GNU General Public License v3.0

Perl 100.00%
nagios-plugin sensors

check_lm_sensors's People

Contributors

evgeni avatar fmikker avatar matteocorti avatar sbraz avatar schulmar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

check_lm_sensors's Issues

sensors command multiline output

From @matteocorti on October 16, 2015 13:25

Original reporter: [email protected]

Hi

Some of my longer sensor labels were causing an UNKNOWN status in the plugin. Some digging showed that the output from the sensors command wrapped to a new line and was being parsed to the while loop, on line 390, without the value of the sensor.

A quick and dirty hack for me was to re-format the output before it entered the loop:

$command = "$sensors_bin -A | perl -p -e 's/:\n/:/g' | grep :";

Someone with better perl knowledge could probably find a more elegant solution.

Copied from original issue: matteocorti/nagios_plugins#91

Unable to take sensors readings with Debian Stretch

Hi and thanks for your work with this plugin!

I recently upgraded a server with Debian Jessie to Debian Stretch and I am not able to take sensor readings with check_lm_sensors:

# sensors
acpitz-virtual-0
Adapter: Virtual device
temp1:        +40.0°C  (crit = +75.0°C)

atk0110-acpi-0
Adapter: ACPI interface
Vcore Voltage:           +1.39 V  (min =  +0.85 V, max =  +1.60 V)
 +3.3 Voltage:           +3.36 V  (min =  +3.00 V, max =  +3.60 V)
 +5.0 Voltage:           +4.95 V  (min =  +4.50 V, max =  +5.50 V)
+12.0 Voltage:          +12.10 V  (min = +11.20 V, max = +13.20 V)
CPU FAN Speed:          4687 RPM  (min =    0 RPM, max = 1800 RPM)
CHASSIS FAN Speed:         0 RPM  (min =    0 RPM, max = 1800 RPM)
CHASSIS2 FAN Speed:        0 RPM  (min =    0 RPM, max = 1800 RPM)
CHASSIS3 FAN FAN Speed:    0 RPM  (min =    0 RPM, max = 1800 RPM)
CHASSIS4 FAN FAN Speed:    0 RPM  (min =    0 RPM, max = 1800 RPM)
POWER FAN FAN Speed:       0 RPM  (min =    0 RPM, max = 1800 RPM)
CHIP FAN FAN Speed:        0 RPM  (min =    0 RPM, max = 1800 RPM)
CPU Temperature:         +44.0°C  (high = +90.0°C, crit = +125.0°C)
MB Temperature:          +47.0°C  (high = +45.0°C, crit = +90.0°C)

k8temp-pci-00c3
Adapter: PCI adapter
Core0 Temp:   +48.0°C  
Core1 Temp:   +45.0°C  

nouveau-pci-0100
Adapter: PCI adapter
temp1:        +62.0°C  (high = +95.0°C, hyst =  +3.0°C)
                       (crit = +130.0°C, hyst = +10.0°C)
                       (emerg = +135.0°C, hyst =  +5.0°C)

# uname -a
Linux ss01 3.16.0-5-amd64 #1 SMP Debian 3.16.51-3+deb8u1 (2018-01-08) x86_64 GNU/Linux
# /usr/lib/nagios/plugins/check_lm_sensors --list
LM_SENSORS OK - |
# /usr/lib/nagios/plugins/check_lm_sensors --version
check_lm_sensors version 4.1.1

Please let me know if I can provide more information.

Thanks in advance.

Kind regards,
Daniel

Failed to read sensors list on Arch Linux (4.8.8-2-ARCH)

Patch below:

--- /usr/lib/monitoring-plugins/check_lm_sensors        2016-11-28 22:03:57.000000000 +0000
+++ /usr/lib/monitoring-plugins/check_lm_sensors.mod    2016-11-28 22:03:18.626803491 +0000
@@ -454,13 +454,13 @@
         ## use critic

         # list sensors
-        opendir $dir_handle, "$DEV_DIR/$device/device/"
+        opendir $dir_handle, "$DEV_DIR/$device"
           or return;
         my @sensors = apply { s/_input//mxs; }
         grep { m/^[^.].*_input/mxs } readdir $dir_handle;
         closedir $dir_handle
           or $plugin->nagios_exit( $plugin_module->UNKNOWN,
-            "Error closing $DEV_DIR/$device/device: $OS_ERROR" );
+            "Error closing $DEV_DIR/$device: $OS_ERROR" );

         for my $sensor (@sensors) {

@@ -470,11 +470,11 @@

             ## no critic (InputOutput::RequireBriefOpen)
             open $sensor_handler, q{<},
-              "$DEV_DIR/$device/device/$sensor"
+              "$DEV_DIR/$device/$sensor"
               . '_input'
               or $plugin->nagios_exit(
                 $plugin_module->UNKNOWN,
-                "Error reading $DEV_DIR/$device/device/$sensor"
+                "Error reading $DEV_DIR/$device/$sensor"
                   . "_input: $OS_ERROR"
               );
             while (<$sensor_handler>) {
@@ -485,7 +485,7 @@
             close $sensor_handler
               or $plugin->nagios_exit(
                 $plugin_module->UNKNOWN,
-                "Error closing $DEV_DIR/$device/device/$sensor"
+                "Error closing $DEV_DIR/$device/$sensor"
                   . "_input: $OS_ERROR"
               );
             ## use critic

Cannot find "name" file in device folder

When running /usr/lib/monitoring-plugins/check_lm_sensors --list I get the result:

LM_SENSORS UNKNOWN - Error reading /sys/class/hwmon/hwmon0/device/name: No such file or directory

Looking in the respective directories I see:

$ ls -l /sys/class/hwmon/hwmon0/device/
total 0
lrwxrwxrwx 1 root root    0 Nov  2 14:20 driver -> ../../../bus/platform/drivers/coretemp
-rw-r--r-- 1 root root 4096 Nov 19 13:16 driver_override
drwxr-xr-x 3 root root    0 Nov 19 13:20 hwmon
-r--r--r-- 1 root root 4096 Nov 19 13:16 modalias
drwxr-xr-x 2 root root    0 Nov 19 13:20 power
lrwxrwxrwx 1 root root    0 Nov  2 14:20 subsystem -> ../../../bus/platform
-rw-r--r-- 1 root root 4096 Nov 19 13:16 uevent
$ ls -l /sys/class/hwmon/hwmon0/
total 0
lrwxrwxrwx 1 root root    0 Nov  2 14:20 device -> ../../../coretemp.0
-r--r--r-- 1 root root 4096 Nov 19 13:16 name
drwxr-xr-x 2 root root    0 Nov 19 13:17 power
lrwxrwxrwx 1 root root    0 Nov 19 13:17 subsystem -> ../../../../../class/hwmon
-r--r--r-- 1 root root 4096 Nov 19 13:16 temp2_crit
-r--r--r-- 1 root root 4096 Nov 19 13:16 temp2_crit_alarm
-r--r--r-- 1 root root 4096 Nov 19 13:16 temp2_input
-r--r--r-- 1 root root 4096 Nov 19 13:16 temp2_label
-r--r--r-- 1 root root 4096 Nov 19 13:16 temp2_max
-r--r--r-- 1 root root 4096 Nov 19 13:16 temp3_crit
-r--r--r-- 1 root root 4096 Nov 19 13:16 temp3_crit_alarm
-r--r--r-- 1 root root 4096 Nov 19 13:16 temp3_input
-r--r--r-- 1 root root 4096 Nov 19 13:16 temp3_label
-r--r--r-- 1 root root 4096 Nov 19 13:16 temp3_max
-r--r--r-- 1 root root 4096 Nov 19 13:16 temp4_crit
-r--r--r-- 1 root root 4096 Nov 19 13:16 temp4_crit_alarm
-r--r--r-- 1 root root 4096 Nov 19 13:16 temp4_input
-r--r--r-- 1 root root 4096 Nov 19 13:16 temp4_label
-r--r--r-- 1 root root 4096 Nov 19 13:16 temp4_max
-r--r--r-- 1 root root 4096 Nov 19 13:16 temp5_crit
-r--r--r-- 1 root root 4096 Nov 19 13:16 temp5_crit_alarm
-r--r--r-- 1 root root 4096 Nov 19 13:16 temp5_input
-r--r--r-- 1 root root 4096 Nov 19 13:16 temp5_label
-r--r--r-- 1 root root 4096 Nov 19 13:16 temp5_max
-rw-r--r-- 1 root root 4096 Nov 19 13:16 uevent

So it seems the name file has been moved up from the device subfolder.
Obviously the old location might still be in use somewhere else so both should be checked.

CPU sensors gone after 3.1.1 -> 4.1.1 update?

I finally updated from 3.1.1 to 4.1.1, and it seems my CPU core temperature sensors are not available anymore.

sensors output:

coretemp-isa-0000 
Adapter: ISA adapter 
Core 0:       +48.0°C  (high = +87.0°C, crit = +97.0°C) 
Core 1:       +45.0°C  (high = +87.0°C, crit = +97.0°C) 
Core 2:       +47.0°C  (high = +87.0°C, crit = +97.0°C) 
Core 3:       +44.0°C  (high = +87.0°C, crit = +97.0°C) 

coretemp-isa-0001 
Adapter: ISA adapter 
Core 0:       +46.0°C  (high = +87.0°C, crit = +97.0°C) 
Core 1:       +44.0°C  (high = +87.0°C, crit = +97.0°C) 
Core 2:       +47.0°C  (high = +87.0°C, crit = +97.0°C) 
Core 3:       +44.0°C  (high = +87.0°C, crit = +97.0°C) 

jc42-i2c-0-18 
Adapter: SMBus I801 adapter at 0400 
temp1:        +55.0°C  (low  =  +0.0°C) 
                       (high =  +0.0°C, hyst =  -1.5°C) 
                       (crit = +74.0°C, hyst = +72.5°C) 

jc42-i2c-0-1a 
Adapter: SMBus I801 adapter at 0400 
temp1:        +59.0°C  (low  =  +0.0°C) 
                       (high =  +0.0°C, hyst =  -1.5°C) 
                       (crit = +74.0°C, hyst = +72.5°C) 

w83795adg-i2c-0-2f 
Adapter: SMBus I801 adapter at 0400 
in0:          +0.90 V  (min =  +0.67 V, max =  +1.49 V) 
in1:          +0.96 V  (min =  +0.67 V, max =  +1.49 V) 
in2:          +1.52 V  (min =  +1.35 V, max =  +1.65 V) 
in3:          +1.31 V  (min =  +1.13 V, max =  +1.38 V) 
in4:          +1.83 V  (min =  +1.63 V, max =  +2.00 V) 
in5:          +1.14 V  (min =  +0.98 V, max =  +1.21 V) 
in6:          +1.57 V  (min =  +1.20 V, max =  +1.65 V) 
in7:          +1.57 V  (min =  +1.20 V, max =  +1.65 V) 
in11:         +1.11 V  (min =  +0.00 V, max =  +2.05 V) 
+3.3V:        +3.24 V  (min =  +2.96 V, max =  +3.63 V) 
3VSB:         +3.28 V  (min =  +2.96 V, max =  +3.63 V) 
Vbat:         +3.25 V  (min =  +2.70 V, max =  +3.63 V) 
temp1:        +88.0°C  (high = +85.0°C, hyst = +80.0°C) 
                       (crit = +100.0°C, hyst = +95.0°C)  sensor = thermal diode 
temp5:        +44.2°C  (high = +85.0°C, hyst = +80.0°C) 
                       (crit = +75.0°C, hyst = +70.0°C)  sensor = thermistor 
temp7:        +50.5°C  (high = +95.0°C, hyst = +92.0°C) 
                       (crit = +95.0°C, hyst = +92.0°C)  sensor = Intel PECI 
temp8:        +48.8°C  (high = +95.0°C, hyst = +92.0°C) 
                       (crit = +95.0°C, hyst = +92.0°C)  sensor = Intel PECI 
intrusion0:  OK 

check_lm_sensors --list with 4.1.1:

sda -> 41
w83795adg_fan1 -> 0
w83795adg_fan2 -> 0
w83795adg_fan3 -> 0
w83795adg_fan4 -> 0
w83795adg_fan5 -> 0
w83795adg_fan6 -> 0
w83795adg_fan7 -> 0
w83795adg_fan8 -> 0
w83795adg_in0 -> 0.904
w83795adg_in1 -> 0.96
w83795adg_in11 -> 1.11
w83795adg_in12 -> 3.24
w83795adg_in13 -> 3.282
w83795adg_in14 -> 3.252
w83795adg_in2 -> 1.516
w83795adg_in3 -> 1.31
w83795adg_in4 -> 1.834
w83795adg_in5 -> 1.138
w83795adg_in6 -> 1.568
w83795adg_in7 -> 1.566
w83795adg_temp1 -> 87.5
w83795adg_temp2 -> -128
w83795adg_temp5 -> 44.5
w83795adg_temp7 -> 50.75
w83795adg_temp8 -> 48.75
LM_SENSORS OK - |

I can't post the output of check_lm_sensors --list with 3.1.1 as I can't find it anymore for download, but the checks I had defined are:

check_lm_sensors --sanitize \
    --high Core0=87.000,87.000 \
    --high Core1=87.000,87.000 \
    --high Core2=87.000,87.000 \
    --high Core3=87.000,87.000 \
    --high temp1=125.000,125.000 \
    --high temp5=85.000,85.000 \
    --high temp7=95.000,95.000 \
    --high temp8=95.000,95.000 \
    --high sdaTemp=50.000,50.000

error on check lm sensor --list

./check_lm_sensors --list
found temperature for drive sda Temp (sda Temp = 23)
found temperature for drive sda Temp (sda Temp = 23)
Use of uninitialized value $name in pattern match (m//) at ./check_lm_sensors line 325, <$IN> line 10.
Use of uninitialized value $name in concatenation (.) or string at ./check_lm_sensors line 329, <$IN> line 10.
Use of uninitialized value $name in concatenation (.) or string at ./check_lm_sensors line 331, <$IN> line 10.
Use of uninitialized value $name in concatenation (.) or string at ./check_lm_sensors line 365, <$output> line 1.
LM_SENSORS UNKNOWN - Error while executing /usr/sbin/hddtemp -n /dev/:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.