Ubuntu 26.04

Nagios : Add Monitoring Target Item2026/06/10

 

In addition to the default monitored items, you can add various other items to be monitored.
You can create and add your own check programs, but many are also available as plugin packages, making it easy to add major items to be monitored.
The following site offers many plugins that are not provided as packages.
⇒ https://www.nagios.org/downloads/nagios-plugins/

[1] Many plugins are provided like follows.
root@dlp:~#
ll /usr/lib/nagios/plugins

total 1904
drwxr-xr-x 2 root root  4096 Jun 10 00:47 ./
drwxr-xr-x 3 root root  4096 Apr 20 18:07 ../
-rwxr-xr-x 1 root root 35704 Jan 26 19:25 check_apt*
-rwxr-xr-x 1 root root  2337 Jan 26 19:25 check_breeze*
-rwxr-xr-x 1 root root 36088 Jan 26 19:25 check_by_ssh*
lrwxrwxrwx 1 root root     9 Jan 26 19:25 check_clamd@ -> check_tcp
-rwxr-xr-x 1 root root 31416 Jan 26 19:25 check_cluster*
-rwxr-xr-x 1 root root 90104 Jan 26 19:25 check_curl*
-rwxr-xr-x 1 root root 31608 Jan 26 19:25 check_dbi*
-rwxr-xr-x+1 root root 35576 Jan 26 19:25 check_dhcp*
.....
.....

# additional plugins can be used by installing the following packages

root@dlp:~#
apt search monitoring-plugins-contrib

monitoring-plugins-contrib/stable 48.20250420 amd64
  Plugins for nagios compatible monitoring systems
[2] For example, add the time difference with the NTP server as a monitoring item.
# check the usage of [check_ntp_time] plugin

root@dlp:~#
/usr/lib/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)

.....
.....

root@dlp:~#
vi /etc/nagios4/objects/commands.cfg
# add to last line : set command definition
define command{
    command_name    check_ntp_time
    command_line    $USER1$/check_ntp_time -H $ARG1$ -w $ARG2$ -c $ARG3$
}

root@dlp:~#
vi /etc/nagios4/objects/localhost.cfg
# add to last line
# time difference with the NTP server [10.0.0.10] is 1 second, warning,
# the difference is 2 seconds, critical
define service{
    use                             generic-service
    host_name                       localhost
    service_description             NTP_TIME
    check_command                   check_ntp_time!10.0.0.10!1!2
}

root@dlp:~#
systemctl reload nagios4

[3] It's possible to view the status for a new plugin on the admin site.
Matched Content