added Raspberry Pi CPU temperature reading

please note: CLI change: now need to specify which device to read!

Documentation updated accordingly
This commit is contained in:
2018-01-06 20:06:27 +01:00
parent 3e330c37e2
commit 8afdb5e311
2 changed files with 140 additions and 94 deletions

View File

@@ -25,7 +25,7 @@ This repository contains the following scripts:
* [check_otp](#check_otp)
plugin to monitor PrivacyIDEA (and LinOTP) OTP validation
* [check_temperature](#check_temperature)
plugin to monitor the temperature of a 1-wire sensor on a RaspberryPi
plugin to monitor the CPU temperature of a RaspberryPi or that of a DS18b20 1-wire sensor on a RaspberryPi
* [nagiosstatus](#nagiosstatus)
CGI-BIN script to report the status of nagios (to monitor nagios itself)
@@ -237,15 +237,16 @@ define service {
<a name=check_temperature>plugins/check_temperature</a>
-------------------------------------------------------
Plugin (check) to monitor monitor the temperature using a sensor connected to a
RaspberryPi. This implementation is specifically for the DS18B20 1-wire
temperature sensor. Other methods and interfaces can be plugged in easily (just
raise a request or provide a patch). For information on how to connect sensor
to the RaspberryPi and to get it working please see [this Adafruit tutorial](
Plugin (check) to monitor monitor the Raspberry Pi CPU temperature or that of a
temperature sensor connected to a RaspberryPi. This implementation currently
supports the DS18B20 1-wire temperature sensor. Other methods and interfaces can
be plugged in easily (just raise a request or provide a patch). For information
on how to connect sensor to the RaspberryPi and to get it working please see
[this Adafruit tutorial](
https://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing).
To enable the 1-wire interface support on the RaspberryPi one can use the
command:
No setup is required to read the CPU temperature. To enable the 1-wire interface
support on the RaspberryPi one can use the command:
~~~
sudo raspi-config nonint do_onewire 0
~~~
@@ -256,32 +257,46 @@ Installation for is straightforward, after installing the script on the server
add the following to your Nagios `commands.cmd` configuration file:
~~~
# 'check_cpu_temperature' command definition to monitor CPU temperature in C
# parameters: warning (ARG1) and critical (ARG2) temperature in Celcius
define command {
command_name check_temperature
command_line [install_path]/plugins/check_temperature -w $ARG1$ -c $ARG2$ rpi_cpu
}
# 'check_cpu_ftemperature' command definition to monitor CPU temperature in F
# parameters: warning (ARG1) and critical (ARG2) temperature in Celcius
define command {
command_name check_temperature
command_line [install_path]/plugins/check_temperature -F -w $ARG1$ -c $ARG2$ rpi_cpu
}
# 'check_temperature' command definition to monitor a single temperature in C
# parameters: warning (ARG1) and critical (ARG2) temperature in Celcius
define command {
command_name check_temperature
command_line [install_path]/plugins/check_temperature -w $ARG1$ -c $ARG2$
command_line [install_path]/plugins/check_temperature -w $ARG1$ -c $ARG2$ w1_ds18b20
}
# 'check_ftemperature' command definition to monitor a single temperature in F
# parameters: warning (ARG1) and critical (ARG2) temperature in Farenheit
define command {
command_name check_ftemperature
command_line [install_path]/plugins/check_temperature -F -w $ARG1$ -c $ARG2$
command_line [install_path]/plugins/check_temperature -F -w $ARG1$ -c $ARG2$ w1_ds18b20
}
# 'check_temperature_sensor' command definition to monitor a single temperature in C
# parameters: sensor serial (ARG1), warning (ARG2) and critical (ARG3) temperature in Celcius
define command {
command_name check_temperature_sensor
command_line [install_path]/plugins/check_temperature -s $ARG1$ -w $ARG2$ -c $ARG3$
command_line [install_path]/plugins/check_temperature -w $ARG2$ -c $ARG3$ w1_ds18b20 -s $ARG1$
}
# 'check_ftemperature_sensor' command definition to monitor a single temperature in F
# parameters: sensor serial (ARG1), warning (ARG2) and critical (ARG3) temperature in Farenheit
define command {
command_name check_ftemperature_sensor
command_line [install_path]/plugins/check_temperature -F -s $ARG1$ -w $ARG2$ -c $ARG3$
command_line [install_path]/plugins/check_temperature -F -w $ARG2$ -c $ARG3$ w1_ds18b20 -s $ARG1$
}
~~~
@@ -290,6 +305,14 @@ Make sure to replace `[install_path]/plugins` with the location of the script.
To use the it define a service check like below:
~~~
# check RaspberryPi CPU temperature in Celcius
define service {
host hostname.mydomain.tld
service_description CPU Temperature
check_command check_cpu_temperature!55!75
use generic-service
}
# check temperature in Celcius using a DS18B20 sensor connected to a RaspberryPi
define service {
host hostname.mydomain.tld
@@ -298,7 +321,6 @@ define service {
use generic-service
}
# check temperature with DS18B20 sensor 0000a31ea3de connected to a RaspberryPi
define service {
host hostname.mydomain.tld
@@ -340,3 +362,4 @@ General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, download it from <http://www.gnu.org/licenses/>.