Monitoring services

A service in nagios defines a particular test which should be run. At a minimum you need to define a name for the service and the command to run in order to monitor it.

Similar to hosts, it is defined within .cfg files in /etc/nagios3/conf.d or a subdirectory. At a technical level, there is no difference between a .cfg file that defines a host versus one that defines a service. They are split in Ubuntu's default configuration just for ease of management. If you wanted to, you could have a single flat .cfg that defines all hosts, services, and users.

How to do it…

Again I like to split my services into a subdirectory, so let's look at defining a service to monitor HP Jetdirect printers by creating /etc/nagios3/conf.d/services/printer.cfg ...

Get Linux Networking Cookbook 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.