Page 1 of 2

Send custom msg to NSClient from AnyApp.exe running on host

Posted: Thu Jan 08, 2015 8:39 am
by nagwindmon
Dear Experts,
NSClient++ agent has been installed on host servers and basic monitoring now in place for CPU, Memory usage, Uptime and etc...

Now I was ask by our app teams if its possible for Agent to accept error/status messages from their apps and issue Alert/Notification just like it does with all other metrics listed above?

Thank you!

Re: Send custom msg to NSClient from AnyApp.exe running on h

Posted: Thu Jan 08, 2015 12:19 pm
by tmcdonald
You can run external scripts in NSClient, yes:

http://www.nsclient.org/nscp/wiki/CheckExternalScripts

Re: Send custom msg to NSClient from AnyApp.exe running on h

Posted: Thu Jan 08, 2015 4:39 pm
by nagwindmon
thank you tmcdonald,
Im all new to it, still trying to get my head around this logic so how script command will communicate back to Agent?
any sample scripts any one? and how that script file will get executed, by placing it in C:\Program Files\NSClient++\scripts and restart the agent?

Re: Send custom msg to NSClient from AnyApp.exe running on h

Posted: Thu Jan 08, 2015 6:51 pm
by Box293
nagwindmon wrote:how that script file will get executed, by placing it in C:\Program Files\NSClient++\scripts and restart the agent?
Yes, place the file in that directory.

What version of NSClient++ are you using? There are differences in the ini file between version 0.3.x and 0.4.x.


I need you to clarify a bit more exactly what you are wanting to do.

Do you want your program (not NSClient++) to submit errors/status messages back to Nagios and let Nagios handle all the notification mechanisms?

Re: Send custom msg to NSClient from AnyApp.exe running on h

Posted: Fri Jan 09, 2015 3:09 pm
by nagwindmon
NSClient++ version: NSCP-0.4.1.105-x64.msi

Here is what Im looking for to accomplish utilizing Nagios Agent:
monitor main Application running on Win 7 Server, so first thing I need is to check on it if its up and running?

then I was told that App creates a Log file where would be a records of any issues/errors or success, so not sure if I can make them (app team) to send out those values out for Agent to picked up and act on or have Agent read that Log file and based on it results communicate back to Nagios Server and let Nagios handle all the notification/alerts as needed?

Appreciate all help, ideas given!

Re: Send custom msg to NSClient from AnyApp.exe running on h

Posted: Fri Jan 09, 2015 4:10 pm
by sreinhardt
nsclient has internal handlers for checking if a particular process name is running. Those commands should be aliased in by default. Depending on what you are looking for with logging, there is some internal log handling although often a powershell or vbs script might be better.

http://exchange.nagios.org/index.php?op ... heck%20log - some of these are not intended for windows.

Re: Send custom msg to NSClient from AnyApp.exe running on h

Posted: Thu Feb 05, 2015 2:34 pm
by nagwindmon
I was working on setting up and deploying Nagios Agent to all of our Win machines about 3K, now all that done, Im back to my original question:

I want my program (not NSClient++) to submit errors/status messages thru NSClient++ back to Nagios and let Nagios handle all the notification mechanisms.
NagiosSetUp.docx
thank you!

Re: Send custom msg to NSClient from AnyApp.exe running on h

Posted: Thu Feb 05, 2015 3:09 pm
by tgriep
I found a link on NSClient's site that has an example of running an application that is wrapped in a Powershell script.
https://www.nsclient.org/forums/topic/old-870/
Would that work for you?

Re: Send custom msg to NSClient from AnyApp.exe running on h

Posted: Fri Feb 06, 2015 8:52 am
by nagwindmon
not quiet, in that case NSClient Agent executing an .exe
What I'm looking for is to find a way how to enable an Application running on a Windows machines to send events to a NSClient Agent running on the same machine.

Re: Send custom msg to NSClient from AnyApp.exe running on h

Posted: Fri Feb 06, 2015 11:17 am
by tgriep
I don't think the NSClient works that way, it doesn't receive events from the windows machine, it retrieves them for the Nagios server.
If your application can write to a log file, you could use the check_logfile for your testing or if your application can work with a Powershell script, then it could do what you want.