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

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
nagwindmon
Posts: 92
Joined: Mon Dec 01, 2014 3:39 pm

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

Post 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!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

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

Post by tmcdonald »

You can run external scripts in NSClient, yes:

http://www.nsclient.org/nscp/wiki/CheckExternalScripts
Former Nagios employee
nagwindmon
Posts: 92
Joined: Mon Dec 01, 2014 3:39 pm

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

Post 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?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

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

Post 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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
nagwindmon
Posts: 92
Joined: Mon Dec 01, 2014 3:39 pm

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

Post 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!
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

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

Post 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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
nagwindmon
Posts: 92
Joined: Mon Dec 01, 2014 3:39 pm

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

Post 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!
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

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

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
nagwindmon
Posts: 92
Joined: Mon Dec 01, 2014 3:39 pm

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

Post 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.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

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

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked