Friday, May 20. 2011

Nagios NSCA from Python

I've been working on improving the monitoring of the build slaves at Mozilla. As part of this project, I needed to be able to submit passive check results to the Nagios servers via NSCA during system startup. I'm doing this from a Python script that needs to run on a wide array of systems using whatever random Python is available. We run some oddball stuff, so the common denominator is Python 2.4.

It turns out that there's no Python NSCA library, although there is Net::Nsca in Perl. So, I wrote one, and put it on github: https://github.com/djmitche/pynsca.

At the moment, this only knows XOR, and only does service checks. That's all I need, but hopefully it can be easily expanded to cover other purposes. The one thing I want to avoid is adding mandatory requirements -- this should work, at least in plain-text and XOR modes, on a plain-vanilla Python installation.

By the way, the startup script I'm working on is runslave.py, which includes a modified copy of pynsca and does a number of other housekeeping jobs as well. More on that in a subsequent post.


Trackbacks

No Trackbacks

Comments
Display comments as (Linear | Threaded)

*When I was doing similar things, I found the check_mk plugin to be a much more pleasant way of doing these sorts of things. You might want to check it out.

I modified it pretty heavily, but by now it has incorporated a lot of the types of things I was adding.

It'll work alongside traditional Nagios checks, but the more you drink the check_mk Kool-Aid the happier you'll be. :)

#1 Steve Fink on 2011-05-20 23:04 (Reply)

*In this particular case, the monitored hosts cannot run any services (they are talos systems, used for performance testing, and thus can't be spending CPU cycles servicing requests at odd moments). So this has to be a passive check result sent directly from the host to the server.

#1.1 Dustin J. Mitchell (Homepage) on 2011-05-20 23:07 (Reply)

Add Comment


To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

Markdown format allowed
 
 

Notice

The postings on this site are my own and don't necessarily represent the opinions of Zmanda, Inc.