Page 1 of 1

NCPA Plugin process filtering with regualr expressions

Posted: Wed Jun 20, 2018 8:45 am
by nagiosEngie
Hello Nagios Crew,

Is it possible to search for processes (with NCPA plugin) on linux server using regular expressions like:
.*svr worker.*PIPPO_PLUTO.*
EX:
./check_ncpa.py -H 10.211.145.47 -t 'TOKEN' -P 5693 -M 'processes' -q 'cmd=.*svr worker.*PIPPO_PLUTO.*'

The processes I am trying to capture have commas in the name, so I cannot use the "cmd=" option (which expects the whole command Line launched by the process) because in html commas are special characters so when the script generates the URL for the API request I will get an error.
The only option I can come up with is to use regular expressions.

Can you please help?

Thanks
Sandro

Re: NCPA Plugin process filtering with regualr expressions

Posted: Wed Jun 20, 2018 1:05 pm
by scottwilkerson
At least in the current version you can, not sure when it was added
try

Code: Select all

./check_ncpa.py -H 10.211.145.47 -t 'TOKEN' -P 5693 -M 'processes' -q 'cmd=.*svr worker.*PIPPO_PLUTO.*,match=regex'

Re: NCPA Plugin process filtering with regualr expressions

Posted: Thu Jun 21, 2018 5:06 am
by nagiosEngie
Hi,
works like a beauty.
Thanks
Sandro

Re: NCPA Plugin process filtering with regualr expressions

Posted: Thu Jun 21, 2018 8:11 am
by scottwilkerson
Great!

Locking thread