[rrd-users] rrdtool, python and threads
yiannis at vavouranakis.gr
Tue Apr 22 22:14:38 CEST 2008
I'm completely new to rrdtool AND mailing lists, so please bear with me.
Since I don't know whether this has been answered before, and I don't know
how (or if) I can search the mailing list archives, I'm posting a question.
Here's my situation:
I have a series of resources I'm monitoring (nothing to do with traffic
etc). I've already figured out what DS and RRA I need. I'm planning on
updating the relative RRDatabases (1 file per resource) via a python script.
So far, I've created a bash script that calls the same python script over
and over again with different command line arguments each time, so that I
collect data from each resource, i.e. my bash script is like this:
python get_the_resource.py resource1
python get_the_resource.py resource2
python get_the_resource.py resource3
python get_the_resource.py resource4
The python script itself is quite I/O intensive: The whole bash script takes
about 15 seconds to run for 6 resources monitored. I've also tried one
single resource (i.e. running one of the above lines on its own) and saw
that it took consistently about 2 seconds, most of which was used up merely
for fetching data from the web.
So I'm guessing that if I make a threaded python script that sends each
request in its own thread, I'll have a more effective program.
Here's where it gets hairy: as I said, I also want to record this data in an
RRDatabase. I've read on the site that if I use librrdtool in threaded
programs, I need to use different functions. However, That library is for C
programs (I think). Does the same hold for python scripts as well? Do I have
to use the *_r functions? Maybe it's not noteworthy, but I should mention
again that each resource has its own rrd (because more resources to be
monitored will be added in the future, and I haven't seen a way to add a DS
Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rrd-users