Hi,<br><br>I've some questions about scripting creation of the rrdtool database. Since, my use of the rrdtool is a bit different from most examples which involve incremental updates to the database of integers, i'm having some trouble understanding the parameters. currently i'd like to create a database from the static input file of pc counters which looks like below:
<br><br>[traces]$ head -n 20 ~/input.log <br>1:c0103b74<br>2:c0103b79<br>3:c0103bf4<br>4:c0103bf5<br>5:c0103bf6<br>...<br>...<br><br>Q1: Tor the time attribute that rrdtool needs--for now-- i've added an arbitrary value to represent time ticks. The second column is not of a number format--though the pc which is in hex can easily be coverted to a number format. This brings me to my first question: Is it possible to plot time versus a non integer value using rrdtool?
<br><br>Q2.a: In the below script--which i've written up based on Simon's pseudocode--are the "rrdtool create" parameters correct? Specifically, since i'm reading from a file, what should the increment option --step be (currently it's set to 60, because else i'd get an error saying "ERROR: step size should b no less than one second"). In the rrdtool create documentation, i did not see a option for the create command to specify that the intervals should be right after each other with no wait time in between (since i'd like to read from a file and stop adding to the database afterwards).
<br><br>Q2.b: Also, when specifying the Round Robin Arhive, what is the format for specifying data source is from a file? I've tried variation of the line "DS:input:ABSOLUTE:$INPUT_FILE, all without success.<br>
<br>-------------------------------------------------------------------------<br>#!/bin/sh<br><br>rrdtool="/usr/local/rrdtool-1.2.19/bin/rrdtool"<br>delim=":"<br><br>INPUT_FILE=$1<br><br>if [ ! -f $INPUT_FILE ]; then
<br> print "File $INPUT_FILE not found" <br> exit 1<br>fi<br><br><br>rrdtool create datafile.rrd \<br> --start N --step 60 \<br> DS:input:ABSOLUTE:$INPUT_FILE <br><br>cat $INPUT_FILE | while read line
<br>do<br> #timestamp="$(echo ${line} | cut -d: -f1)"<br> #pc="$(echo ${line} | cut -d: -f2)"<br> <br> while (read -u 0 -d ":" timestamp value)<br> do<br> echo "$timestamp - $pc"
<br> #rrdtool update datafile.rrd $timestamp:$pc <br> done <br>done<br>#rrdtool create graph<br>-------------------------------------------------------------------------<br><br>Thank you for your help,<br>-Bita.
<br><br><br><br><br><br><br><br><div><span class="gmail_quote">On 5/16/07, <b class="gmail_sendername">Simon Hobson</b> <<a href="mailto:linux@thehobsons.co.uk">linux@thehobsons.co.uk</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
betamaz wrote:<br>>I'm new to rrdtool and have been reading up on the tutorial posted<br>>on the main webpage. The examples in the tutorial describe how to<br>>create a database by taking measurements. For example, using snmp or
<br>>it gives basic examples where the inputs are via the rrdtool create<br>>command line (for example the speed inputs for test.rrd). Is there a<br>>way, to read inputs from command line and create a database out of
<br>>that (similar to gnuplot)?<br><br>Yes, RRD doesn't care where the data comes from, all it sees are a<br>series of update with timestamp and a number of values. As long as<br>the timestamps a) make sense for the data, and b) are always
<br>increasing, then rrd will handle it.<br><br>So assuming you have a file containing a series of records, one per<br>line, of the form time:value then you simply need to write a script<br>of the form :<br><br>create rrd file
<br>while (read timestamp:value pair)<br> update rrd with timestamp and value<br>done<br>create graph<br><br> With the exception of drawing a graph which normally takes a few<br>lines of arguments, the above can be written in about the same number
<br>of statements in most languages (whether that be Bash shell script,<br>Perl, ...). How much extra checking etc you put in is up to you and<br>what you know about the source of the data - such as is the file<br>format likely to be correct (ie it's created by a trustworthy
<br>automated tool) or do you need to do extensive validation on the<br>input ?<br></blockquote></div><br>