Say I built 1000 servers from the same OS Image, everything is the same including SNMP configs (They all have unique IP addresses of course). For each server, I want to monitor the same 12 services, all via SNMP, using Nagios.
In the Nagios config, is there a way to configure each server such that I don't have to repeat the 12 service entries in every single host file?
Something like:
Host MyHost {
ServiceGroup 12Monkeys;
}
Better yet, is there a way to say "for these 1000 servers, monitor these 12 services"?
Servicegroup 12Monkeys {
Servers: 192.168.0.0/24;
}
Thanks!
For the services, list a hostgroup_name rather than host_name. Then place each host into the appropriate hostgroup definition.
You can also add exceptions if desired. For example on a service you can list a hostgroup_name and then host_name !server1 to exclude server1 from that service check despite being in the hostgroup.
Documentation on Host Groups is at http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#hostgroup
The pointers to use hostgroups and servicegroups are good. If you have a giant datacenter you presumably you have some sort of configuration management / server inventory system. I would also focus on automatically generating the appropriate Nagios configurations for these services from that system.
Here's a list of some handy tricks using Nagios templates, including monitoring the same services on multiple hosts.
http://nagios.sourceforge.net/docs/3_0/objecttricks.html#service