30-07-2013 | Remy van Elst | Text only version of this article
This tutorial shows you how to hide all hosts from a hostgroup in Nagios, including the webinterface and email/sms notifications. It does however monitors and checks all the hosts in the hostgroup, so when there are problems you can view the hosts in Nagios. This is usefull for example when you have a staging, preproduction and production environment monitored by the same Nagios host, or by a Nagios cluster, and want to hide all of staging, but do want to quickly view the status when developers complain about a node.
First you needble all notifications for the hostgroup of choice, in my case "staging". Navigate in the Web interface to the Hostgroup Overview, Click on the second hostgroup link (like: staging (staging) ) and then select "Disable notifications for all services in this hostgroup". On the next page, select the checkbox "Disable for hosts too" and click Commit. You could also go to the following url, replacing the values for your environment:
Now navigate to the following page, again replacing the values for your environment:
http(s)://<nagios-url.tld>/<cgi-folder>/status.cgi?host=all&type=detail&servicestatustypes=28&serviceprops=8202. This will open the view for the Service Status, with the properties
Not In Scheduled Downtime & Has Not Been Acknowledged & Notifications Enabled. There are all your notifications, but not from the "hidden" hostgroup.
You can also change the HTML files (index.html or side.html) to either change the frame to go directly to this page, or add a link in the menu to this page.
You can fiddle with the Nagios URL properties, below are the values you can use, which you can also find in the Nagios Source Code, in
/****************** HOST AND SERVICE FILTER PROPERTIES *******************/ #define HOST_SCHEDULED_DOWNTIME 1 #define HOST_NO_SCHEDULED_DOWNTIME 2 #define HOST_STATE_ACKNOWLEDGED 4 #define HOST_STATE_UNACKNOWLEDGED 8 #define HOST_CHECKS_DISABLED 16 #define HOST_CHECKS_ENABLED 32 #define HOST_EVENT_HANDLER_DISABLED 64 #define HOST_EVENT_HANDLER_ENABLED 128 #define HOST_FLAP_DETECTION_DISABLED 256 #define HOST_FLAP_DETECTION_ENABLED 512 #define HOST_IS_FLAPPING 1024 #define HOST_IS_NOT_FLAPPING 2048 #define HOST_NOTIFICATIONS_DISABLED 4096 #define HOST_NOTIFICATIONS_ENABLED 8192 #define HOST_PASSIVE_CHECKS_DISABLED 16384 #define HOST_PASSIVE_CHECKS_ENABLED 32768 #define HOST_PASSIVE_CHECK 65536 #define HOST_ACTIVE_CHECK 131072 #define SERVICE_SCHEDULED_DOWNTIME 1 #define SERVICE_NO_SCHEDULED_DOWNTIME 2 #define SERVICE_STATE_ACKNOWLEDGED 4 #define SERVICE_STATE_UNACKNOWLEDGED 8 #define SERVICE_CHECKS_DISABLED 16 #define SERVICE_CHECKS_ENABLED 32 #define SERVICE_EVENT_HANDLER_DISABLED 64 #define SERVICE_EVENT_HANDLER_ENABLED 128 #define SERVICE_FLAP_DETECTION_ENABLED 256 #define SERVICE_FLAP_DETECTION_DISABLED 512 #define SERVICE_IS_FLAPPING 1024 #define SERVICE_IS_NOT_FLAPPING 2048 #define SERVICE_NOTIFICATIONS_DISABLED 4096 #define SERVICE_NOTIFICATIONS_ENABLED 8192 #define SERVICE_PASSIVE_CHECKS_DISABLED 16384 #define SERVICE_PASSIVE_CHECKS_ENABLED 32768 #define SERVICE_PASSIVE_CHECK 65536 #define SERVICE_ACTIVE_CHECK 131072
In our example above we added the 8192 with 8 and 2 to get 8202, so we have selected