Nagios Active Checks (check_ncpa.py)

Nagios Active Checks (check_ncpa.py)

 
Nagios plugin:
https://assets.nagios.com/downloads/ncpa/check_ncpa.tar.gz
 
Copy check_ncpa.py  to /usr/local/nagios/libexec (plugin directory) or /usr/lib64/nagios/plugins/ (plugin directory Centos 6.9)
 
ln -s check_ncpa.py check_ncpa
 
Define new check_ncpa command by adding following lines to /usr/local/nagios/etc/objects/commands.cfg
 
define command {
    command_name    check_ncpa
    command_line    $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
}
 
or
 
 
define command {
    command_name    check_ncpa
    command_line    $USER1$/check_ncpa -H $HOSTADDRESS$ $ARG1$
}
 
 
Create ncpa.cfg file  in /usr/local/nagios/etc/objects
touch /usr/local/nagios/etc/objects/ncpa.cfg
 
Add following lines in ncpa.cfg to define host and monitoring services
 
define host {
    host_name               NCPA 2 Host
    address                 192.168.1.10
    check_command           check_ncpa!-t 'mytoken' -P 5693 -M system/agent_version
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24×7
    contacts                nagiosadmin
    notification_interval   60
    notification_period     24×7
    notifications_enabled   1
    icon_image              ncpa.png
    statusmap_image         ncpa.png
    register                1
}
 
define service {
    host_name               NCPA 2 Host
    service_description     CPU Usage
    check_command           check_ncpa!-t 'mytoken' -P 5693 -M cpu/percent -w 20 -c 40 -q 'aggregate=avg'
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24×7
    notification_interval   60
    notification_period     24×7
    contacts                nagiosadmin
    register                1
}
 
define service {
    host_name               NCPA 2 Host
    service_description     Memory Usage
    check_command           check_ncpa!-t 'mytoken' -P 5693 -M memory/virtual -w 50 -c 80 -u G
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24×7
    notification_interval   60
    notification_period     24×7
    contacts                nagiosadmin
    register                1
}
 
define service {
    host_name               NCPA 2 Host
    service_description     Process Count
    check_command           check_ncpa!-t 'mytoken' -P 5693 -M processes -w 150 -c 200
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24×7
    notification_interval   60
    notification_period     24×7
    contacts                nagiosadmin
    register                1
}
 
 
And finaly, tell Nagios to add monitoring from new configuration file by adding new cfg_file line to nagios.cfg file.
 
 
Change icon_image and statusmap_image  in ncpa.cfg file by choosing some png files from
/usr/local/nagios/share/images folder.

 
For example, instead ncpa.png (in ncpa.cfg) choose workstation.png
 
More info: https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/monitoring-windows.html

Credits: https://milanorlovic.blogspot.pt/2017/09/nagios-active-checks-checkncpapy.html

 

Leave a Reply

Your email address will not be published. Required fields are marked *