From a4e465de6b8cb972864ec1636bef470dd1173d89 Mon Sep 17 00:00:00 2001 From: oetiker Date: Tue, 18 May 2004 18:49:50 +0000 Subject: [PATCH] add 4chars and fix two examples -- Mike Slifcak git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@252 a5681a0c-68f1-0310-ab6d-d61299d08faa --- configure.ac | 1 + examples/4charts.pl.in | 21 ++++++++++----------- examples/Makefile.am | 13 ++++++++----- examples/shared-demo.pl.in | 10 +++++----- examples/stripes.pl.in | 8 ++++---- 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/configure.ac b/configure.ac index 1ce43a2..9027802 100644 --- a/configure.ac +++ b/configure.ac @@ -523,6 +523,7 @@ AC_CONFIG_FILES([examples/shared-demo.pl \ examples/bigtops.pl \ examples/minmax.pl \ examples/cgi-demo.cgi \ + examples/4charts.pl \ examples/Makefile \ doc/Makefile \ src/Makefile \ diff --git a/examples/4charts.pl.in b/examples/4charts.pl.in index 9df0f7b..7249b07 100755 --- a/examples/4charts.pl.in +++ b/examples/4charts.pl.in @@ -1,9 +1,10 @@ -#! /usr/bin/perl +#! @PERL@ #makes things work when run without install use lib qw( ../bindings/perl-shared/blib/lib ../bindings/perl-shared/blib/arch ); # this is for after install use lib qw( @prefix@/lib/perl ../lib/perl ); + use RRDs; my $start=time; @@ -31,10 +32,11 @@ for ($t=$start; $t<$start+300*300; $t+=300){ } } -$c1="f57912a0"; -$c2="2a79e9a0"; -$w=300; -$h=140; +my $c1="f57912a0"; +my $c2="2a79e9a0"; +my $w=300; +my $h=140; + RRDs::graph "$name-L.png", "--title", "2 LINES", "--start", "now", @@ -115,12 +117,9 @@ RRDs::graph "$name-sample.png", "LINE1:b#ff0000:Max Incoming", ; - - -print "ERROR: $ERROR\n" if $ERROR = RRDs::error; - - - +if ($ERROR = RRDs::error) { + print "ERROR: $ERROR\n"; +}; print "This script has created $name.png in the current directory\n"; print "This demonstrates the use of the TIME and % RPN operators\n"; diff --git a/examples/Makefile.am b/examples/Makefile.am index 483e232..258173b 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,10 +1,13 @@ ## Process this file with automake to produce Makefile.in -#AUTOMAKE_OPTIONS= foreign -# -#ACLOCAL_M4= $(top_srcdir)/config/aclocal.m4 +#AUTOMAKE_OPTIONS = foreign -EXTRA_DIST = cgi-demo.cgi.in piped-demo.pl.in shared-demo.pl.in stripes.pl.in bigtops.pl.in minmax.pl.in +#ACLOCAL_M4 = $(top_srcdir)/config/aclocal.m4 + +EXTRA_DIST = cgi-demo.cgi.in piped-demo.pl.in shared-demo.pl.in \ + stripes.pl.in bigtops.pl.in minmax.pl.in 4charts.pl.in examplesdir = $(prefix)/examples -examples_SCRIPTS = cgi-demo.cgi piped-demo.pl shared-demo.pl stripes.pl bigtops.pl minmax.pl +examples_SCRIPTS = cgi-demo.cgi piped-demo.pl shared-demo.pl \ + stripes.pl bigtops.pl minmax.pl 4charts.pl + diff --git a/examples/shared-demo.pl.in b/examples/shared-demo.pl.in index 596fb06..8021971 100755 --- a/examples/shared-demo.pl.in +++ b/examples/shared-demo.pl.in @@ -91,11 +91,11 @@ my $counter = 1e7; for (my $t=$START+1; $t<$START+$STEP*$RUNS; $t+=$STEP+int((rand()-0.5)*7)){ - $counter += 2500*sin($t/2000)*$STEP; - my $data = (1000+500*sin($t/1000)).":". - (1000+900*sin($t/2330)).":". - (2000*cos($t/1550)).":". - (3220*sin($t/3420)).":$counter"; + $counter += int(2500*sin($t/2000)*$STEP); + my $data = int(1000+500*sin($t/1000)).":". + int(1000+900*sin($t/2330)).":". + int(2000*cos($t/1550)).":". + int(3220*sin($t/3420)).":$counter"; push(@options, "$t:$data"); RRDs::update $RRD1, "$t:$data"; if ($ERROR = RRDs::error) { diff --git a/examples/stripes.pl.in b/examples/stripes.pl.in index c19695a..5c4c6df 100755 --- a/examples/stripes.pl.in +++ b/examples/stripes.pl.in @@ -11,7 +11,7 @@ use vars qw(@ISA $loaded); use RRDs; my $start=time; -my $rrd="randome.rrd"; +my $rrd="random.rrd"; RRDs::create ($rrd, "--start",$start-1, "--step",300, "DS:a:GAUGE:600:U:U", "DS:b:GAUGE:600:U:U", @@ -26,7 +26,7 @@ for ($t=$start; $t<$start+200*300; $t+=300){ } } RRDs::graph "stripes.png", - "--title", 'Stripes Demo', + "--title", "Stripes Demo", "--start", $start, "--end", "start + 400 min", "--interlace", @@ -40,8 +40,8 @@ RRDs::graph "stripes.png", "AREA:beta#00b674:beta", "LINE1:b#ff4400:beta envelope\\c", "COMMENT:\\s", - "COMMENT:CDEF\:alpha=TIME,1200,%,600,LT,a,UNKN,IF", - "COMMENT:CDEF\:beta=TIME,1200,%,600,GE,b,UNKN,IF\\j"; + "COMMENT:alpha=TIME,1200,%,600,LT,a,UNKN,IF", + "COMMENT:beta=TIME,1200,%,600,GE,b,UNKN,IF\\j"; if ($ERROR = RRDs::error) { print "ERROR: $ERROR\n"; }; -- 2.11.0