Replacement NRPE – NCPA

NCPA dashboard

There is a replacement for NRPE (Nagios Remote Plugin Executor) called NCPA (Nagios Cross Platform Agent).

NCPA is properly available on multiple platofrms, can can call the same plugin scripts used by NRPE. The existing nrpe has been pretty poorly supported on Windows I’ve found so I’m hoping NCPA does a better job.

NCPA goes further, offers you a bit of a GUI on each node if thats what you like but also a REST API which offers some potential, it can initiate passive alerts too which we can think about using.

Slipping it into an Existing Nagios /Core setup

Like we have check_nrpe on our Nagios Core server (open source Nagios), we can have check_ncpa.py and it can be configured to use the same scripts:

check_nrpe -H vuh-lb-wat002.herts.ac.uk -c check_yum

YUM OK: 0 Security Updates Available. 73 Non-Security Updates Available | security_updates_available=0 non_security_updates_available=73 total_updates_available=73

check_ncpa.py -H vuh-lb-wat002.herts.ac.uk  -t 'secret' -M 'plugins/check_yum.py' -a '-t 60'

YUM OK: 0 Security Updates Available. 73 Non-Security Updates Available | security_updates_available=0 non_security_updates_available=73 total_updates_available=73

A quick look as the GUI and you can get some basic CPU/memory graphs, look at the API and see what calls have been made to it.

OK so I will work on replacing a few nodes with this as a replacement and see how I get on.

It’s going to be better for cross platform wise. The Api might give us opportunties for different displays.

List available plugins:
curl -k 'https://localhost:5693/api/plugins?token=secret'
free disk space on /home using api :
curl -k 'https://localhost:5693/api/disk/logical/|home/free?token=secret&units=Gi' -s

The API endpoints
https://vuh-lb-wat002.herts.ac.uk:5693/api/services
https://vuh-lb-wat002.herts.ac.uk:5693/api/disks
https://vuh-lb-wat002.herts.ac.uk:5693/api/memory
https://vuh-lb-wat002.herts.ac.uk:5693/api/cpu
https://vuh-lb-wat002.herts.ac.uk:5693/api/users
https://vuh-lb-wat002.herts.ac.uk:5693/api/processes
https://vuh-lb-wat002.herts.ac.uk:5693/api/plugins
https://vuh-lb-wat002.herts.ac.uk:5693/api/interface

nagios cmd used disk space /(a builtin command (no plugin))
check_ncpa.py -H ipaddress -t secret -M 'disk/logical/|/used_percent' --w 90 -c 95
OK: Used_percent was 68.80 % | 'used_percent'=68.80%;90;95;
nagios cmd for process (a builtin command)
check_ncpa.py -H ipaddress -t 'secret' -P 5693 -M 'processes' -q 'name=vmtoolsd' -c 1:1


Checks logs (windows only!)
check_ncpa.py -H 10.25.14.91 -t Str0ngT0k3n -M logs -q name=system,severity=warning,severity=error,severity=critical,logged_after=1h


What operating system:
check_ncpa.py -H 10.25.14.91 -t Str0ngT0k3n -M system/system


CPU Used:
check_ncpa.py -H 10.25.254.50 -t Str0ngT0k3n -M cpu/percent --warning 
90 --critical 95

Memory Checks:
check_ncpa.py -H 10.25.254.50 -t Str0ngT0k3n -M memory/virtual/percent -w 90 -c 95


How many users on:
check_ncpa.py -H ipaddress -t secret  -M user/count -c 3 -w 2

Look around:
check_ncpa.py -H ipaddress -t secret   --list 

How many processes:
./check_ncpa.py -H <ncpaserver> -t mytoken -M 'processes' --warning=100 --critical=200

Calling a plugin:
check_ncpa.py -H <ncpaserver> -t mytoken -M 'plugins/check_smtp' -q "args=-u 'one argument',args=-p 'another argument'"

Check smtp connection:
check_ncpa.py -H ipaddress -t secret -M 'plugins/check_smtp' -q "args=-H 'smtp.com' args=-w '3' args=-c '1'"