I used the (somewhat limited) documentation.
1. create a restartservice.sh script in the plugins/ directory with execute permissions
2. call check_ncpa.py, as follows from the Nagios server:
Code: Select all
/usr/local/nagios/libexec/check_ncpa.py -H <host> -P 5693 -t 'token' -M plugins/restartservice.sh "-u 'ntpd'" -vCode: Select all
Connecting to: https://<host>:5693/api/plugins/restartservice.sh/?units=+%27ntpd%27&token=token&check=1
File returned contained:
{
"value": {
"returncode": 3,
"stdout": "Unable to run check on non-child node. Revise your query."
}
}
Unable to run check on non-child node. Revise your query.
-M plugins/restartservice.sh
-M /restartservice.sh
-M restartservice.sh
but we cannot execute the plugin script. Are we missing something obvious?
The NCPA is running fine: we get the performance dashboard web page and we are also able to retrieve performance data form the API tree, using check_ncpa.py. Just not able to execute a custom script.
Running with:
Nagios XI 5.2.0 on RHEL 6
check_ncpa.py version 1.0
NCPA agent 1.8.1 on RHEL 6
/usr/local/ncpa/etc/ncpa.cfg:
Code: Select all
[listener]
uid = nagios
certificate = adhoc
loglevel = info
ip = 0.0.0.0
gid = nagcmd
logfile = var/ncpa_listener.log
port = 5693
pidfile = var/ncpa_listener.pid
# Available versions: PROTOCOL SSLv2, SSLv3, TLSv1
ssl_version = TLSv1
[passive]
uid = nagios
handlers = nrds,nrdp
loglevel = info
gid = nagcmd
sleep = 300
logfile = var/ncpa_passive.log
pidfile = var/ncpa_passive.pid
[nrdp]
token = yourtoken
hostname = yourhostname
parent = yourparent
[nrds]
URL = None
CONFIG_VERSION = None
TOKEN = None
CONFIG_NAME = None
CONFIG_OS = None
[api]
community_string = x8uL5WSEbhBbsiWNVl2qXz
[plugin directives]
plugin_path = plugins/
.sh = /bin/sh $plugin_name $plugin_args
.ps1 = powershell -ExecutionPolicy Bypass -File $plugin_name $plugin_args
.vbs = cscript $plugin_name $plugin_args //NoLogo
[passive checks]
%HOSTNAME%|cpu usage = /cpu/percent --warning 20 --critical 30
%HOSTNAME%|swap usage = /memory/swap/percent --warning 40 --critical 80
%HOSTNAME%|memory usage = /memory/virtual/percent --warning 60 --critical 80