amuck-landowner

Need help with an rrdtool graph.

KuJoe

Well-Known Member
Verified Provider
I'm trying to build a script to graph the load of a server using rrdtools but for some reason my graph will only show the data for 12 hours even though the graph itself is 24 hours. Any ideas what I'm doing wrong? I've never used rrdtools before so this script was pieced together from other scripts I've found. I used the same scripts to build a bandwidth graph which works properly, it's just this one that doesn't show the data for 24 hours.


#!/bin/sh

RRDFILE="/var/lib/rrd/load.rrd"
/usr/bin/rrdtool create ${RRDFILE} --start N -s 30 DS:load1:GAUGE:600:0:100 RRA:AVERAGE:0.5:2:800
date=$(date +'%s')
value=$(uptime | awk '{print substr($(NF-2), 0, length($(NF-2))-1)}')
/usr/bin/rrdtool update ${RRDFILE} N:$value

/usr/bin/rrdtool graph /var/www/html/load.png \
-N \
-E \
--start now-24hours \
-t "Average Load (24h)" --height=199 --width=500 \
--lower-limit 0 \
--vertical-label "Load Average" \
-a PNG \
DEF:load1=${RRDFILE}:load1:AVERAGE \
'VDEF:load1last=load1,LAST' \
'LINE1:load1#0000ff:Load Average' \
'GPRINT:load1:LAST:Current Load\:%3.2lf'

Here's the results: http://n3rd.info/upl/load_graph_24h.png
 

perennate

New Member
Verified Provider
And /var/lib/rrd/load.rrd has the full data?

Have you tried rerunning the create with more rows?

/usr/bin/rrdtool create ${RRDFILE} --start N -s 30 DS:load1:GAUGE:600:0:100 RRA:AVERAGE:0.5:2:1600
 
Last edited by a moderator:

VPSCorey

New Member
Verified Provider
It's the create command that's all.  Just look at the documentation, but one option in there should be for how long to keep the data and I'm guessing it's set to 12 hours.
 

KuJoe

Well-Known Member
Verified Provider
Thanks both of you. This fixed it:

/usr/bin/rrdtool create ${RRDFILE} --start N -s 30 DS:load1:GAUGE:600:0:100 RRA:AVERAGE:0.5:2:1600
 
Last edited by a moderator:

KuJoe

Well-Known Member
Verified Provider
http://oss.oetiker.ch/rrdtool/doc/rrdtool.en.html has nice documentation (I'd never heard of rrdtool before and still have never used it but documentation apparently said how to fix the issue :p )
Thanks. I've been using that site which has been extremely helpful. The create command I used was from another website which was used for generating a 24 hour graph for CPU usage so I assumed it would work for Load also, I guess I was wrong.
 
Top
amuck-landowner