Page 1 of 4

do not enough $ARG$ for my service

Posted: Sun Jul 18, 2021 10:42 pm
by sacom01
hi team,
I have a plugin with check 4 parameter : cpu, vms, io_read, io_write. Every parameter need check have -w and -c, so we have 8 arguments (4 -w and 4 -c)
When we check the service for client svr using ncpa, it will have 10 arguments : 4 -w and 4 -c and port and token.
But we have only 8 $ARGS like picture.

is there any way for this case? Now i have to hard code for fix 4 -w and 4 -c inside my code but it's very inconvenience.

Thank you.

Re: do not enough $ARG$ for my service

Posted: Mon Jul 19, 2021 10:39 am
by benjaminsmith
Hi,

I can submit a feature request for this if you'd like. The recommended workaround to the limitiation of 8 arguments in the interface is to combine multiple arguments into one argument field.

If you need any assistance, please post the full check command, and we'll review the arguments.

Thanks,
Ben

Re: do not enough $ARG$ for my service

Posted: Tue Jul 20, 2021 8:45 pm
by sacom01
i tried fix -p port and -t token to the command but facing error.

Re: do not enough $ARG$ for my service

Posted: Wed Jul 21, 2021 11:26 am
by benjaminsmith
Hi,

That ought to work. Try wrapping the token in single quotes, 'mytoken', perhaps it's not getting passed over correctly.

I'm not familiar with the syntax on this plugin and was unable to locate it from Google but select the Run Check Command button, then cut and paste the command string into the CLI and get working from thee and then make adjustments in the CCM. There could be an error in the syntax.
test-check-command.png
If that's not working, please attach the plugin and I'll try to replicate it the best I can. Thanks, Benjamin

Re: do not enough $ARG$ for my service

Posted: Wed Jul 21, 2021 10:36 pm
by sacom01
i can not see your attach, pls share it again.
i tried fix -t 'token' but no luck, not work

Re: do not enough $ARG$ for my service

Posted: Thu Jul 22, 2021 11:24 am
by benjaminsmith
Hi,

Okay, not sure why you are not able to view that attachment. I checked your account and it looks correct. Please follow the step in the article below to retrieve the full check command and post it to the ticket. Thanks,Benjamin

Nagios XI - How To Test Check Commands From The Command-line

Re: do not enough $ARG$ for my service

Posted: Thu Jul 22, 2021 9:16 pm
by sacom01
hi ben,
i sent you my plugin, pls check your ib and help me review it.
thanks.

Re: do not enough $ARG$ for my service

Posted: Fri Jul 23, 2021 2:47 pm
by benjaminsmith
Hi,

Got the plugin and I was able to get this going. After putting the plugin in the NCPA plugin directory, I ran the NCPA wizard.
ccm-command-setup.png
As you can see, it's only using one argument, but you could configure it differently. Here's the full check command.

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -H 192.168.23.140  -P 5693 -t 'mytoken' -P 5693  -M 'plugins/unix_check_OSprocess.py' -q 'args=-wC 1 -cC 2  -wR 10 -cR 20 -wW 10 -cW 20 -wV 150 -cV 200'
NCPA uses python version 2 so its necessary to install python3 to run this. Then be sure to add python 3 to the npca.cfg file.

/usr/local/ncpa/etc/ncpa.cfg

Code: Select all

.py = python3 $plugin_name $plugin_args
More details on this in the thread below.
https://support.nagios.com/forum/viewto ... 16&t=61959

Let me know if you get it working. If you haven't done so already, it also will require installing python3 and psutil on the remote server.

--Benjamin

Re: do not enough $ARG$ for my service

Posted: Wed Jul 28, 2021 3:45 am
by sacom01
i did it, but now i have another problem with this plugin.
when i run the command on client server, it show many alerts, but when run with ncpa from nagios xi, it show only one alert (itself process)
plugin permission was 755 already
-rwxr-xr-x 1 root root 5237 Jul 28 14:56 unix_check_OSprocess.py

Re: do not enough $ARG$ for my service

Posted: Wed Jul 28, 2021 9:57 am
by benjaminsmith
HI sacom01,

For testing purposes, can you adjust the thresholds so you definitely are returning more than one line?

It could be changing states between running it locally and from XI.

I'm able to view more than one line of output in the XI interface.
xi-output.png
NCPA GUI
ncpa-output.png
Let me know what you find out. Also, what version of NCPA are you using, if it's really old it may not handle multi-line output. Post the output of the command below. Thanks, Benjamin

Code: Select all

curl -k -L -vvv 'https://<IP address>:5693/api/system/agent_version/?token=<token>&check=1'