ncom

Nagios command

usage: /usr/local/bin/ncom action service@host comment

where: service the name of the service we are checking

host Name of the host we are checking

commment Comment that we want to pass to the action

addcomment: Add a comment to a check for host, or service@host

Execution statement: ncom addcomment host/service@host "your quoted comment"

delcomment: Delete a comment to a check for host, or service@host

Execution statement: ncom delcomment host/service@host comment_id

status: Check current status for a particular host, or servie@host

Execution statement: ncom status host/service@host

check: Immediately recheck service, host, service@host (no state update on run)

Execution statement: ncom check host/service@host

reschedule: Reschedule service, host, service@host (state update on run)

Execution statement: ncom reschedule host/service@host "month-day-year hour:minute:second"

ack: Acknowledge current alert for service, host, service@host. A quoted comment must be present as last parameter.

Execution statement: ncom ack host/service@host "required quoted comment"

unack: Undo acknowledge for service, host, service@host.

Execution statement: ncom unack host/service@host

disablecheck(dc): Disable check for host, service@host

Execution statement: ncom dc host/service@host

enablecheck(ec): Enable check for host, service@host

Execution statement: ncom ec host/service@host

disablenotification(dn): Disable check for host, service@host

Execution statement: ncom dc host/service@host

enablenotification(en): Enable check for host, service@host

Execution statement: ncom ec host/service@host

checkhistory(ch): check history of particular check for host, or service@host

Execution statement: ncom ch ping@host/service@host [optional quoted date argument '2009-08-17' '2009-08-19']

notificationhistory(nh): check history of notificaitons for a host, or service@host

Execution statement: ncom nh ping@host/service@host

commandhistory(cmdh): check history of commands executed on particular check for host, or service@host

Execution statement: ncom cmdh ping@host/service@host

Requirements:

Nagios Version 3

Installation:

ndoutils ( Optional, only needed for checkhistory, alerthistory, commandhistory)

I will not go through the ndoUtils installation details. Here is a good link for NdoUtils installation guideline. http://www.monitoringexchange.org/cgi-bin/page.cgi?g=Detailed%2F1574.html;d=1

However I will suggest set data_processing_options to 33438717 in ndomod.cfg file, which gave me the best performance.

Nagios Object:

You can get Nagios-object module from the following link.

http://search.cpan.org/~duncs/Nagios-Object-0.21.8/lib/Nagios/Object.pm

ncom:

1)First we need to add the authentication information to the script.

a) untar using gzip -dc ncom -0.5.tar.gz | tar -xof -

b) cd into newly created directory and modify the following line of ncom file

my $dbhostname=''; ###this is the host where ndoutils database resides

my $database=''; ## name of the ndoUtils database

my $login_username=''; ###username for database

my $password=''; ###password for database.

2) Upon making the modification one can manually copy the file to /usr/bin or /usr/local/bin directory. I also added a spec file so one can create a rpm from this. However to use the spec file to create rpm, you must re-tar the directory using tar -czvf ncom -0.5.tar.gz ncom-0.5.

Hope this works out for you. Feel free to contact me if you have any issue with this.