Mats Gustavsson <wwwmaz...@gmail.com> wrote: > I have a Perl script that creates a .png file with the graph. So far so good. > In the Graph I have the function "HRULE:22#000000" that works just fine. > > Now I want to make the value 22 flexible. I want it be be read from a > external file. > So when I just change the value to 21, or 23 or what ever, its been read from > a file. > > Because the value in the file ex 22 is being read from multiple scripts, both > a bash and a python script, I want it to pick the value from the file to the > HRULE in the RRDs::Graph, in the perl Script. > > The file, that is today being read from bash and python, is just containing a > value between -30 to +50. So the help that I need with, it needs to handle a > value ex -5 and 22. > > The reason I want it to read from the same file, is that I just needs to > adjust in two files. > File 1 High value like -5 > File 2 Low value like 22. > Instead in 20-24 different places, that is easily to miss a place to change. > > I hope that some one can help me.
TBH I'm not sure what the question is ! It seems that you've already figured out that the way to do this is to put the values into files, and read those files in to set a variable that you can then use in building the RRD command. In bash I'd be thinking along the lines of : MaxLineValFile="/some/path/to/file" read $MaxlineVal < ${MaxLineValFile} # Apply some sanity checking here ! rrdtool ... ${MaxLineVal} ... I actually use rrdcgi in my scripts (cgi scripts served up by Apache), like this : ( echo some stuff echo more stuff some conditional stuff ... ) | /usr/bin/rrdcgi --filter - 2>&1 > /dev/null This is because some of my RRD stuff is quite large - biggest is 254 values stacked, plus another 254 valued inverted and stacked, plus a legend for min and average for each. I did try building up the list of RRD commands in a text variable and then calling "rrdtool graph ${command_list}" but it got really slow building that up. _______________________________________________ rrd-users mailing list rrd-users@lists.oetiker.ch https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users