Code Vigorous

Dustin J. Mitchell

Nagios NSCA from Python

20 May 2011

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:

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, which includes a modified copy of pynsca and does a number of other housekeeping jobs as well. More on that in a subsequent post.