mickem / nscp

NSClient++
http://nsclient.org
GNU General Public License v2.0
239 stars 93 forks source link

Unable to check status of an individual windows process using check_process command in JSON interface #200

Open colinsauze opened 8 years ago

colinsauze commented 8 years ago

When I try to use the check_process on on NSClient in JSON/web server mode I can get the list of running processes by giving it no parameters. However, the documentation says I can specify the name of a single process with the "process" option. When I do this from the web interface (https://myserver:8443/queries.html) and I try to query a windows process by its full name (e.g. chrome.exe) I get the error:

Invalid command line: unrecognised option 'exe'

I've tried without the .exe and it finds no processes. I've also tried the HTML escape character ., a leading \ and putting the whole thing in quotes but these all give errors too. I presume that on Linux/Unix hosts this won't be a problem as you don't normally get dots in the filename, but on a Windows host it is a problem.

colinsauze commented 8 years ago

Just found that this is only a problem via the actual browser based web interface, running a query from a command line script that interfaces to Nagios works.

mickem commented 8 years ago

This does not work you mean?

image

colinsauze commented 8 years ago

Yes it does, i'd not tried that method, I'd tried:

check_process process="nscp.exe"

check_process process=nscp.exe

and

check_process process=nscp.exe

and all of these fail. Perhaps some notes in the help explaining the correct syntax would have helped.

mickem commented 8 years ago

Ahh... yes, I do pretty lame parsing on the command line there, it is similar to how "nscp test" works so no proper parsing of escape codes just a "does it start with " kinda deal...

If you use the rest API though it will be parsed properly as you send arguments individually there...

I'll keep this as a bug for fixing the parsing to be more "sane"...