Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 09-02-2005, 10:05 AM   #1
LQ Newbie
Registered: Sep 2003
Posts: 12

Rep: Reputation: 0
Unhappy Help on RRDTOOL and maybe perl needed!

Hi there,

Im learning perl and rrdtool now. I try to make
rrdtool to monitoring cpu loadavg. Everythings seems
working (rrd db created, updated, rrd images created,
updated. i check with doing a ls -l and compare the
timestamp on those files).

However, the is only one problem that screw the whole
things -- the graph is blank wiht no line

I tried many times but still not able to get it solve.
Thus, im posting my script here and hope someone can
help me.

# cat
use RRDs;
my $rrd = '/var/www/htdocs/rrd_db';
my $img = '/var/www/htdocs/rrd_images';
if (! -e "$rrd/cpu.rrd") {
RRDs::create "$rrd/cpu.rrd",
"-s 300",
my $min1 = `cat /proc/loadavg | cut -d" " -f1`;
my $min5 = `cat /proc/loadavg | cut -d" " -f2`;
my $min15 = `cat /proc/loadavg | cut -d" " -f3`;

RRDs::update "$rrd/cpu.rrd",
"-t", "1min:5min:15min",

RRDs::graph "$img/cpu-day.png",
"-s -1day",
"-t CPU information :: day",
"-h", "120", "-w", "600",
"-a", "PNG",
"-v Load AVG %",

if ($ERROR = RRDs::error) { print "$0: unable
to generate cpu graph: $ERROR\n"; }

Thanks in advance.
Old 09-05-2005, 04:27 AM   #2
LQ Newbie
Registered: Sep 2003
Posts: 12

Original Poster
Rep: Reputation: 0

Apparently, just need to remove the eol character from the source. This is how i do it,
$line = qx/uptime/;
# to chop the trailing newline
chomp $line;


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
perl-Video-Frequencies needed tjuii SUSE / openSUSE 7 10-14-2005 03:09 AM
Help on sed and perl needed. cash_05 Programming 7 09-03-2005 05:33 PM
Perl guru needed J_Szucs Programming 1 10-11-2004 04:05 AM
Regex help needed in perl Dr Twox Programming 2 08-07-2004 06:58 AM
(Perl?)Script needed Cyrus XIII Programming 5 01-03-2004 12:45 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:24 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration