geronet
Joined: 03 Nov 2007 Posts: 1
|
Posted: Sat Nov 03, 2007 2:11 pm Post subject: Automatic width of graphs |
|
|
Hello, i'm using multiple computers with different resolutions, it would be nice if there is an "auto width"- function for graph templates. Before using cacti, i managed it with rrd.cgi like this:
| Code: |
#!/usr/bin/rrdcgi
<HTML>
<HEAD>
<TITLE>One Day Systen Statistics for Tux</TITLE>
<script type="text/javascript">
function system_rrd (time)
{
var a = document.body.offsetWidth - 120;
window.location.href="system.cgi?RRD_TIME=" + time + "&RRD_SIZEX=" + a;
}
</script>
</HEAD>
<BODY bgcolor=FFFFFF>
<H2>Time selection</H2>
<FORM><INPUT type="button" class="button" VALUE="day" onClick="system_rrd('-1day')">
<INPUT type="button" class="button" VALUE="2 days" onClick="system_rrd('-2days')">
<INPUT type="button" class="button" VALUE="week" onClick="system_rrd('-1week')">
<INPUT type="button" class="button" VALUE="month" onClick="system_rrd('-1month')">
<INPUT type="button" class="button" VALUE="year" onClick="system_rrd('-1year')">
</FORM>
<P><RRD::GRAPH /var/www/intern/system-rrd/load_<RRD::CV RRD_TIME>.png
--imginfo '<IMG SRC=/system-rrd/%s WIDTH=%lu HEIGHT=%lu >'
-a PNG
-w <RRD::CV RRD_SIZEX> -h 230
-s <RRD::CV RRD_TIME>
-t "System load"
-v "load average"
--base=1000
--alt-autoscale-max
--lower-limit=0
--upper-limit=1
--units-exponent 0
--lazy
DEF:a="/var/lib/system-rrd/load.rrd":load_1min:AVERAGE
DEF:b="/var/lib/system-rrd/load.rrd":load_5min:AVERAGE
DEF:c="/var/lib/system-rrd/load.rrd":load_15min:AVERAGE
LINE2:a#EACC00:"Load 1 min.\:"
GPRINT:a:AVERAGE:"%.2lf "
LINE2:b#EA8F00:"Load 5 min.\:"
GPRINT:b:AVERAGE:"%.2lf "
LINE2:c#FF0000:"Load 15 min.\:"
GPRINT:c:AVERAGE:"%.2lf ">
</P>
|
Perhaps someone could transfer this to cacti, i think it would be really useful for someone else
Greetings, Stefan |
|