Nagios 4 : Set Thresholds |
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/nagios/objects/localhost.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 local-service ; Name of service template to use
host_name localhost
service_description Root Partition
check_command check_local_disk!20%!10%!/
}
.....
.....
[root@dlp ~]# systemctl restart nagios |
| [2] | For the case you add a new plugin and configure it, set like follows. (example below is for [check_ntp_time] plugin) |
[root@dlp ~]# dnf --enablerepo=epel -y install nagios-plugins-ntp # display options for a plugin to confirm usage [root@dlp ~]# /usr/lib64/nagios/plugins/check_ntp_time -h .....
.....
-w, --warning=THRESHOLD
Offset to result in warning status (seconds)
-c, --critical=THRESHOLD
Offset to result in critical status (seconds)
.....
.....
# add definition of command for a plugin with thresholds' options [root@dlp ~]# vi /etc/nagios/objects/commands.cfg # add 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/nagios/objects/localhost.cfg # add to the end # Warning with 1 sec time difference, Critical with 2 sec difference define service {
use local-service
host_name localhost
service_description NTP_TIME
check_command check_ntp_time!ntp.nict.jp!1!2
notifications_enabled 1
}
systemctl restart nagios |
| [3] | The notification is sent if a system value is over the threshold. |
Date: Wed, 10 Aug 2022 13:18:18 +0900 To: root@localhost Subject: ** PROBLEM Service Alert: localhost/NTP_TIME is CRITICAL ** Message-Id: <20220810041818.19C18207CDC4@dlp.srv.world< From: nagios@dlp.srv.world ***** Nagios ***** Notification Type: PROBLEM Service: NTP_TIME Host: localhost Address: 127.0.0.1 State: CRITICAL Date/Time: Wed Aug 10 13:18:18 JST 2022 Additional Info: NTP CRITICAL: Offset 112.1195108 secs, stratum best:0 worst:1 |
No comments:
Post a Comment