cacti and friends


The last days I spent some time installing digitemp sensors on my watercooling system and setting up cacti to graph the temperatures.
For reading the sensors I use this little python script:

from subprocess import Popen, PIPE, STDOUT
from string import *
from sys import *

process = Popen("digitemp_DS9097 -q -c /etc/digitemp.conf -r2000 -a", shell=True, stdout=PIPE, stderr=STDOUT)

identifiers = argv[1:]
identifiers = map(lambda x: x+":",identifiers)


n = len(identifiers)
values = [.0]*n
valuecount = 0

for line in process.stdout:
line = line.split()
values[valuecount] = line[6]
valuecount += 1

output = ""
for i,j in zip(identifiers,values):
j = str(j)
output += (i+j+" ")
print output

It is called by cacti using

python /scripts/check_digitemp.py cool air hot out

The parameters given to the script are simply labels of your choice. Just make shure they fit the number of sensors installed.
Also make sure /etc/digitemp.conf exists and the cacti user (in my case www-data) has access to the serial port that connects the sensors. For me it also has been necessary to change the owner of /var/lockLCK..ttyS0 to www-data, otherwise digitemp was not able to lock the serial port.

This might not be the best sollution but for me it works.


I'm also using lm-sensors by cacti. There for I made another script:

from subprocess import Popen, PIPE, STDOUT
from string import *
from sys import *

process = Popen("sensors", stdout=PIPE, stderr=STDOUT)

identifiers = argv[1:]
identifiers = map(lambda x: x+":",identifiers)


n = len(identifiers)
values = [.0]*n


for line in process.stdout:
line = line.split()
if line != []:
#print line
if line[0] == "VCore":
line = line[1:]
for i in range(n):
if line[0] == identifiers[i]:
values[i] = line[1]
if values[i].endswith("\xc2\xb0C"):
values[i
] = values[i][:-3]
if values[i].startswith("+"):
values[i] = values[i][1:]
output = ""
for i,j in zip(identifiers,values):
j = str(j)
output += (i+j+" ")
print output


This is called from cacti by using:
python /scripts/check_sensors.py 1 2 +3.3V +5V +12V -12V -5V V5SB VBat fan1 fan2 temp1 temp2 temp3

In this case the parameters equal the name of the lm-sensors. Note that "VCore 1:" gets translated to "1" due some restriction I had to make when using blank spaces for splitting the output strings.

For some strange reason not all values read make it into the Round Robin Database, but the script itself seems to work.

Starting from theses scripts it should not be to hard to get the actual graphs. Just follow the guide in the cacti documentation.

Comments

dghnfgj said…
Youth is warcraft leveling not a time of life;warcraft leveling it is a wow lvl state of mind; wow power level it is not power leveling amatter of World of warcraft Power Leveling rosy cheeks, red wrath of the lich king power leveling lips and supple knees;WOTLK Power Leveling it is a matter of thewill,wlk Power Leveling a quality of buy aoc gold the imagination,aoc gold a vigor of the emotions; it is thefreshness of the deep springs wow gold of life. Youth means a tempera-mental maplestory mesos predominance of courage over timidity, of the appetite formaple story mesos adventure over the love of ease. wow gold This often existsin a man of 60 more than a boy of 20. Nobody grows old merely by anumber of years.
Titus said…
Hello can you help me add your script to cacti, I dont know how to make graphs from script :(
Brie Aleida said…
@Titus: See http://www.cacti.net/downloads/docs/html/how_to.html#SCRIPT_TO_GRAPH You'll be script-to-graphing in no time. :)!.
Thank you for your article to share with us,Where can you buy cheap shoes? at the heel which is arresting from the ancillary of the in Air Max Premium a lot of models.Nike Outlets,Nike Air Max shoes, interested welcome to come in and see.2011 Cheap Nike Air Max Online Store,
This Nike soccer cleats ultra vibrant New nike soccer shoes ...The Nike soccer cleats has a huge army of fans across the globe, and if you're one of them we know you love them to be bright, flashy and in-your-face colours. Checking out these nike mercurial vapor superfly III fg versions, part of Nike's Fall seasonal releases, we're sure you're going to love these Nike Football Cleats too, they combine Laser technology and Nike Mercurial Vapor Superfly with the Vapor series!especially once they start appearing en masse on pitch. You can click "VIEW MORE" for more detailed pictures. New levels of performance after nike mercurial vapor superfly III new levels of performance after.
Mark Meyers said…
wow, so crowded in here)) people, could you tell me please a good locksmith in California? I know that it is totally off topic, sorry, but i need it desperately. Maybe some of you applied to them san jose locksmith ?
historypak said…
I am very happy to discover your post as it will become on top in my collection of favorite blogs to visit. http://www.da247locksmiths.com/bkny/

Popular posts from this blog

Setting up a Raspberry Pi for OSX using a direct ethernet connection

OpenDNS Fritzbox Howto