Ubuntu 16.04
Sponsored Link

Nagios : Set Thresholds2016/06/08

 
This is the Threshold settings section.
It is set on some items by default but if you change it, configure like follows.
[1] The thresholds are set in configuration file by default. For example, the item for monitoring disk usage of root partition is set like follows.
root@dlp:~#
vi /etc/nagios3/conf.d/localhost_nagios2.cfg
# Define a service to check the disk space of the root partition
# on the local machine.  Warning if > 20% free, critical if
# > 10% free space on partition.

# the thresholds are set as Warning if > 20% free, critical if 10% > 10% free

# change these values if you'd like to change them

define service{
        use                             generic-service
        host_name                       localhost
        service_description             Disk Space
        check_command                   check_all_disks!20%!10%
        }
[2] For the case you add a new plugin and configure for it all, set like follows. (the example is a case for adding check_ntp_time plugin)
# display options for a plugin

root@dlp:~#
/usr/lib/nagios/plugins/check_ntp_time -h

...
...
 -w, --warning=THRESHOLD
    Offset to result in warning status (seconds)
 -c, --critical=THRESHOLD
...
...

# add definition of command for a plugin with thresholds' options

root@dlp:~#
vi /etc/nagios3/commands.cfg
# add follows to the end

define command{
        command_name    check_ntp_time
        command_line    $USER1$/check_ntp_time -H $ARG1$ -w $ARG2$ -c $ARG3$
        }

# add definition of service with thresholds' values

root@dlp:~#
vi /etc/nagios3/conf.d/localhost_nagios2.cfg
# add follows to the end ( Warning if it has 1 sec time difference, Critical if it has 2 sec )

define service{
        use                             generic-service
        host_name                       localhost
        service_description             NTP_TIME
        check_command                   check_ntp_time!ntp1.jst.mfeed.ad.jp!1!2
        }

root@dlp:~#
systemctl restart nagios3

[3] The notification is sent if a system value is over the threshold.
Subject: ** PROBLEM Service Alert: localhost/NTP_TIME is CRITICAL **
To: >root@localhost>
X-Mailer: mail (GNU Mailutils 2.99.99)
Message-Id: <20160609050550.4E25B15FB8A@dlp.srv.world>
Date: Thu,  9 Jun 2016 14:05:50 +0900 (JST)
From: nagios@dlp.srv.world

***** Nagios *****

Notification Type: PROBLEM

Service: NTP_TIME
Host: localhost
Address: 127.0.0.1
State: CRITICAL

Date/Time: Thu Jun 9 14:05:50 JST 2016

Additional Info:

NTP CRITICAL: Offset -1184.919259 secs
Matched Content