Find file
Fetching contributors…
Cannot retrieve contributors at this time
70 lines (50 sloc) 1.9 KB


The Nagios Shell (ngsh) provides a CLI interface to work with the Nagios daemon. It provides querying capabilities about the running configuration, as well a start/stop/restart/reload actions (currently slanted towards Solaris SMF). Its querying capabilities Mathias Kettner's excellent [MK Livestatus]( Nagios module.



ngsh [options] <action> [<arguments>]

where actions are one of:

* start: start Nagios daemon
* stop: stop Nagios daemon
* restart: restart Nagios daemon (full restart)
* reload|hup: reload Nagios configuration (w/out restart)
* status: outputs Nagios status acording to SMF
* pid: outputs pid of Nagios daemon
* reap: reaps Nagios Plugins defunct processes
* find: find hosts and/or services
* query: query attributes about a service (all hosts), host (all services) or service/host pair
* list: list hosts, services or servicegroups
* enable: enable notifications
* disable: disable notifications

and options include:

* -d: debug mode
* -n: dry-run mode
* -v: verbose mode
* -f pipe|row: query results output format


There is currently no configuration file for ngsh. Edit ngsh and ngsq to specify the location of the LQL socket.



root@nagios:~# ngsh status STATE STIME FMRI online 22:50:08 svc:/application/monitoring/nagios:default

Finding Hosts and/or Services

root@nagios:~# ngsh find snap service:service/snapbaby/client:daily service:service/snapbaby/client:hourly service:snapmirror


root@nagios:~# ngsh query filerstats;0;OK;1;0;OK;1;0;OK;1;0;OK;1

root@nagios:~# ngsh query service critical hadoop0;hadoop/worker;2