check_digitemp.sh

check_digitemp.sh

Plugin for Nagios/Icinga to monitor temperature from a 1-wire temperature sensor with digitemp.

1-Wire Temperature monitor plugin with digitemp for Icinga

Description of the parameters:

 -w: threshold for warning temperature
 -c: threshold for critical temperature
 -p: send perfdata to nagios/icinga
 -s: sensor nummer (default: all)
 -d: debug modus

Usage:

check_digitemp.sh [-w NN.NN] [-c NN.NN] [-p] [-s] [-d]

check_digitemp.sh -h|--help

check_digitemp.sh -v|--version

Installation guidelines

Required software

Linuxmagazin 03/10 Page 78: Grundlagen und freie Software für 1-Wire-Sensoren

Copy the script check_digitemp.sh to the check-plugins-directory e.g. /usr/local/icinga/libexec

Install sudo and edit the file /etc/sudoers. Insert icinga ALL=(ALL) NOPASSWD: /usr/bin/digitemp_DS2490

Tested Systems: Debian, Ubuntu

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 -w 22.10 -c 25.00 -p 21.81 C - ok (exit code 0) 23.00 C - warning (exit code 1) 26.23 C - critical (exit code 2)

Icinga integration:

Add a command to /usr/local/icinga/etc/objects/checkcommands.cfg like this:

define command{
    command_name    check_digitemp
    command_line    $USER1$/check_digitemp.sh -w $ARG1$ -c $ARG2$ -s $ARG3$ -p

    }

Tell Icinga to monitor the temperature by adding a service line like this to your service.cfg file:

define service{
    use                             generic-service
    host_name                       servername
    service_description             Temperature
    is_volatile                     0
    check_period                    24x7
    max_check_attempts              3
    normal_check_interval           5
    retry_check_interval            2
    contact_groups                  admins
    notification_interval           240
    notification_period             24x7
    notification_options            w,u,c,r
    check_command                   check_digitemp!65!80!0
    }

TODO:

Sensor anzeige einbauen (-l list available sensors)

10805902010800AD : DS1820/DS18S20/DS1920 Temperature Sensor
10B196020108003A : DS1820/DS18S20/DS1920 Temperature Sensor
ROM 0 0x10 0x80 0x59 0x02 0x01 0x08 0x00 0xAD
ROM 1 0x10 0xB1 0x96 0x02 0x01 0x08 0x00 0x3A