Possible to run a Service Check Manually?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
mmartin
Posts: 45
Joined: Fri Jul 15, 2011 12:45 pm

Possible to run a Service Check Manually?

Post by mmartin »

Hello All,

I was wondering if it's possible to have a service check run manually, and I don't mean manually from the Web GUI...?
For example, is there a command that can be run from the command line that would run/schedule a service check to run?

Or possibly, now that I think about it, send whatever kind of HTML GET/POST request that Nagios does to schedule a command to run? Just a though...
I might try and watch what happens when I schedule a check to run in the GUI, through WireShark.

Any thoughts would be great!

Thanks in Advance,
Matt
yancy
Posts: 523
Joined: Thu Oct 06, 2011 10:12 am

Re: Possible to run a Service Check Manually?

Post by yancy »

mmartin,

most service checks run from the command line which Nagios schedules. Can you be more specific about what service check your wondering about.

Nagios can receive check data using NRDP using GET/POST requests. Beyond that, I'm not sure where else HTML GET/POST would be utilized...


Regards,

-Yancy
mmartin
Posts: 45
Joined: Fri Jul 15, 2011 12:45 pm

Re: Possible to run a Service Check Manually?

Post by mmartin »

Hey Yancy, thanks for the reply!

Sorry, I should have posted back when I realized this... I FINALLY remembered about Nagios' Plugin for NSCA.
This will do exactly what i wanted to do. So instead of letting Nagios do "active" checks for this service, I will have NSCA
send a "passive" check to Nagios when the event occurs on the specific host...
Thanks Again for your reply!!!

I had another question about something if you know anything about it... Or I might have to open another thread?
Is there anyway to customize the notification emails that Nagios sends?

I wanted to see if there was a way I can add-to/change like the Subject or Body, or something like that... Is that possible?

Thanks in Advance,
Matt
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Possible to run a Service Check Manually?

Post by mguthrie »

Yes, you can modify the notification command. Wherever your command definitions are located, you should have some commands defined such as "notify-host-by-email", that you can use to modify the format of your notifications.
mmartin
Posts: 45
Joined: Fri Jul 15, 2011 12:45 pm

Re: Possible to run a Service Check Manually?

Post by mmartin »

Hey mgutherie, thanks or the reply!

Yea, I just found that right after I posted... Thanks for the info.
I had found the "notification commands" in the "commands.cfg" Config File.

I think this is the one I need to modify:

Code: Select all

# 'notify-by-email' command definition
define command{
	command_name	notify-by-email
	command_line	/usr/bin/printf "%b" "***** Nagios 2.10 *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}

Thanks AGAIN for all your replies, this should do it!

Thanks Again,
Matt
Locked