Disable Nagios alerts for a hostgroup

To disable Nagios alerts for a hostgroup, You need login to 
nagios server and make changes in your Nagios configuration.
Basically, you'll need to modify the hostgroup definition.
Below are the setps needed to disable alerts for a hostgroup.

Step1: Login to your Nagios server using SSH:

Log in to the Nagios Server using SSH with user having
administrative privileges.

Now go and locate the Nagios configuration files. It is located
mostly at "/etc/nagios or /usr/local/nagios/etc directory".
But can be changed as per organization. The main configuration
file is typically called nagios.cfg, and hostgroup definitions
are stored in hostsgroups.cfg.


Step2: Edit the hostgroup definition in required file.

Before making any changes, it's important to take backup of
the configuration files so that you have original files in
case of any data loss or misconfiguration.
# cp /path/to/hostsgroups.cfg /path/to/hostsgroups.cfg.backup
Now go and open the file at available location and locate 
hostgroup configuration.
# vi /path/to/hostsgroups.cfg

define hostgroup {
    hostgroup_name   Testing_hostgroup_name
    alias            Some Alias
    members          host1, host2
}
To disable notifications for the specified hostgroup, you need 
to add following line inside the define hostgroup block:

notifications_enabled 0

After adding the line, the hostgroup definition should look
like this:
define hostgroup {
    hostgroup_name   Testing_hostgroup_name
    alias            Some Alias
    members          host1, host2
    notifications_enabled  0
}
Save the changes and exit.

Step3: Verify your nagios configuration.

After making changes, it's important to verify the
configuration files for any syntax errors. Please do
the following:
# nagios -v /path/to/nagios.cfg
Step4: If there are no errors, restart Nagios to apply the 
changes:
# systemctl restart nagios
Now alerts for above hostgroup is disabled.

Leave a Reply

Your email address will not be published. Required fields are marked *