Page 1 of 1

How to pass arguments to plugin via NCPA config file?

Posted: Fri Sep 29, 2017 5:42 pm
by dianad
Hello,

I'm trying to set up a passive check in NCPA that calls a plugin. The plugin works if I su to nagios and execute it. It also works from the browser when passing the two required arguments:

Code: Select all

https://x.x.x.x:5693/api/plugins/check_proc_uptime.sh/java/5/?token=mytoken
What I can't figure out is the syntax to pass arguments from the NCPA configuration file (java and 5 in this case).

Code: Select all

[passive checks]

%HOSTNAME%|__HOST__ = system/agent_version
%HOSTNAME%|Process Check = plugins/check_proc_uptime.sh java 5
Note, if I modify the script and don't try to pass arguments to it everything works. :|
Thanks!

Re: How to pass arguments to plugin via NCPA config file?

Posted: Mon Oct 02, 2017 10:06 am
by kyang
A good document on passing arguments via NCPA passive checks will be posted.
https://www.nagios.org/ncpa/help/2.0/passive.html

It seems like this is a good example from the documentation. Using a plugin to pass arguments. So depending on the args you want to pass with the check_proc_uptime plugin.
The / to separate arguments.

Code: Select all

server1.local|CPU Usage = plugins/check_cpu/-H server1.local/-w 60/-c 80
server2.local|CPU Usage = plugins/check_cpu/-H server2.local/-w 60/-c 80
%HOSTNAME%|CPU Usage = cpu/percent --warning 60 --critical 80 --aggregate avg
Let us know if this helps!