Matt
> How do I create graphs that look like MRTG dynamically with perl? Are
> there any easy ways to do that?
What is MRTG?
Have you seen the posting guidelines for this group?
Sinan
--
A. Sinan Unur <1u...@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
I had no idea what MRTG was, so I googled on it. The first hit said "MRTG
is written in perl and works on Unix/Linux as well as Windows and even
Netware systems". So my guess would be that to do something like MRTG in
Perl, you would use MRTG. If you already tried that and encountered
problems, then what were the problems?
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
Search for RRD in CPAN?
--
Affijn, Ruud
"Gewoon is een tijger."
echo 014C8A26C5DB87DBE85A93DBF |perl -pe 'tr/0-9A-F/JunkshoP cartel,/'
> MRTG
http://www.google.com/search?q=MRTG
--
John Experienced Perl programmer: http://castleamber.com/
> How do I create graphs that look like MRTG dynamically with perl? Are
> there any easy ways to do that?
If you mean http://www.stat.ee.ethz.ch/mrtg/
yes.
http://search.cpan.org/search?query=GD-Graph&mode=module
might be an option.
> "Hi" <no@spam> wrote:
>> How do I create graphs that look like MRTG dynamically with perl?
>> Are there any easy ways to do that?
>
> I had no idea what MRTG was, so I googled on it. The first hit said
> "MRTG is written in perl and works on Unix/Linux as well as Windows
> and even Netware systems".
Aargh, overlooked that small fact (written in Perl).
> "A. Sinan Unur" <1u...@llenroc.ude.invalid> wrote:
>
>> MRTG
>
> http://www.google.com/search?q=MRTG
What is your point?
> John Bokma <jo...@castleamber.com> wrote in
> news:Xns978565EB34...@130.133.1.4:
>
>> "A. Sinan Unur" <1u...@llenroc.ude.invalid> wrote:
>>
>>> MRTG
>>
>> http://www.google.com/search?q=MRTG
>
> What is your point?
Did you read the posting guidelines, especially
"Do not use these guidelines as a "license to flame" or other
meanness. It is possible that a poster is unaware of things
discussed here. Give them the benefit of the doubt, and just
help them learn how to post, rather than assume "
Since MRTG is written in Perl, some people here might know that MRTG =
Perl, and are able to answer the question. You don't, so don't hide behind
the posting guidelines. If you don't want to look it up using Google, why
waste your time on repeating the old guideline mantra?
http://www.linux.cz/stats/mrtg-rrd/eth0-day.png
I think I found what might be the solution.
http://search.cpan.org/~mverb/GDGraph-1.43/
Any other easy to use perl ways to make graphs like this out there?
Matt
Please don't top-post.
> [...] I want to use perl to
> make some nice pretty graphs that look something like this.
> http://www.linux.cz/stats/mrtg-rrd/eth0-day.png
> I think I found what might be the solution.
> http://search.cpan.org/~mverb/GDGraph-1.43/
> Any other easy to use perl ways to make graphs like this out there?
http://search.cpan.org/~mschilli/RRDTool-OO-0.13/
I'm quite charmed by gnuplot, and I use it exclusively to create graphs.
But it uses a pipe (Eeew!) to an external program (Eeew!) and doesn't
use a module (Eeew!). So most people consider me a heretic.
Abigail
--
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");
> I'm quite charmed by gnuplot, and I use it exclusively to create
> graphs. But it uses a pipe (Eeew!) to an external program (Eeew!) and
> doesn't use a module (Eeew!). So most people consider me a heretic.
So I probably shouldn't write here that I use Ant to run a few Perl tasks,
one using pscp to upload some files :-P
> How do I create graphs that look like MRTG dynamically with perl?
> Are there any easy ways to do that?
Have you seen rrdtool?
It is mrtg successor. The program can accept commands via stdin
(one command per line) or you can use special perl module to do it.
--
[pl2en Andrew] Andrzej Adam Filip : an...@priv.onet.pl : an...@xl.wp.pl
http://anfi.homeunix.net/
> My mistake. Thought everyone knew what MRTG was.
That's OK, but it is a good idea to give a URL when you are talking
about a specific software package.
Another good idea is to trim your reply, and put your responses
interspersed with the relevant sections of previous posts. See the
posting guidelines for further suggestions on how to quote.
> Anyway. I have some data and I want to use perl to
> make some nice pretty graphs that look something like this.
>
> http://www.linux.cz/stats/mrtg-rrd/eth0-day.png
>
> I think I found what might be the solution.
>
> http://search.cpan.org/~mverb/GDGraph-1.43/
>
> Any other easy to use perl ways to make graphs like this out there?
I would recommend starting with GD::Graph.
I use 'make' to run all kinds of programs, including Perl programs.
I have replaced Perl programs by Makefiles (or Makefile targets)
more than once.
make rules.
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
>> How do I create graphs that look like MRTG dynamically with perl?
>> Are there any easy ways to do that?
>
> I'm quite charmed by gnuplot, and I use it exclusively to create
> graphs.
> But it uses a pipe (Eeew!) to an external program (Eeew!) and doesn't
> use a module (Eeew!). So most people consider me a heretic.
MRTG-like gnuplots:
http://www.atd.ucar.edu/cgi-bin/weather.cgi
I still like PEAR_Image_Graph a lot:
http://pear.veggerby.dk/
http://pear.veggerby.dk/samples/
http://pear.php.net/package/Image_Graph/
#!/usr/bin/perl -w
use strict;
my $somefile = "/path/to/somefile";
my $pid = open Apipe, "| cat $somefile|less";
close(Apipe);
but surely not...
system("cat $somefile|less");
Those are different types of pipes?
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s};;;
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)}; # Perl 5.6.0 broke this...
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
Yes, piping from inside PERL. It can get way more complicated with the
$pid version. Basically you can run other programs from within perl
with open, system, exec, `....`, or glob.
> John Bokma (jo...@castleamber.com) wrote on MMMMDLXXVII September
[..]
> I use 'make' to run all kinds of programs, including Perl programs.
> I have replaced Perl programs by Makefiles (or Makefile targets)
> more than once.
>
> make rules.
I am having a love hate relation ship with Ant. I decided to give it a try
some time ago, also since now and then I do Java things, and quite a lot
of projects use Ant.
Actually, all three pipes you have there are between different
programs. I still think all the pipes are the same.
,, It can get way more complicated with the
,, $pid version.
The $pid version of what?
,, Basically you can run other programs from within perl
,, with open, system, exec, `....`, or glob.
Actually, you can't run another program "within perl" using 'exec', as
'exec' *replaces* the current program with another.
Abigail
--
#!/opt/perl/bin/perl -- # No trailing newline after the last line!
BEGIN{$|=$SIG{__WARN__}=sub{$_=$_[0];y-_- -;print/(.)"$/;seek _,-open(_
,"+<$0"),2;truncate _,tell _;close _;exec$0}}//rekcaH_lreP_rehtona_tsuJ
> #!/opt/perl/bin/perl -- # No trailing newline after the last line!
> BEGIN{$|=$SIG{__WARN__}=sub{$_=$_[0];y-_- -;print/(.)"$/;seek _,-open(_
> ,"+<$0"),2;truncate _,tell _;close _;exec$0}}//rekcaH_lreP_rehtona_tsuJ
This is an amazing JAPH. Very instructive.
Seconded!
For those having difficulty getting it to work (like me!), you need to
save this to a file and make that file executable. i.e.:
% perl japh.pl # won't work
Jsyntax error at japh.pl line 3, next token ???
Execution of japh.pl aborted due to compilation errors.
% chmod +x japh.pl ; ./japh.pl # will work.
Just another Perl Hacker
The fun is executing the file *twice*.
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
> Dave Weaver (zen1...@zen.co.uk) wrote on MMMMDLXXX September MCMXCIII
> in <URL:news:441934be$0$5012$db0f...@news.zen.co.uk>:
> // A. Sinan Unur <1u...@llenroc.ude.invalid> wrote:
> // > Abigail <abi...@abigail.nl> wrote in
> // > news:slrne1eb9n....@alexandra.abigail.nl:
> // >
> // > > #!/opt/perl/bin/perl -- # No trailing newline after the last line!
> // > > BEGIN{$|=$SIG{__WARN__}=sub{$_=$_[0];y-_--;print/(.)"$/;seek _,-open(_
> // > > ,"+<$0"),2;truncate _,tell _;close _;exec$0}}//rekcaH_lreP_rehtona_tsuJ
> // >
> // > This is an amazing JAPH. Very instructive.
> // >
> //
> // Seconded!
> //
...
> // % chmod +x japh.pl ; ./japh.pl # will work.
> // Just another Perl Hacker
>
>
> The fun is executing the file *twice*.
That was the original reason I thought this one was extremely impressive.
It sure is hard to read ;-)
Hmmm...
Use of uninitialized value in repeat (x) at -e line 1.
> Abigail wrote:
>> perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
>
> Hmmm...
> Use of uninitialized value in repeat (x) at -e line 1.
You need to supply it with an argument with which to test:
C:\> perl -wle "print q{Prime} if (1 x shift) !~ /^1?$|^(11+?)\1+$/" 7853
Prime
Maybe I should write a signature that deletes files. People getting the
uninitialized warning are obviously running the code without understanding
it. Running code that you pasted from a Usenet posting you don't understand
is a dangerous thing to do.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
: C:\> perl -wle "print q{Prime} if (1 x shift) !~ /^1?$|^(11+?)\1+$/" 7853
: Prime
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/' 45937
Segmentation fault
Accepted ceiling seems to be:
45569 -> Prime
45570 and above -> Segmentation fault
(on a Mac Mini)
Oliver.
--
Dr. Oliver Corff e-mail: co...@zedat.fu-berlin.de
Add more memory.
Abigail
--
perl -wle 'sub _ "Just another Perl Hacker"; print prototype \&_'
Thank god for Deparse, we mere mortals would be lost without it.
[tarzan ~]$ perl -MO=Deparse japh.pl
sub BEGIN {
$| = $SIG{'__WARN__'} = sub {
$_ = $_[0];
tr/_/ /;
print /(.)"$/;
seek _, -open(_, "+<$0"), 2;
truncate _, tell _;
close _;
exec $0;
}
;
}
//;
japh.pl syntax OK
That makes much more sense :-)
/jUSSi
--
remove -asdf and asdf- for email address
But that's the output *after* you ran it.
Try deparsing the program before running it.
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
I can't :-)
[tarzan ~]$ perl -MO=Deparse japh.pl
Jsyntax error at japh.pl line 3, next token ???
japh.pl had compilation errors.
sub BEGIN {
$| = $SIG{'__WARN__'} = sub {
$_ = $_[0];
tr/_/ /;
print /(.)"$/;
seek _, -open(_, "+<$0"), 2;
truncate _, tell _;
close _;
exec $0;
}
;
}
[tarzan ~]$
: Add more memory.
I have 1GB, is that _still_ too little?
OliverI have 1GB, is that _still_ too little?