Is there a way in cacti to use the timestamp output from a command as the x-axis in the graph?
The use case is I have some historical data collected by other application stored in database, and I want to use cacti to show the data.
The timestamp in graph seems created by rrdtool, I don't find a way to do that. Anybody knows if there is a workaround? If cacti does not have the capability yet, is it possible I set up a project to do it for cacti? Which part of code should I look into?
How to use input timestamp as x-axis in graph
Moderators: Developers, Moderators
In the graph template, create a comment field and put:
Last Updated: |date_time|
Last Updated: |date_time|
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
I think understand what you're trying to do - it would be useful for instance when polling devices that keep their own limited history - i.e. an RMON probe. That means you could poll every 5 mins but actual retrieve data that had been collected every 10 seconds over the past 5 mins.
I had a quick peek at the code - I don't think there is function in Cacti to do this - it seems the timestamp is generated in the poller_output table by the poller (either cmd.php or cactid).
IMO the poller would probably be the best place to fudge the functionality - provided you could get the timestamp from your device in the correct absolute time format (so that the strtotime function can do its business - see rrd.php) and use some flag to announce that it is a time.
I had a quick peek at the code - I don't think there is function in Cacti to do this - it seems the timestamp is generated in the poller_output table by the poller (either cmd.php or cactid).
IMO the poller would probably be the best place to fudge the functionality - provided you could get the timestamp from your device in the correct absolute time format (so that the strtotime function can do its business - see rrd.php) and use some flag to announce that it is a time.
[url=http://www.welham.net/]Steve W[/url]
Hi,
I had the same problem with a lot of data we up to now hold in an
Oracle Databas and generating Graphs with db selects and gnuplot.
My solution was to use rrdtool itself to generate rra files which hold
all data, including the historical ones.
* At first I created a Script, Template, Data Source ... in the normal way to
start a data collecting in cacti.
* Then I turned on Data Source debug mode to find out how cacti creates
the rra file.
* With this information I was able to create a dummy rra with the same
parameters but a alternative start time (minimum. 1 sec before my first
hsitorivcal data set). e.g.:
/usr/local/rrdtool/bin/rrdtool create history.rrd --start 1118842500 \
--step 300 \
DS:SuccessfulTX:GAUGE:600:0:U \
DS:UnSuccessfulTX:GAUGE:600:0:U \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797
* then I adapted my scrpit to generate sets of historical data which fit the
300 second step ratio.
* From this I updated the rra with rrdtool and the historical data by setting
the timestamp at the update coomand. e.g.:
rrdtool update ./history.rrd --template SuccessfulTX:UnSuccessfulTX 1118842800:0:1
* At last I had to merge the new and historical rra.
That's it. I now have old datasets in my cacti rra's and me and my boss
are very pleased that it isn't any more necessery to switch between to
Graph locations.
I had the same problem with a lot of data we up to now hold in an
Oracle Databas and generating Graphs with db selects and gnuplot.
My solution was to use rrdtool itself to generate rra files which hold
all data, including the historical ones.
* At first I created a Script, Template, Data Source ... in the normal way to
start a data collecting in cacti.
* Then I turned on Data Source debug mode to find out how cacti creates
the rra file.
* With this information I was able to create a dummy rra with the same
parameters but a alternative start time (minimum. 1 sec before my first
hsitorivcal data set). e.g.:
/usr/local/rrdtool/bin/rrdtool create history.rrd --start 1118842500 \
--step 300 \
DS:SuccessfulTX:GAUGE:600:0:U \
DS:UnSuccessfulTX:GAUGE:600:0:U \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797
* then I adapted my scrpit to generate sets of historical data which fit the
300 second step ratio.
* From this I updated the rra with rrdtool and the historical data by setting
the timestamp at the update coomand. e.g.:
rrdtool update ./history.rrd --template SuccessfulTX:UnSuccessfulTX 1118842800:0:1
* At last I had to merge the new and historical rra.
That's it. I now have old datasets in my cacti rra's and me and my boss
are very pleased that it isn't any more necessery to switch between to
Graph locations.
Who is online
Users browsing this forum: No registered users and 1 guest