Distance measuring with Raspberry Pie
A nice article is found here http://www.raspberrypi-spy.co.uk/2012/12/ultrasonic-distance-measurement-using-python-part-1/
It connects a very basic ultrasonic distance sensor to the GPIO port of the Raspberry Pie and makes it necessary to measure the time the ultrasonic signal needs to return. There are more sophisticated measurement solutions but I like this one because of its simplicity.
To create a sensor delivering a distance to Nagios or any other monitoring system should be very simple.
And a nice more general tutorial is here: http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/temperature/
npcd for nagios/pnp
So, this is really annoying. The npcd on the nagios server of one of my customers is regularly pausing. This seems to be an issue with the thread handling because the last thing the daemon writes into the logs is something like this:
Apr 4 10:26:23 mon01 NPCD: DEBUG: Will wait for th['0']
After that no further files will be processed. I have no idea what to do about that even though an upgrade from 0.4 to 0.6 might be a solution. This is not easily possible since npcd comes with pnp and this is part of the distribution that I currently can't upgrade from OpenSuSE 11.3.
Reducing the value of sleep_time and increasing the value of npcd_max_threads seems to reduce the possibility of this problem happening but there is no guarantee that it will continue to work. I used the values
sleep_time = 2
npcd_max_threads = 25
On the last incident of this type I noticed the problem after a two week holiday so I had to replay nearly two weeks of performance data. I had to restart the npcd repeatedly so it restarted to do its work. It helped to monitor the work of npcd with tail -f in a shell and switch on Konsole's "Monitor for Silence" so it alerted me every time it stopped to work.
In the end, this succeeded but it was a bad thing since I had to restart ncsd every some minutes and it took me a whole morning to process approx. 120000 files from two weeks of "silence".