I have decided to write a four part article on the benefits of using Nagios. The first article focused on why I chose Nagios/what it offers. The second article focused on installing Nagios on Mac OS X. This third article will focuses on configuring Nagios. The fourth article will focus on improving the Nagios interface and further customizing it.
Configuring Nagios…let the fun begin! With version 1.2 of Nagios, there are multiple files by default located in
- cgi.cfg This file is used to define the settings for the nagios’ CGIs. All of your basic CGI paths, authentication, commands are in this file. cgi.cfg help more cgi.cfg help
- checkcommands.cfg This file is used to define some basic commands you can use to check your systems with such as “check smtp”, “check ftp”,etc.
- contactgroups.cfg This file is used to define information about contact groups. Ex. If you have multiple admins for your network (network admin, web admin, database admin, you can define which admins are in certain groups. (Nice to set up so that the web admins are not notified when the file server goes down, and the network admins are not notified when the web servers go down – assuming the network admin has no responsibility for the web servers)
- contacts.cfg This file is used to define the contact information for the admins that need to be contacted if/when their servers go down. You can define pager numbers/email addresses/IM accounts, etc in this file.
- dependencies.cfg This file is used to define information on your network’s dependencies. You can define things in a way so that nagios knows that your web server’s availability is dependent on your database server, and your database server is dependent on your local router, and your local router is dependent on your ISP’s router, etc. You can define both host dependencies and service dependencies here.
- escalations.cfg This file is used to define information on escalating the known problem to other people/groups. This is handy if you have multiple tiers of IT staff, or if you have a small IT staff and want to make sure someone is notified of the problem. (Ex. Network admin is notified the mail server is down, but does not do anything in x minutes. After x minutes, a page, email, IM, etc can then go to someone else or another group of people.escalations.cfg help
- hostgroups.cfg This file is used to define all the host groups. Ex. You can group all of your database servers, web servers, printers, network equipment, etc.
- hosts.cfg This file is used to define all your hosts that you want to monitor. Each host will have an entry with the IP, host name, etc.
- misccommands.cfg This file is used to define all the commands that will notify the admins (notify by pager, email, et).
- nagios.cfg This file is used to define the main configuration information. nagios.cfg help
- services.cfg This file is used to define the actual servers and services you want to monitor. If you monitor several services (http, smtp, smb, etc) on one host, each service will have a listing.
- timeperiods.cfg This file is used to define timeperiods. You can have varying time periods for different services/hosts. Ex. You can set up a “24×7” time period for all your high availability servers, but use a “work hours” time periods for monitoring/reporting failures for something like your printers.
- **I also added icons and clickable URLs in another config file called: hostextinfo.cfg
All these files…but what do I do with them? How about some working examples of the cfg files that were changed!