check_digitemp

check_digitemp

Nagios-plugin to read the the temperature of a one wire sensor (like DSL 1820) and compare it with the supplied thresholds.

Installation

  1. First start digitemp with these parameters digitemp_DS9097 -i -s /dev/ttyS0
  2. Then copy the file .digitemprc to /usr/local/nagios/ and the script check_digitemp.sh to the check-plugins-directory e.g. /usr/local/nagios/libexec
  3. Install sudo and edit the file /etc/sudoers. Insert nagios ALL=(ALL) NOPASSWD: /usr/bin/digitemp_DS9097
  4. Copy the file .digitemprc also to the /(root)-directory. This is needed, because the nrpe-daemon starts the programms with the PWD=/

Todo

  • errorhandling
  • check range and value of parameters

Needed hard- and software

software

  • digitemp (e.g. apt-get install digitemp)

hardware

Usage

`./check_digitemp -ts  -w  -c  -f`

Output

The plugin prints the temperature in centigrade or in fahrenheit followed by "ok" or either "warning" or "critical" if the corresponding threshold is reached.

Exit Codes

0 OK       Temperature checked and everything is ok
1 Warning  Temperature  above "warning" threshold
2 Critical Temperature  above "critical" threshold
3 Unknown  Invalid command line arguments or could not read the sensor

Example

check_digitemp -ts C -w 22 -c 25 -f

21.81 C - ok          (exit code 0)
23.00 C - warning     (exit code 1)
26.23 C - critical    (exit code 2)

Paths to commands used in this script. These may have to be modified to match your system setup.

Links

http://www.linuxnetmag.com/de/issue8/m8temperature1.html (german)

http://www.linuxnetmag.com/en/issue8/m8temperature1.html (english)