Configuration

Configuration of Nagios is done through flat-text files, so adding devices or changing the configuration of existing parameters can become a tedious task. On top of the time it takes, if you make one mistake, Nagios could more than likely fail to start altogether. Therefore, it’s very important that you are careful when modifying your configuration files and that you make backups after each successful change. Believe me; you don’t want to rush through it.

The configuration of the Nagios daemon is separated into three major parts. There is the main configuration file (usually named nagios.cfg), which dictates how Nagios should operate overall. Next is the Resource File(s), which is referred to inside the main configuration file that contains user-defined macros. Macros will be covered later on; however, it’s important to know that you should be storing sensitive configuration information (such as database connection parameters) in these files. Lastly, object definition files provide Nagios with a description of what you have in your infrastructure and how to monitor it. These files contain the potential for quite a lot of directives. We will only go over what is needed to get you up and running with minimal setup. Once you are comfortable and understand this configuration, you should refer to Nagios’s documentation to see the full list of directives available to you. By using additional directives, you can have more granular control over how Nagios operates.

Before ...

Get Network Monitoring with Nagios 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.