Running a service on all hosts on a group

In this recipe, we'll create a new service but, instead of applying it to an existing host, we'll apply it to an existing hostgroup; in this case, to a hostgroup called webservers. The steps to do this are very similar to adding a service for just one host; only one directive is different.

Getting ready

You should have a working Nagios Core 4.0 or better server running with a web interface. You should be familiar with adding services to individual hosts.

You should also have at least one hostgroup defined, with at least one host in it; we'll use a group called webservers with the sparta.example.net and athens.example.net hosts defined in it.

For reference, here is the hostgroup definition and the definitions ...

Get Nagios Core Administration Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.