Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

nagios_commander

Current Version
1.0
Last Release Date
2012-10-06
Compatible With
  • Nagios 3.x
License
Apache
Hits
65990
Files:
FileDescription
global_notifications_query.pngglobal_notifications_query.png
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
A simple bash wrapper for the largely undocumented Nagios API which can access all common front-end operations.
The little known Nagios front-end API, which can be accessed via curl, is actually quite powerful if only it were more accessible. This project aims to wrap this functionality around a simple command line interface to query and command a Nagios instance as one would using the GUI. Nearly all basic functions of Nagios are working out of the box. Please comment and report bugs here or at github as they arise (and they always do ;).

Biggest thanks to my employer, Big Fish Games Inc., for allowing me to open source this project having learned everything I now know about Nagios at the time of this release.

The help dialog shown below should suffice until a more detailed doc on usage surfaces:

-n | --nag-host
nagios HOSTNAME followed by its nagios directory
-u | --username
USER to execute commands
-p | --password
PASSWORD of the executing user
-q | --query
QUERY a nagios or device in nagios
list (object or group object required)
host_downtime
service_downtime
notifications (global)
event_handlers (global)
active_svc_checks (global)
passive_svc_checks (global)
active_host_checks (global)
passive_host_checks (global)
-c | --command
COMMAND to issue in the form --command [action] [scope] [value]
action: set
del
ack
scope: (required for all but ack)
downtime
notifications
event_handlers
active_svc_checks
passive_svc_checks
active_host_checks
passive_host_checks
value: (only required for global commands)
enable
disable
-Q | --quiet
Flag for QUICK execution and QUIET output
-h | --host
HOST to execute the METHOD against. Leave blank to query all hosts.
-H | --hostgroup
HOSTGROUP to execute the METHOD against. -H followed by nothing for listing all.
-s | --service_name
SERVICE as execution object.
-S | --servicegroup
SERVICEGROUP an execution object. Follow with nothing to list all.
-t | --time
TIME in minutes to place on a downtime window, beginning now
-C
COMMENT (required by set downtime, ack)
-*
print this help dialog

Usage: nagios_commander.sh -n -c -h -H -s -S -t -c
Examples:
./nagios_commander.sh -n nagios.sea.bigfishgames.com/nagios -c set downtime -h cfengine01.sea -s PROC_CFAGENT_QUIET -t 1 -C 'downtime comment' -Q
./nagios_commander.sh -n nagios.sea.bigfishgames.com/nagios -q list -h -u -p
./nagios_commander.sh -n nagios.sea.bigfishgames.com/nagios -q host_downtime -u -p
Reviews (1)
byestebanmonge, October 29, 2012
How can you use https?
Owner's reply

Someone on github wanted this same feature and added it accordingly. It's now been merged into the mainline branch. Thanks for the suggestion!