Check_temp.pl No sensors found on Nagios

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
vkodanam
Posts: 15
Joined: Thu Oct 10, 2019 10:16 am

Check_temp.pl No sensors found on Nagios

Post by vkodanam »

Hey guys, I was testing one of the physical servers to be monitored with the Nagios Core. I’ve used the check_temp.pl plugin to do this. Installed the lm-sensors on the physical server that I was testing and then ran a detect-sensors where it did a couple of tests and detected Intel Digital Thermal Sensor. After all of this, I ran sensors command and was able to see the temperature for each core. Made changes to localhost.cfg on the Nagios server with the command to be used, added the physical server to the hosts.cfg and Nagios started monitoring everything that I scheduled the checks for, expect the check_temp. It throws the following error:


No sensors found!
Make sure you loaded all the kernel drivers you need.
Try sensors-detect to find out which these are.

I’ve researched on the Internet, but couldn’t find the exact reason for this. The physical server has CentOS and Nagios is running on Ubuntu. Please let me know what you think of the error above. Also, could you please share if there’s any knowledge base article for temp monitoring that Nagios recommends?
Last edited by vkodanam on Tue Oct 29, 2019 1:23 pm, edited 1 time in total.
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Check_temp.pl No sensors found on Nagios

Post by mbellerue »

vkodanam wrote:After all of this, I ran sensors command and was able to see the temperature for each core.
When you tested the command, did you test it as the nagios user? It's best to do su - nagios when switching to the nagios user, that way you get its environment exactly.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
vkodanam
Posts: 15
Joined: Thu Oct 10, 2019 10:16 am

Re: Check_temp.pl No sensors found on Nagios

Post by vkodanam »

mbellerue wrote:
vkodanam wrote:After all of this, I ran sensors command and was able to see the temperature for each core.
When you tested the command, did you test it as the nagios user? It's best to do su - nagios when switching to the nagios user, that way you get its environment exactly.
Hi Mbellerue, Yes, I tested as

Code: Select all

su - nagios
and it generates an output. This is what it displays:

Code: Select all

su - nagios 
[nagios@XXXXXXX]$ sensors
coretemp-isa-0000
Adapter: ISA adapter
Physical id 0:  +26.0°C  (high = +95.0°C, crit = +105.0°C)
Core 0:         +25.0°C  (high = +95.0°C, crit = +105.0°C)
Core 1:         +25.0°C  (high = +95.0°C, crit = +105.0°C)
Core 2:         +23.0°C  (high = +95.0°C, crit = +105.0°C)
Core 3:         +23.0°C  (high = +95.0°C, crit = +105.0°C)
Core 4:         +23.0°C  (high = +95.0°C, crit = +105.0°C)
Core 5:         +23.0°C  (high = +95.0°C, crit = +105.0°C)
Core 6:         +25.0°C  (high = +95.0°C, crit = +105.0°C)
Core 7:         +26.0°C  (high = +95.0°C, crit = +105.0°C)
Core 8:         +25.0°C  (high = +95.0°C, crit = +105.0°C)
Core 9:         +26.0°C  (high = +95.0°C, crit = +105.0°C)
Core 10:        +24.0°C  (high = +95.0°C, crit = +105.0°C)
Core 11:        +24.0°C  (high = +95.0°C, crit = +105.0°C)
Core 12:        +24.0°C  (high = +95.0°C, crit = +105.0°C)
Core 13:        +25.0°C  (high = +95.0°C, crit = +105.0°C)
Core 14:        +24.0°C  (high = +95.0°C, crit = +105.0°C)
Core 15:        +25.0°C  (high = +95.0°C, crit = +105.0°C)
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Check_temp.pl No sensors found on Nagios

Post by lmiltchev »

Can you post your host, service, and command definitions (plus any relevant templates that are used, if any)?
Be sure to check out our Knowledgebase for helpful articles and solutions!
vkodanam
Posts: 15
Joined: Thu Oct 10, 2019 10:16 am

Re: Check_temp.pl No sensors found on Nagios

Post by vkodanam »

/etc/nagios/objects/commands.cfg
define command {
command_name check_temp
command_line $USER1$/check_temp.pl -w $ARG1$ -c $ARG2$ -s $ARG3$
}

/etc/nagios/objects/host.cfg
define service{
use local-service
host_name name of the host
service_description CPU Temp
check_command check_temp!75!85!"CPU ., Core ."
}
define host {
use linux-server
host_name XXXXXXX
alias XXXXXXX
address XX.XXX.XXXX
register 1
contact_groups admins
}
I removed the service and host config for temp monitoring for now, but the above config is what I've used. And the plugin I used is check_temp.pl from exchange.nagios.org
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Check_temp.pl No sensors found on Nagios

Post by lmiltchev »

[nagios@XXXXXXX]$ sensors
coretemp-isa-0000
Adapter: ISA adapter
Physical id 0: +26.0°C (high = +95.0°C, crit = +105.0°C)
Core 0: +25.0°C (high = +95.0°C, crit = +105.0°C)
Core 1: +25.0°C (high = +95.0°C, crit = +105.0°C)
Core 2: +23.0°C (high = +95.0°C, crit = +105.0°C)
Core 3: +23.0°C (high = +95.0°C, crit = +105.0°C)
Core 4: +23.0°C (high = +95.0°C, crit = +105.0°C)
Core 5: +23.0°C (high = +95.0°C, crit = +105.0°C)
Core 6: +25.0°C (high = +95.0°C, crit = +105.0°C)
Core 7: +26.0°C (high = +95.0°C, crit = +105.0°C)
Core 8: +25.0°C (high = +95.0°C, crit = +105.0°C)
Core 9: +26.0°C (high = +95.0°C, crit = +105.0°C)
Core 10: +24.0°C (high = +95.0°C, crit = +105.0°C)
Core 11: +24.0°C (high = +95.0°C, crit = +105.0°C)
Core 12: +24.0°C (high = +95.0°C, crit = +105.0°C)
Core 13: +25.0°C (high = +95.0°C, crit = +105.0°C)
Core 14: +24.0°C (high = +95.0°C, crit = +105.0°C)
Core 15: +25.0°C (high = +95.0°C, crit = +105.0°C)
I don't see "CPU" in the sensor's output. Try changing your command from this:

Code: Select all

check_command check_temp!75!85!"CPU ., Core ."
to this:

Code: Select all

check_command check_temp!75!85!'Core .'
to see if this is going to fix the issue.

You can also try the following check from the command line:

Code: Select all

/usr/local/nagios/libexec/check_temp.pl -c 85 -w 75 -s 'Core .'
Also, the path to sensors is hard-coded in the plugin:

Code: Select all

# Sensor program
my $SENSORPROG = "/usr/bin/sensors";
Run the following command to find out if your path is the same:

Code: Select all

which sensors
Be sure to check out our Knowledgebase for helpful articles and solutions!
vkodanam
Posts: 15
Joined: Thu Oct 10, 2019 10:16 am

Re: Check_temp.pl No sensors found on Nagios

Post by vkodanam »

I've tried the suggested changes and it still says I don't have sensors installed in /bin/sensors as that's the path I've got from command

Code: Select all

which sensors
on the machine. Do you know of any other plugins that I can try ?

E-mail from Nagios:

***** Nagios *****nnNotification Type: PROBLEMnnService:Core TempnHost: yXXXXXs: 192.168.XX.XXnState: UNKNOWNnnDate/Time: Mon Oct 28 12:55:47 CDT 2019nnAdditional Info:nn(No output returned from plugin)
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Check_temp.pl No sensors found on Nagios

Post by lmiltchev »

Can you run:

Code: Select all

which sensors
and show the output?

Also, upload the "check_temp.pl" plugin on the forum. You can rename it to "check_temp.txt" prior to uploading it.
Be sure to check out our Knowledgebase for helpful articles and solutions!
vkodanam
Posts: 15
Joined: Thu Oct 10, 2019 10:16 am

Re: Check_temp.pl No sensors found on Nagios

Post by vkodanam »

When I run

Code: Select all

which sensors
as root, I see

Code: Select all

/bin/sensors
.

Code: Select all

[root@xxxxxxxx ~]# which sensors
/bin/sensors


Check_temp file. I've changed the sensors location to /bin/sensors as that's what was showing under root. But, it'd still say no sensors
Attachments
Check_temp.rtf
(7.28 KiB) Downloaded 127 times
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Check_temp.pl No sensors found on Nagios

Post by lmiltchev »

Let's step back for a minute. You said:
Hey guys, I was testing one of the physical servers to be monitored with the Nagios Core.
...
The physical server has CentOS and Nagios is running on Ubuntu.
The "check_temp.pl" plugin is meant to be run locally, so if you sensor is on the CentOS machine, are you running the plugin on the same box too? Did you run the "which sensors" command on the CentOS or on the Ubuntu machine? Do you get the path if you run the same command as nagios user?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked