NSClient++ Help (#1) - NRPE checkProcState REGEX (#139) - Message List
NSClient++ version: 0.3.1.12
OS: Windows XP SP2
MickeM,
I have searched these boards and the documentation on CheckProcState (http://trac.nakednuns.org/nscp/wiki/CheckProcState) and I am still unclear on how to use regex's in my NRPE commands.
For example, I have two processes with different names but similar prefix running on a given box; ie. Inbound.exe, Inbound_862.exe
Instead of creating two seperate Nagios service object definitions, I would like to cover both with one (I assume I will also need to include MinCritCount?=2 in this case).
I have tried sending queries via check_nrpe Nagios plugin on our Linux monitoring box, as well as using NSClient++ in /test mode. Nothing seems to be working...
ie. Using notepad.exe as the test via Nagios Plugin -
./check_nrpe -H 10.1.3.94 -p 5666 -c checkProcState -a match=regexp ShowAll .*pad.exe=started
Also, from NSC.ini (I assume this is relevant):
;# COMMAND ALLOW NASTY META CHARS ; This option determines whether or not the NRPE daemon will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments. allow_nasty_meta_chars=1
Could you please provide a quick example of how I can accomplish this?
Thanks in advance for the help, and thanks for keeping this package alive!
-Mark
-
Message #374
I updated NSClient++ to the latest nightly (Win32-20080403-2026), still with no success. I've dried different variations of the command to try to get it to work, but it seems the regular expression isn't being treated as such. Any wildcards seem to be treated as literal characters.
Here is the one of the plugin commands I've tried for checking if notepad.exe process is running, followed by the plugin output.
./check_nt -H 10.1.3.94 -p 12489 -s dwajaja -v PROCSTATE -l match=regexp,.*pad\.exe=started match: not running - .*pad.exe: not running
I'm sure there's probably a problem with my syntax, so any help would be greatly appreciated.
big-byrd05/06/08 22:00:45 (5 years ago)-
Message #380
humm... notice you have to "escape" all "strange chars" on unix for them to get through, but apart from that it looks correct.
check_nt ... -v PROCSTATE -l 'cmdLine,match=regexp,.*pad\.exe*' -d SHOWALL
so it ought to be "correct", if not let me know and I shall investigate further.
MickeM
mickem05/08/08 11:42:40 (5 years ago)-
Message #392
MickeM,
The above command doesn't work either. It treats each string delimited by ',' after the -l parameter as a unique (and literal) process name.
Same goes for check_nrpe.
I've also tried a bunch of different variations of this, no change. Result shows "cmdLine: not running - match: not running - .*pad\.exe*: not running".
Maybe a different token is used / should be used to "link" or trigger 'match=regexp' such as a pipe, or even a new parameter which allows regular expressions to be used? I'm not yet totally sure if this related to the code for check_nt / check_nrpe on our linux box, or NSClient++ / modules - but I think a new flag would be a good idea if possible to avoid confusion. Just a thought...
I'll look through the code later today if I have time to see if I can find anything that will help us with this. Also, I wouldn't mind getting to know how NSCPP works.
Thanks man. -Mark
big-byrd05/09/08 15:58:30 (5 years ago)-
Message #395
humm, well... I generally don't recomend ppl. to use check_nt (check_nrpe is much better) so this is functionality from from the NRPE module that is "abused through check_nt" as it accidentally happends to work :)
So if you want a "specific flag" use nrpe and it is a specific flag (namely: ... match=regexp ...
check_nt is old, inconsistent and not expendable (nsclient++ supports it for compatibility so all new feature are nrpe-only).
But in regards to you problem, which version of nsclient++ do you use? (still IIRC the latest stable should have the support)
MickeM
anonymous05/10/08 09:40:27 (5 years ago)-
Message #398
I'm using v0.3.1.12 2008-03-11 on my desktop PC for testing, as well as the rest of our servers which have been updated with this newer version last week.
I have been trying to get this to work using BOTH check_nt and check_nrpe with no luck. I looked at the CheckSystem module code on Friday and found the 'match=regexp' "flag" in CheckSystem::checkProcState. I wasn't sure if the regexp matching was triggered on NSC++'s end or server-side. Now I understand.
Also, thanks for the heads up on check_nt - I wasn't aware of this.
Here is an example of an NRPE check for Firefox process with output:
[root@mkmonitor libexec]# ./check_nrpe -H 10.1.3.94 -p 5666 -c checkProcState -a ShowAll 'cmdline,match=regexp,firefox\.exe'
OK: cmdline,match: 0
The check still doesn't work, even if I enter the entire process name...
big-byrd05/12/08 17:50:06 (5 years ago)-
Message #400
[root@mkmonitor libexec]# ./check_nrpe -H 10.1.3.94 -p 5666 -c checkProcState -a ShowAll match=regexp firefox\.exe=running
Arguments are just used with spaces (much like arguments for other checkes) when you use NRPE... For the avalible options check the CheckProcState page.
And I shall look into this as soon as I have a stable build (tomorrow)
MickeM
anonymous05/13/08 07:10:11 (5 years ago) -
Message #408
The suggested command worked, however no luck when I threw wildcards into the command...
./check_nrpe -H 10.1.3.94 -p 5666 -c checkProcState -a ShowAll match=regexp .*fox\.exe=running
OK: match: 0, .*fox.exe: 0
I'll keep an eye out for the stable and let you know how it goes.
Thanks. -Mark
big-byrd05/13/08 16:40:51 (5 years ago)-
Message #410
humm, this is really strange the "match: 0" means it does not "accept" the reg exp option. Are you sure you have the latest version? (let me check this when I get home, maybe I have missed something)
MickeM
mickem05/14/08 09:38:25 (5 years ago)-
Message #414
I finally managed to get it working.
The example you gave me wasn't working (I believe) due to the fact that when I was trying to get the command to work before opening this thread, I copied over the NSClient++ binary only.
I uninstalled the service, copied the binary and modules from the latest nightly build, reinstalled, and it's working now. Stupid move on my part.
Sorry for the inconvenience and thanks again with the help with the command.
However, my other question would still be - How do I use MinCritCount? without it being treated as another process name because of the "match=regexp"?
big-byrd05/14/08 21:10:39 (5 years ago)-
Message #417
Good... and humm, should just be to append the option after a space... like so:
-c checkProcState -a ShowAll match=regexp .*fox\.exe=running MinCritCount=3
MickeM
mickem05/14/08 22:56:44 (5 years ago)-
Message #419
-c checkProcState -a ShowAll match=regexp .*fox\.exe=running MinCritCount?=3
OK: firefox.exe: 1
This SHOULD be returning critical state, no?
big-byrd05/14/08 23:04:38 (5 years ago)-
Message #420
one might think so :)
This is actually a minor bug:
checkProcState MinCritCount=3 ShowAll match=regexp .*fox\.exe=running d \nsclient++.cpp(516) Injecting: checkProcState: MinCritCount=3, ShowAll, match=regexp, .*fox\.exe=running d \nsclient++.cpp(536) Injected Result: CRITICAL 'CRITICAL: match: 0 < critical, .*fox\.exe: 0 < critical' d \nsclient++.cpp(537) Injected Performance Result: ''match'=0;0;3; '.*fox\.exe'=0;0;3; ' CRITICAL:CRITICAL: match: 0 < critical, .*fox\.exe: 0 < critical|'match'=0;0;3; '.*fox\.exe'=0;0;3;
note the order the count is the first arg then it works....
it should not matter feel free to report this as a bug and it will be fixed...
Mickem
mickem05/14/08 23:16:30 (5 years ago)-
Message #421
Ah, gotcha!
I'll report it shortly.
Thanks for all of your help and for maintaining this app. Definitely has much potential and is in my opinion the best one I've used so far. :)
Cheers. -Mark
big-byrd05/14/08 23:32:15 (5 years ago)-
Message #423
Since 0.3.2 stable update, regexp doesn't seem to be working at all...
big-byrd05/22/08 17:35:54 (5 years ago) -
Message #424
plugin output from 0.3.2.9 agent:
[root@mkmonitor libexec]# ./check_nrpe -H 10.1.3.2 -p 5666 -c checkProcState -a match=regexp ShowAll .*vnc.* CRITICAL: .*vnc.*: stopped (critical) [root@mkmonitor libexec]# ./check_nrpe -H 10.1.3.2 -p 5666 -c checkProcState -a match=regexp ShowAll .*vnc.*=running OK: .*vnc.*: 0
big-byrd05/22/08 19:56:03 (5 years ago)
-
-
-
-
-
-
-
-
-
-
-
-








