matteocorti / nagios_plugins

18 stars 7 forks source link

check_lm_sensors doesn't work with drive temperatures #142

Open martins-pukitis opened 5 years ago

martins-pukitis commented 5 years ago

Hi. Somehow doesn't work for me. I've added printouts of $major, $minor, $blocs, $name in parse_drives. Here's what I get: $ sudo ./check_lm_sensors --high sda_Temp=50,55 --nosensors -vvv hddtemp found at /usr/sbin/hddtemp Looking for drives in /proc/partitions major major minor minor blocs #blocks name name Use of uninitialized value $major in concatenation (.) or string at ./check_lm_sensors line 318, <$IN> line 2. major Use of uninitialized value $minor in concatenation (.) or string at ./check_lm_sensors line 319, <$IN> line 2. minor Use of uninitialized value $blocs in concatenation (.) or string at ./check_lm_sensors line 320, <$IN> line 2. blocs Use of uninitialized value $name in concatenation (.) or string at ./check_lm_sensors line 321, <$IN> line 2. name major 8 minor 0 blocs 312570167 name sda checking disk /dev/sda found temperature for drive sda Temp (sda Temp = 45) major 8 minor 1 blocs 248832 name sda1 major 8 minor 2 blocs 1 name sda2 major 8 minor 5 blocs 312318976 name sda5 major major minor minor blocs #blocks name name Use of uninitialized value $major in concatenation (.) or string at ./check_lm_sensors line 318, <$IN> line 8. major Use of uninitialized value $minor in concatenation (.) or string at ./check_lm_sensors line 319, <$IN> line 8. minor Use of uninitialized value $blocs in concatenation (.) or string at ./check_lm_sensors line 320, <$IN> line 8. blocs Use of uninitialized value $name in concatenation (.) or string at ./check_lm_sensors line 321, <$IN> line 8. name major 8 minor 0 blocs 312570167 name sda checking disk /dev/sda found temperature for drive sda Temp (sda Temp = 45) major 1 Use of uninitialized value $minor in concatenation (.) or string at ./check_lm_sensors line 319, <$IN> line 10. minor Use of uninitialized value $blocs in concatenation (.) or string at ./check_lm_sensors line 320, <$IN> line 10. blocs Use of uninitialized value $name in concatenation (.) or string at ./check_lm_sensors line 321, <$IN> line 10. name Use of uninitialized value $name in pattern match (m//) at ./check_lm_sensors line 327, <$IN> line 10. Use of uninitialized value $name in concatenation (.) or string at ./check_lm_sensors line 331, <$IN> line 10. checking disk /dev/ Use of uninitialized value $name in concatenation (.) or string at ./check_lm_sensors line 333, <$IN> line 10. Use of uninitialized value $name in concatenation (.) or string at ./check_lm_sensors line 367, <$output> line 1. warning: temperature for /dev/ not available LM_SENSORS UNKNOWN - Error while executing sudo /usr/sbin/hddtemp -n /dev/:

As you see at some step major is 1, but name is empty, which leads to error when executing hddtemp.

$ cat /proc/partitions major minor #blocks name

8 0 312570167 sda 8 1 248832 sda1 8 2 1 sda2 8 5 312318976 sda5 8 16 5860522584 sdb 8 17 5860521543 sdb1 8 32 9766436864 sdc 8 33 335544320 sdc1 8 34 9430891503 sdc2 8 48 2930266584 sdd 8 49 2930265088 sdd1 254 0 155648000 dm-0 254 1 16773120 dm-1 254 2 139505664 dm-2 254 3 389120 dm-3 254 4 9430888448 dm-4