Americas

  • United States
sandra_henrystocker
Unix Dweeb

Unix tip: Monitoring networks with Nagios

Analysis
Dec 23, 20084 mins
Data CenterIT LeadershipOpen Source

Nagios, called NetSaint in its early versions, is a best of class, industry standard, open source (yes, free!) and fully extendable tool for monitoring networks. With surprising little effort, you can use it for basic system monitoring. You can also monitor individual services such as http, smtp, ssh, dns, pop3, ftp and others along with critical systems resources such as disk usage and processor load. With extra effort, you can monitor your databases and even the load on your routers. Nagios is a sophisticated tool for complex networks.

Some aspects of setting up and managing Nagios are relatively simple; others are intensely complex. But a good network monitoring system is worth the investment you have to make up front. Once set up, it can save you untold hours and lots of frustration.

Powerful and modular, Nagios provides the kind of control (including automatic restarting of services) you would expect to find in expensive network monitoring packages. One of the beauties of Nagios is that you can start with a modest configuration and slowly add to your network monitoring system.

Nagios is both powerful and modular. It also supports SNMP, so you can monitor nearly any type of modern routers and switches.

It’s quite easy to configure Nagios to monitor basic services. You have to define who receives alerts, what systems and services you want to monitor and how alerts will be delivered. You will set up some basic configuration files such as /etc/nagios/contacts.cfg for contacts, /etc/nagios/hostgroups.cfg to define groups of systems for various types of monitoring and services.cfg for services you will be monitoring.

Nagios provides commands such as “nagios -v /etc/nagios/nagios.cfg” to test your configuration file. Nagios allows you to specify how many times a service or host check will be retried before the service or host is declared down. This reduces the number of false alarms that will be generated.

Nagios is generally easy to install. On debian-based systems, it’s as easy as typing “apt-get install nagios-text”. Other varieties of Linux systems should be similarly easy. Solaris installations are more of a challenge, but Nagios has been compiled successfully by numerous people on Solaris 8, 9, and 10. I haven’t located any Solaris packages yet, but maybe some are in the works.

There are two ways to learn about Nagios. You can go to the http://www.nagios.org/ web site, download Nagios and try it out or you can buy a good text and gain the benefit of someone else’s thorough use of the tool. I suggest doing both.

I recommend Wolfgang Barth’s excellent “Nagios: System and Network Monitoring, 2nd Edition”. At more than 700 pages, it’s not a quick read, but it will teach you just about everything there is to know about the tool. With 26 chapters and 8 appendices, the book covers everything from preparing for an installation to writing your own plugins.

“Nagios: System and Network Monitoring” will teach you how to install and configure the system, configure the notification system, program event handlers, write plugins in Perl and make use of graphing and visualization tools. It will also show you how to monitor Windows servers, SAP systems and databases. The book highlights differences the between versions 2 and 3 of Nagios and provides extremely useful migration tips for anyone currently using Nagios version 2. There’s a whole chapter on monitoring Oracle with the Instant Client (which dramatically reduces the work you have to do).

The book provides important information on features new or enhanced in Nagios 3. You’ll find information, sometimes whole chapters on:

  • configuration and startup
  • service checks and plugins
  • resource testing (e.g., swap usage, processes)
  • running plugins with ssh
  • NRPE (the Nagios Remote Plugin Executor)
  • monitoring with SNMP
  • the notification system
  • passive tests
  • NSCA (the Nagio Service Check Acceptor)
  • distributed monitoring
  • the classical and flexible web interfaces
  • NagVis and graphical display of performance data
  • monitoring windows, room temperature and humidity
  • monitoring SAP systems
  • processing events with EventDB
  • writing your own plugins
  • monitoring file and folder sizes
  • monitoring oracle
  • Single-Sign on environments (Apache, Windows …)
  • changes in object definitions from 2
  • Nagios embedded Perl Interpreter
  • changes in the CGI interface
  • Rapidly alternating states (flapping)
  • performance optimization with a special setting for large installations

and more. This book will get novices off to a good start, but it’s invaluable for anyone who is migrating from Nagios 2 to 3 or enhancing their monitoring setup.

sandra_henrystocker
Unix Dweeb

Sandra Henry-Stocker has been administering Unix systems for more than 30 years. She describes herself as "USL" (Unix as a second language) but remembers enough English to write books and buy groceries. She lives in the mountains in Virginia where, when not working with or writing about Unix, she's chasing the bears away from her bird feeders.

The opinions expressed in this blog are those of Sandra Henry-Stocker and do not necessarily represent those of IDG Communications, Inc., its parent, subsidiary or affiliated companies.