14
Sat, Dec
4 New Articles

The Linux Letter: Cheap and Effective Network Monitoring

Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Back in "the day," it was sufficient to know that if your IBM midrange computer was running, your users would be able to access the programs required to do their jobs. Today, things are much different. With the advent of distributed network computing, it is much more difficult to know whether or not your users are or will be having trouble. If just one of the interconnected servers, switches, or other devices has a failure (and no redundancy has been implemented), then it's possible for a cascade failure to occur, bringing your users' productivity to zero.

Clearly, some kind of automated monitoring system is required to maintain maximum availability of your systems. While many such products are available, their cost can be prohibitive for smaller shops, thus relegating these shops to using the tried-and-true Organic Monitoring And Alerting System (OMAAS). Although OMAAS is an effective, no-cost feature of all network installations, I have always found the sound of the alarms produced by OMAAS to be overly strident and demanding, not to mention that OMAAS is wildly inaccurate as to urgency. What I wanted was a replacement for OMAAS that was highly configurable, so I could decide what truly constitutes a problem worthy of paging me in the middle of the night. What I found during my research for such a product is this month's jewel: Nagios.

Simple Monitoring Complicated

If you are like me, at some point in your career you have written a program to monitor a machine, a device, or the status of another program. While the concept can be quite simple ("Bones?" "It's dead, Jim."), the actual implementation of even the simplest monitor can get very complex.

Let's assume that you have been tasked with writing a program to monitor a critical server's availability. For a TCP/IP network, the first software tool that everyone "reaches for" to ensure the availability of a machine is ping, so you decide to use it as the basis for your program. A few lines of scripting later, you have a workable program that pings the target host and, depending upon the success or failure of the ping, either sends an email notification to you or sleeps for some time before testing again. Simple, right? Not so fast.... What percentage of the pings need to be answered for you to be satisfied that things are OK? 100%? 50%? 25%? Obviously, something is wrong if the majority of your packets are getting lost in the ether somewhere. And what happens if an intervening device, such as a router, fails? Your critical server isn't down, just unreachable, so what exactly are you going to report as failed? What if the machine status oscillates between available and unreachable? Are you going to send a notification each time it fails? And of course, a successful ping only denotes that the machine's TCP/IP stack is alive. It doesn't tell you that the Web, database, and SMTP server are alive.

I'm sure you get the point: Even simple monitoring can be complicated, which is why there has been a healthy market for commercial solutions. The open-source solutions aren't left wanting when compared with the commercial ones, however.

It Will Undoubtedly Work for You, Too

While surfing the 'net in my quest to automate my network monitoring, I found myself at the home of Nagios. The description I found there seemed to cover all of the bases:

Nagios is a host and service monitor designed to inform you of network problems before your clients, end-users or managers do. It has been designed to run under the Linux operating system, but works fine under most *NIX variants as well. The monitoring daemon runs intermittent checks on hosts and services you specify using external "plugins" which return status information to Nagios. When problems are encountered, the daemon can send notifications out to administrative contacts in a variety of different ways (email, instant message, SMS, etc.). Current status information, historical logs, and reports can all be accessed via a web browser.

This paragraph pretty well describes the majority of the monitoring software available, either commercial or open source.

Most of us tend to buy things that are popular. We ask around and find out what make and model of vehicles our friends are neighbors are purchasing before buying one ourselves. We also tend to do the same with software purchases, soliciting opinions from our peers before making an acquisition. It's no secret that products with the most marketing clout tend to be acquired more often than lesser-known products, regardless of their quality. (This seems to be particularly true in the software world.) Knowing that I'm as guilty as the next person in this regard, I consciously try to do better research before committing to a product. Thus, when I was turned on to Nagios by the buzz I found in various mailing lists about the product, I thoroughly scanned the Nagios Web site. The information I found there gave me that warm, fuzzy feeling that I was on to something good.

To start with, Nagios has a " link that shows a summary of the places that Nagios is discussed, including conferences, books, and Linux distributions. The list of conference presentations was particularly impressive, as it shows the scope of Nagios' worldwide distribution.

Of greater interest to me was the user profile statistics link, which gives a summary of the users who have taken the time to register their implementations with the Nagios project. At the time of this writing, 954 registered users are running Nagios on 11,580 monitoring hosts. These monitoring hosts are standing watch over 190,761 hosts and the 697,408 services running on them. Those are pretty impressive numbers! The top registered user appears to be an ISP, which claims to be monitoring 60,000 hosts and 130,000 services with Nagios. What types of things does the ISP monitor? According to its detailed profile, "We monitor Cisco network equipment, and Linux, Solaris, FreeBSD, NetBSD, and Windows 2003 servers."

It's readily apparent that Nagios scales very well. If it can handle the load this ISP is giving it, then it will undoubtedly work for you, too.

Modest Requirements

Creating an instance of Nagios is only slightly more difficult than creating an instance of most of the better-known open source software products. You have two options: use the standard tar file installation (which will work on any Linux distribution or UNIX-like operating system) or, if you use an RPM-based installation such as SuSE or Red Hat, use the RPMs thoughtfully created by Dag Wieers (the links are on the Nagios site). The hardware requirements are modest and can easily be met by one of those old Pentium III machines you have stored in the closet. Our instance is a Pentium III 500 with 384 MB of memory and a 20 G IDE drive. We use CentOS 4 on the box (a derivation from Red Hat Enterprise Linux). You need Perl loaded on the machine as well as the Apache Web server, since Nagios has a Web-based front-end that you'll use to control it or to retrieve status reports.

Once the software is installed, you need to create the configuration files. This is easily the most time-consuming part of the installation because, as with all things Linux, there are multiple ways to do the same thing. Nagios currently has two different config file formats: an "all-in-one file with contents that look like transmission line noise" version and a nicely formatted version that splits the file into related content. Both are text files and can be generated by your own scripts, if you like. For example, I did the base population of my hosts file by massaging the output of the "dig" utility (which dumps information from my DNS server) with a home brew script. Other config files include ones for contacts and contact groups, host groups, services, and the commands that Nagios needs to use for each check. It's the interrelation between these files that can make things quite complicated. Fortunately, Nagios does approach these in an object-oriented fashion, so you can create generic objects of each type and then have specific instances inherit properties from the them.

Some of you may shy away from Nagios because of the configuration, but I guarantee that it isn't as bad as you might think. The key to successful deployment of Nagios is to read the documentation provided with the software and then, before you start configuring, have a clear idea of the hosts and services you want to monitor, the metrics by which you decide that there's a problem, and the people you want to notify in each case. If you have this information, then the configuration isn't all that bad. If you want to get a jump start on the process, you can always hire someone to do the initial installation and configuration for you. Commercial support is available, as is the standard free support offered by mailing lists and Web sites. Just check the Nagios site and click on the link for more information.

Get Control of Your Network

Once you get your Nagios system up and running, you'll wonder how you ever got along without it. I don't mean to sound trite, but I can attest that it's a wonderful thing to get a jump on problems and know about them before your users do. Somehow, bad news seems less stressful when it comes from an emotionless machine rather than an irritated human.

Our Nagios box monitors 91 hosts for us, including all of our services, switches, UPSs, and environmental monitoring equipment. It keeps tabs on 131 services and lets us know if any of them are getting sluggish or are failing. It even warns when disk space is getting tight on our machines. We have Nagios sending notifications to our RT instance (see: " Do You Have Issues?"), so I can track trends, failure rates, and problem resolutions very easily.

Extending Nagios is simplicity itself. If you can't find a plug-in to suit your requirements (which is somewhat doubtful, since there are plug-ins to monitor virtually every network service out there, including SNMP-enabled devices), you can write your own. Once configured, Nagios will call your script, and if the script exits with a 0 status code, all is well. An exit code of 1 results in a warning, and an exit code of 2 tells Nagios that there is an error condition. You can extend Nagios to keep tabs on literally anything that it can reach through the network.

Isn't about time to retire your OMAAS and really get control of your network? Be sure to visit the Nagios site. Read some of the docs and presentations, and I know that you, too, will be intrigued by the product. The price is certainly right, and the flexibility is unbeatable. As soon as I submit this article, I'm off to bed, secure in the knowledge that Nagios will let me know if there's a problem. Good night, all!

Barry L. Kline is a consultant and has been developing software on various DEC and IBM midrange platforms for over 23 years. Barry discovered Linux back in the days when it was necessary to download diskette images and source code from the Internet. Since then, he has installed Linux on hundreds of machines, where it functions as servers and workstations in iSeries and Windows networks. He co-authored the book Understanding Linux Web Hosting with Don Denoncourt. Barry can be reached at This email address is being protected from spambots. You need JavaScript enabled to view it..

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: