LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-22-2012, 09:11 PM   #1
HariharanV
Member
 
Registered: Aug 2010
Posts: 49

Rep: Reputation: 0
Reg: error in my perl script


Hi All,

I have perl script which is used for updating the rrd file, but i got the following error

ERROR: expected 1 data source readings (got 6) from 1327287766:82:0:0:0:0:0

Check my script:
# Users By ID
my $rrddata = "/path to store rrd file/";
`/usr/bin/curl --silent http://example.com -o /tmp/userscount.txt`;
open(CURL, "/tmp/userscount.txt") || die "Unable to open /tmp/userscount.txt\n";
$ts = time();
while(my $line = <CURL>){
if ($line =~ m/^[^\d]{20}/){
next;
}
print $line;
my ($example_id,$count,$name) = split(":",$line, 3);
my $rrdfile = sprintf("%s%s.rrd",$rrddata, $example_id);
# print $rrdfile . "\n";
if (!-f $rrdfile){
print "=> creating file $rrdfile\n";
my $command = "/usr/bin/rrdtool create $rrdfile --step 300 --start now
DS:user_count:GAUGE:620:0:5000
RRA:MIN:0:360:576
RRA:MIN:0:30:576
RRA:MIN:0:7:576
RRA:AVERAGE:0.5:144:1460
RRA:AVERAGE:0.5:24:732
RRA:AVERAGE:0.5:6:672
RRA:AVERAGE:0.5:1:576
RRA:MIN:0:360:576";
$command =~ s/\n//g;
system($command);
}
my $command = sprintf("/usr/bin/rrdtool update %s %d:%d:%d:%d:%d:%d:%d", $rrdfile, $ts, $count);
system ($command);
#print $command . "\n";
}
close(CURL);
# } @ for



Please any one help me on this.


Thanks,
Hariharan V.
 
Old 01-23-2012, 12:58 AM   #2
ukiuki
Senior Member
 
Registered: May 2010
Location: Planet Earth
Distribution: Debian
Posts: 1,030

Rep: Reputation: 385Reputation: 385Reputation: 385Reputation: 385
Quote:
Originally Posted by HariharanV View Post

... i got the following error

ERROR: expected 1 data source readings (got 6) from 1327287766:82:0:0:0:0:0

...
The script looks like is set to read ONE data source but it is finding more (got 6) in this case.
Do you have more than you should in your directory where the source is?
I hope this helps.

Regards
 
Old 01-23-2012, 10:06 AM   #3
HariharanV
Member
 
Registered: Aug 2010
Posts: 49

Original Poster
Rep: Reputation: 0
Hi,

Thanks for your kind update. I have fix that issue. Thank you soo much............!
 
  


Reply



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
[SOLVED] error in perl script me_spearhead Programming 4 06-22-2007 02:27 AM
Perl Reg Exp Question amytys Programming 1 12-09-2005 12:53 PM
Perl Script Error steve007 Programming 18 09-20-2005 03:54 AM
PERL Q, split function and reg expressions amytys Programming 1 12-08-2004 10:54 AM
perl script reg expr confusion rajatgarg Programming 1 04-09-2004 03:49 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:06 AM.

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