Simple Network Management Protocol

Simple Network Management Protocol


The hardest part of the learning curve for me, was learning about SNMP, the "Simple Network Management Protocol". Zenoss, like most network monitoring services relies heavily on this technology, which apparently dates back to the late 1980s, even though I'd never heard of it.

The essence of SNMP is that it is a daemon that you install on all the computers you want to monitor (apparently some network appliances have SNMP already installed, though not mine). It provides a simple internet query service which can report status information about the computer to the monitoring computer (lots of stuff, ranging from how hard the CPU is working, to how much space is available on all the hard drives, to whether certain processes are running).

Or in fact, any other computer that knows the "community string"—a password-like value that is passed clear-text to the SNMP server, and as a result isn't terribly secure. This is SNMP version 1; there also have been SNMP versions 2, 2c, 2u, 2*, and lately there is a version 3. The most popular SNMP implementation for GNU/Linux is Net-SNMP, which supports the v1, v2c, and v3 protocols. Only the version 3 sets up user/password authentication, and it is trickier to set up (and remember, this is the part that has to be set up on each computer). So for those of us who are lazy, "community-based" authentication will probably have to do.

On my LAN computers, all of which are running Debian GNU/Linux, this was quite easy to install with apt-get:

# su root
...
# apt-get install snmp snmpd

I'm sure that most other distributions will also have appropriate packages for SNMP. These are very mature programs.

Configuring SNMP to do what I wanted was a little trickier—I'll come back to that part.

Figure 4: Debian's snmp package includes a configuration program called snmpconf which I found helpful (even though the configuration file is simple enough to just edit by hand)Figure 4: Debian's snmp package includes a configuration program called snmpconf which I found helpful (even though the configuration file is simple enough to just edit by hand)

For most application, Zenoss will essentially act as a client, accessing the SNMP servers to collect information and fit it to its own internal model of the computers' states. The Zenoss manuals call this fitting process "modelling" (although that is somewhat peculiar usage, since "modelling" usually means coming up with the model in the first place, not fitting an existing model to empirical data). For the most part, it is assumed that this modelling is based on data from SNMP queries.

Setting Up LAN Computers for Monitoring (Configuring SNMP)

As part of the snmp package, Debian includes a utility called "snmpconf" which can be used to generate the snmpd.conf file which the snmpd SNMP daemon uses for configuration. In Debian, this file will be located at /etc/snmp/snmpd.conf. There may be slight variations on this in other distributions (`/etc/snmpd.conf' is another likely location, for example).

This script is probably the easiest way to generate your first configuration file, although you could probably just edit it in a text editor and get very similar results, as the file itself is not complex (in fact, in my Debian install it is mostly comment text explaining the various options). The script will keep things simple by asking you a series of questions via a series of menus. Figure 5 shows what the script looked like for one of my systems.

Figure 5: Configuring SNMP with snmpconfFigure 5: Configuring SNMP with snmpconf

Things to monitor

Load averages are a useful way of seeing how busy the CPU is. I set up this system to generate an error condition if the load rises above 2.0 for fifteen minutes (meaning the CPU schedule is backlogged by about 50%), above 3.0 for five minutes, or above 5.0 for one minute.

A common problem on systems with limited disk space (or whose users consume disk space very aggressively), is that the /home partition fills up. This makes it impossible to log in, which can result in much screaming from the aforementioned users. So, another useful thing to monitor is the disk fill—I'd like to get a warning whenever a system's /home partition has less than 5% of its space remaining (being somewhat of a traditionalist when it comes to filesystem partitions, I always put the /, /home, /usr, /var, and /tmp drives on separate logical partitions so as to maintain a "separation of concerns" with file storage—so it's very rare that /home fills up due to any system processes, which typical run into their ceiling on the /var partition).

Problems with /var, /usr, or / generally result in more subtle, but still undesirable behavior. In fact, you could argue that, since they are less likely to result in a catastrophic failure, they are more likely to go unnoticed, so they are even more important to monitor. So I put watches on those as well.

In the end, I wound up with a very simple snmpd.conf file (minus the extensive comment blocks):

syslocation  Bedroom
rocommunity  FSM_ZenOSS
disk  /home 10%
disk  /var 10%
disk  /tmp 2%
disk  / 1%
disk  /usr 1%
load  5.0 3.0 2.0

The most important thing here, and the only one we strictly need is the rocommunity line which specifies the community identification string that will be used to get information from my SNMP servers (rest assured, I changed it after writing this article!). Everything else is configuration information for what SNMP should report: disk fills, load average, and a string identifying the system's physical location (I suspect this isn't quite what it was intended for, but it'll do for me).

Author information

Terry Hancock's picture

Biography

Terry Hancock is co-owner and technical officer of Anansi Spaceworks. Currently he is working on a free-culture animated series project about space development, called Lunatics as well helping out with the Morevna Project.

Most forwarded

Interview with Dave Mohyla, of DTIDATA

Dave Mohyla is the president and founder of dtidata.com, a hard drive recovery facility based in Tampa, Florida.

TM: Where are you based? What does your company do?
DTI Data recovery is based in South Pasadena, Florida which is a suburb of Tampa. We have been here for over 10 years. We operate a bio-metrically secured class 100 clean room where we perform hard drive recovery on all types of hard disks, from laptop hard drives to multi drive RAID systems.

Anybody up to writing good directory software?

Since the very beginning, directories (of any kind) have had a very central role in the internet. (I have recently grown fond of Free Web Directory. Even Slashdot can be considered a directory: a collection of great news and invaluable user-generated comments. As far as software is concerned, doing a quick search on Google about software directories will return the free (as in freedom) software directories like Savannah, SourceForge, Freshmeat and so on, followed by shareware and freeware sites such as FileBuzz, PCWin Download Center and All Freeware (great if you're looking for shareware and freeware, but definitely less comprehensive than their free-as-in-freedom counterparts).

Interview with Mark Shuttleworth

Mark Shuttleworth is the founder of Thawte, the first Certification Authority to sell public SSL certificates. After selling Thawte to Verisign, Mark moved on to training as an astronaut in Russia and visiting space. Once he got back he founded Ubuntu, the leading GNU/Linux distribution. He agreed on releasing a quick interview to Free Software Magazine.

Is better education the key to finding better software?

I read David Jonathon's article Anybody Up To Writing Good Directory Software? the other day, which got me thinking about software directories in general. As David mentioned, many of the software directories one finds when doing a quick google search are free as in beer, not as in freedom. But what interests me is the software directories that already exist, providing a combination of both free as in beer software, and open source software. Sites such as Freeware Downloads and Shareware Download don't advertise themselves as providing free as in liberty software, but each of them have a good selection of open source software available... if you know where to look.

Most emailed

Free Open Document label templates

If you’ve ever spent hours at work doing mailings, cursed your printer for printing outside the lines on your labels, or moaned “There has got to be a better way to do this,” here’s the solution you’ve been looking for. Working smarter, not harder! Worldlabel.com, a manufacture of labels offers Open Office / Libre Office labels templates for downloading in ODF format which will save you time, effort, and (if you want) make really cool-looking labels

Creating a user-centric site in Drupal

A little while ago, while talking in the #drupal mailing list, I showed my latest creation to one of the core developers there. His reaction was "Wow, I am always surprised what people use Drupal for". His surprise is somehow justified: I did create a site for a bunch of entertainers in Perth, a company set to use Drupal to take over the world with Entertainers.Biz.

Update: since writing this article, I have updated the system so that the whole booking process happens online. I will update the article accordingly!

So, why, why do people and companies develop free software?

More and more people are discovering free software. Many people only do so after weeks, or even months, of using it. I wonder, for example, how many Firefox users actually know how free Firefox really is—many of them realise that you can get it for free, but find it hard to believe that anybody can modify it and even redistribute it legally.

When the discovery is made, the first instinct is to ask: why do they do it? Programming is hard work. Even though most (if not all) programmers are driven by their higher-than-normal IQs and their amazing passion for solving problems, it’s still hard to understand why so many of them would donate so much of their time to creating something that they can’t really show off to anybody but their colleagues or geek friends.

Sure, anybody can buy laptops, and just program. No need to get a full-on lab or spend thousands of dollars in equipment. But... is that the full story?

Fun articles

Santa Claus - the most successful open source project

It dawned on me the other day, as I was shopping for the dozens of gifts it seems I have to buy every December, that Santa Claus is the most successful open source project in history. (Bridget @ Illiterarty would agree with that). Santa Claus is essentially a marketing development that is embodied by everyone who stuffs a sock, gives a gift, hosts a dinner or wishes Merry Christmas over the holiday season.

Most emailed

Editorial

When I first started thinking about Free Software Magazine, I was feeling enthusiastic about the dream. I had Dave, Gianluca, and Alan willing to help me, I had established members of the free software community willing to help me out, I had writers volunteering their time and energy for free, and I had a generous offer from OpenHosting for servers, all before I'd proved myself. There was a sense of excitement in the air, and I thought maybe, just maybe, I could make this work.

Free Software Magazine uses Apollo project management software and CRM for its everyday activities!