[rrd-users] to view my graph i
Simon Hobson
linux at thehobsons.co.uk
Sat Mar 17 10:18:01 CET 2007
zura baizura wrote:
>my problem update using crontab now settle . Thank you
>to all people who help me.
You're welcome.
>But , im here to tell u how to view my graph as im
>using crontab. To make u umderstand my proble i show u
>the result in crontab,ok.
>
>------------IN /var/spool/mail/root-----------------
>>From root at localhost.localdomain Sat Mar 17 12:40:01
>2007
>Return-Path: <root at localhost.localdomain>
>Received: from localhost.localdomain
>(localhost.localdomain [127.0.0.1])
> by localhost.localdomain (8.12.5/8.12.5) with ESMTP
>id l2H4e1LA003578
> for <root at localhost.localdomain>; Sat, 17 Mar 2007
>12:40:01 +0800
>Received: (from root at localhost)
> by localhost.localdomain (8.12.5/8.12.5/Submit) id
>l2H4e1RQ003571
> for root; Sat, 17 Mar 2007 12:40:01 +0800
>Date: Sat, 17 Mar 2007 12:40:01 +0800
>Message-Id:
><200703170440.l2H4e1RQ003571 at localhost.localdomain>
>From: root at localhost.localdomain (Cron Daemon)
>To: root at localhost.localdomain
>Subject: Cron <root at localhost>
>/home/baizura/percubaan/lost.sh
>X-Cron-Env: <SHELL=/bin/sh>
>X-Cron-Env: <HOME=/root>
>X-Cron-Env: <PATH=/usr/bin:/bin>
>X-Cron-Env: <LOGNAME=root>
>
>2.0
>1174106401
> voltan
>
>1174100700: 2.0000000000e+00
>1174101000: 2.0000000000e+00
>1174101300: 2.0000000000e+00
>1174101600: 2.0000000000e+00
>1174101900: 2.0000000000e+00
>1174102200: 2.0000000000e+00
>1174102500: 2.0000000000e+00
>1174102800: 2.0000000000e+00
>1174103100: 2.0000000000e+00
>1174103400: 2.0000000000e+00
>1174103700: 2.0000000000e+00
>1174104000: 2.0000000000e+00
>1174104300: 2.0000000000e+00
>1174104600: 2.0000000000e+00
>1174104900: 2.0000000000e+00
>1174105200: 2.0000000000e+00
>1174105500: 2.0000000000e+00
>1174105800: 2.0000000000e+00
>1174106100: 2.0000000000e+00
>1174106400: 2.0000000000e+00
>1174106700: nan
>481x454
>
>----------------------------------------------
>actually, after i can generate graph... i want it my
>friends view from their pc when link to internet. i
>know that rrdtool has a rrdcgi. I must do the rrdcgi rite?
Yes, you need to do something before anyone can view your graphs,
there are two main choices available to you :
1) You can use crontab to periodically generate new graphs and make
static web pages that simply link to those graphs.
2) You can write a cgi script that will generate the graphs as required.
Either way will require the use of whatever web server you are happy with.
Option 1 is the quickest and easiest to do, but your system will
spend a lot of time making graphs that aren't ever viewed. Ie, you
are making graphs "just in case" someone comes along to view them,
but since most of the time that isn't going to happen then the graphs
will go unviewed before they are replaced with the next update. Also,
you script must make all the graphs that you might want to view - one
one of my systems that would mean making over 2000 graphs of which
less than 1% would normally get viewed.
Option 2 is more work, more complicated, but more flexible. You can
build only the graphs people actually view, and only when they view
them. I'm not aware of any code examples for doing this, and as a
suggestion to the RRD team, how about allowing people to upload their
code to the gallery so that as well as seeing what people can create,
we can see how they did it (if the author wishes to publish their
code) ?
As a hint to get you started, my scripts (which are rather untidy and
run in bash) simply create the image 'inline'. Ie, they output the
html for the page, and when they get to a graph the output pauses
while the script builds an RRD script, calls the RRD script to
generate the graph file, then outputs the html link for the image
file. It's not overly elegant but it works.
What some other scripts I have observed do is : the main script
creates the whole html page, using links to further cgi calls for
each image - eg instead of just linking to imagefile.jpg, it links to
something like ".... drawgraph.cgi?option1=xxx?option2=yyy".
drawgraph.cgi would be the script that actually generates the graph
image (according to the options passed) and outputs the image file as
though the server had just read a file.
I think this latter method is a nicer user experience as you get the
whole page with frames for the images, then the images get drawn when
they've been generated. With the first method, you get part of the
page then everything stops while the graph is made, then the page
draws a bit more until the next graph, and so on. On the other hand,
with option 2 you need to watch your resource usage if you generate
complex graphs. I have a graph that takes nearly 2GByte of VM to
generate (it's a stacked graph of in and out traffic counts for all
254 IPs in a class c subnet) - clearly it isn't going to be practical
to generate 4 of those in parallel on a system with 1G or real ram
and 1G of swap and so some locking would be required to do these
under option 2 !
Sorry I can't be more specific, but I don't know the subject well
enough to explain the steps required - I sort of fumbled my way along
until I got something working and it's too long ago now to remember
how.
More information about the rrd-users
mailing list