Page 1 of 1

Check_temp.pl Error: I did not get a temp from the sensor data mathcing REGEX

Posted: Wed Jul 10, 2024 11:25 am
by Kyetech IT manager
Hello all
Have a Dell R620 with SUSE 11 SP4 (old but working)
with 2 x Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz

kye-vmh01:~ # perl -V
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
Platform:
osname=linux, osvers=2.6.32, archname=x86_64-linux-thread-multi
uname='linux sheep28 2.6.32 #1 smp fri jun 14 08:21:43 utc 2013 (ccab990) x86_64 x86_64 x86_64 gnulinux '


running check_temp.pl I never get a temp reading
from https://exchange.nagios.org/directory/P ... pl/details

---
kye-vmh01:/usr/lib/nagios/plugins # sensors
coretemp-isa-0000
Adapter: ISA adapter
Physical id 0: +52.0°C (high = +79.0°C, crit = +89.0°C)
Core 0: +51.0°C (high = +79.0°C, crit = +89.0°C)
Core 1: +52.0°C (high = +79.0°C, crit = +89.0°C)
Core 2: +49.0°C (high = +79.0°C, crit = +89.0°C)
Core 3: +48.0°C (high = +79.0°C, crit = +89.0°C)
Core 4: +47.0°C (high = +79.0°C, crit = +89.0°C)
Core 5: +43.0°C (high = +79.0°C, crit = +89.0°C)
Core 6: +52.0°C (high = +79.0°C, crit = +89.0°C)
Core 7: +50.0°C (high = +79.0°C, crit = +89.0°C)

coretemp-isa-0001
Adapter: ISA adapter
Physical id 1: +49.0°C (high = +79.0°C, crit = +89.0°C)
Core 0: +44.0°C (high = +79.0°C, crit = +89.0°C)
Core 1: +46.0°C (high = +79.0°C, crit = +89.0°C)
Core 2: +42.0°C (high = +79.0°C, crit = +89.0°C)
Core 3: +46.0°C (high = +79.0°C, crit = +89.0°C)
Core 4: +49.0°C (high = +79.0°C, crit = +89.0°C)
Core 5: +45.0°C (high = +79.0°C, crit = +89.0°C)
Core 6: +48.0°C (high = +79.0°C, crit = +89.0°C)
Core 7: +44.0°C (high = +79.0°C, crit = +89.0°C)
---

Combos I've tried

---
kye-vmh01:/usr/lib/nagios/plugins # perl check_temp.pl -s coretemp-isa-0001:
Error: I did not get a temp from the sensor data mathcing REGEX = /coretemp-isa-0001::/
kye-vmh01:/usr/lib/nagios/plugins # perl check_temp.pl -s coretemp-isa-0001
Error: I did not get a temp from the sensor data mathcing REGEX = /coretemp-isa-0001:/
kye-vmh01:/usr/lib/nagios/plugins # perl check_temp.pl -s 'Physical id 0'
Error: I did not get a temp from the sensor data mathcing REGEX = /Physical id 0:/
kye-vmh01:/usr/lib/nagios/plugins #
kye-vmh01:/usr/lib/nagios/plugins # perl check_temp.pl -s core
Error: I did not get a temp from the sensor data mathcing REGEX = /core:/
kye-vmh01:/usr/lib/nagios/plugins # perl check_temp.pl -s Core
Error: I did not get a temp from the sensor data mathcing REGEX = /Core:/
kye-vmh01:/usr/lib/nagios/plugins # perl check_temp.pl -s Physical
Error: I did not get a temp from the sensor data mathcing REGEX = /Physical:/
kye-vmh01:/usr/lib/nagios/plugins # perl check_temp.pl -s physical
Error: I did not get a temp from the sensor data mathcing REGEX = /physical:/
kye-vmh01:/usr/lib/nagios/plugins # perl check_temp.pl -s Physical id o
Error: I did not get a temp from the sensor data mathcing REGEX = /Physical:/
kye-vmh01:/usr/lib/nagios/plugins # perl check_temp.pl -s Physical id 0
Error: I did not get a temp from the sensor data mathcing REGEX = /Physical:/
kye-vmh01:/usr/lib/nagios/plugins # perl check_temp.pl -s 'Core .'
Error: I did not get a temp from the sensor data mathcing REGEX = /Core .:/
kye-vmh01:/usr/lib/nagios/plugins # perl check_temp.pl -s 'Core '
Error: I did not get a temp from the sensor data mathcing REGEX = /Core :/
kye-vmh01:/usr/lib/nagios/plugins # perl check_temp.pl -c 85 -w 75 -s 'Core .'
Error: I did not get a temp from the sensor data mathcing REGEX = /Core .:/
kye-vmh01:/usr/lib/nagios/plugins # perl check_temp.pl -c 85 -w 75 -s 'Core 0'
Error: I did not get a temp from the sensor data mathcing REGEX = /Core 0:/
kye-vmh01:/usr/lib/nagios/plugins # perl check_temp.pl -c 85 -w 75 -s 'Physical id 0'
Error: I did not get a temp from the sensor data mathcing REGEX = /Physical id 0:/
---

What an I doing wrong?

viewtopic.php?t=56124 was some help, but still no joy

I just need the temp from each physical CPU - from these lines
Physical id 0: +52.0°C (high = +79.0°C, crit = +89.0°C)
Physical id 1: +49.0°C (high = +79.0°C, crit = +89.0°C)

Running check_temp.pl from the SLES 11 box locally

---
kye-vmh01:/usr/lib/nagios/plugins # ./check_temp.pl -h
Monitor temperature with the use of /usr/bin/sensors
Version 1.2
(c) 2011 Chad Columbus <[email protected]>
---

later to get the temp in nagios via nrpe
- already using nrpe to get disk space & remote load status of this server

Re: Check_temp.pl Error: I did not get a temp from the sensor data mathcing REGEX

Posted: Tue Jul 16, 2024 11:04 am
by danderson
Thanks for reaching out @Kyetech IT manager,

Don't worry, I don't think you're doing anything wrong. I tried out the plugin myself and I noticed a possible bug.

If you look around line 115 in the plugin, you'll see the regex that the plugin is matching against

Code: Select all

my $pattern = "($sensor_regex)" . '\:[\s\n\r]{1,}[\+\-]{0,1}(\d{1,3}(?:\.\d{1,2}){0,1}).[CF]';
The issue is that the degree symbol "°" seems to take up two characters. I was able to fix the bug by adding the pattern match at the end to include to characters before [CF]

Code: Select all

my $pattern = "($sensor_regex)" . '\:[\s\n\r]{1,}[\+\-]{0,1}(\d{1,3}(?:\.\d{1,2}){0,1})..[CF]';
Let me know if this fix works for you

Re: Check_temp.pl Error: I did not get a temp from the sensor data mathcing REGEX

Posted: Tue Jul 16, 2024 11:56 am
by Kyetech IT manager
Hello danderson;

Add in the extra dot in the filter line helped and is working now both locally & with nrpe
- now to mention to the creator of this lovely script

--- local
kye-vmh01:/usr/lib/nagios/plugins # perl check_temp.pl -c 85 -w 75 -s 'Physical id 1'
TEMP OK - 48.0
Physical id 1 Temperature OK 48.0 ###

kye-vmh01:/usr/lib/nagios/plugins # perl check_temp.pl -c 85 -w 75 -s 'Physical id 0'
TEMP OK - 59.0
Physical id 0 Temperature OK 59.0 ###

--- nrpe
command[check_temp0]=/usr/lib/nagios/plugins/check_temp.pl -w 75 -c 85 -s "Physical id 0"
command[check_temp1]=/usr/lib/nagios/plugins/check_temp.pl -w 75 -c 85 -s "Physical id 1"

kye-mon01:/omd/sites/Kyetech/lib/monitoring-plugins # /omd/sites/Kyetech/lib/monitoring-plugins/check_nrpe -H 172.16.101.2 -c check_temp1 -n
TEMP OK - 53.0
Physical id 1 Temperature OK 53.0 ###

kye-mon01:/omd/sites/Kyetech/lib/monitoring-plugins # /omd/sites/Kyetech/lib/monitoring-plugins/check_nrpe -H 172.16.101.2 -c check_temp0 -n
TEMP OK - 58.0
Physical id 0 Temperature OK 58.0 ###


Thanks a lot. You get 1000 points.

Re: Check_temp.pl Error: I did not get a temp from the sensor data mathcing REGEX

Posted: Wed Jul 17, 2024 10:53 am
by danderson
Glad to know you got that issue fixed!