Page 1 of 1

check indoor climate with a sensor

Posted: Sat Mar 28, 2020 5:48 am
by C.Appl
Hi everyone,
I want to check the humidity and temperature of a room with a dht22 sensor.
So I installed the nessecary plugins wiringPi and lol_dht22. So now I'am able to check the Humidity/Temperature in the commandline.
But i want so see also the stats in the webinterface,that's why i create a humidity.sh and temerature.sh with the query in usr/lib/nagios/plugins and the commands in /etc/nagios/nrpe.cfg. And at least i assigned the query to the device.

But I get following error:
Return code of 13 for service 'Temperatur' on host 'raspberrypi' was out of bounds
(same Error for Humidity)

Re: check indoor climate with a sensor

Posted: Mon Mar 30, 2020 5:35 pm
by Box293
Most likely when you are executing from the command line you are doing this as the root user.

I suggest you sudo as the nagios user and then execute the command again and see what error it reports.

Re: check indoor climate with a sensor

Posted: Tue Mar 31, 2020 5:56 am
by C.Appl
Oh your right, thanks dude.
I guess Iam on the right way now, but i have still an error message.

(No output on stdout) stderr: sudo: /usr/lib/nagios/plugins/dht22-temperature.sh: command not found

But i created the commands in the commands.cfg and in the plugins directory

Code: Select all

define command {
command_name    check_hum
command_line    sudo /usr/lib/nagios/plugins/dht22-humidity.sh
}

Code: Select all

define command {
command_name    check_temp
command_line    sudo /usr/lib/nagios/plugins/dht22-temperature.sh
}
And also

Re: check indoor climate with a sensor

Posted: Tue Mar 31, 2020 8:37 am
by scottwilkerson
You need to mark these executable

Code: Select all

chmod +x /usr/lib/nagios/plugins/dht22-temperature.sh
chmod +x /usr/lib/nagios/plugins/dht22-humidity.sh

Re: check indoor climate with a sensor

Posted: Tue Mar 31, 2020 9:19 am
by C.Appl
Thank you, it works!

Re: check indoor climate with a sensor

Posted: Tue Mar 31, 2020 9:30 am
by scottwilkerson
C.Appl wrote:Thank you, it works!
Great!

Locking thread