Nagios

Custom commands

Processes

Update /etc/nagios-plugins/config/procs.cfg to

# check count of given process is running
# ARG1 = # of processes
# ARG2 = Process Name
define command{
        command_name    check_procs_specific
        command_line    /usr/lib/nagios/plugins/check_procs -w '$ARG1$':'$ARG1$' -c '$ARG1$':1024 -C '$ARG2$'
        }

CPU usage per proc

# Check overall CPU usage per process
define command{
        command_name    check_procs_cpu
        command_line    /usr/lib/nagios/plugins/check_procs -w '$ARG1$' -c '$ARG2$' --metric=CPU -v
        }

Usage examples:

check_procs_specific!1!cron
check_procs_specific!1!BackupPC
check_procs_cpu!20!40

Disk

Update /etc/nagios-plugins/config/disk.cfg to:

# 'check_disk' command definition
# Senthil added "-A -i '.gvfs'" to the end due to error as shown below
#         DISK CRITICAL - /var/lib/lightdm/.gvfs is not accessible: Permission denied
define command{
    command_name    check_disk
    command_line    /usr/lib/nagios/plugins/check_disk -w '$ARG1$' -c '$ARG2$' -e -p '$ARG3$' -A -i '.gvfs'
    }

# 'check_all_disks' command definition
# Senthil added "-A -i '.gvfs'" to the end due to error
define command{
    command_name    check_all_disks
    command_line    /usr/lib/nagios/plugins/check_disk -w '$ARG1$' -c '$ARG2$' -e -A -i '.gvfs'
    }

Testing Nagios config file

Test Nagios configuration file as below:

/usr/sbin/nagios3 -v /etc/nagios3/nagios.cfg

QR Code
QR Code tech:nagios (generated for current page)