From 76b82782a9ecf7c4066399703c4f7e1a9fe975b3 Mon Sep 17 00:00:00 2001 From: Tobi Oetiker Date: Sun, 25 Jan 2009 15:38:30 +0000 Subject: added updates accorrding to arnas suggestions --- bin/smokeinfo | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'bin') diff --git a/bin/smokeinfo b/bin/smokeinfo index 978f7bf..ed3519b 100755 --- a/bin/smokeinfo +++ b/bin/smokeinfo @@ -14,9 +14,9 @@ my $Revision = $1; sub main() { # parse options - my %opt = (mode=>'plain',pattern=>undef,separator=>';',format=>'%le'); + my %opt = (mode=>'plain',filter=>undef,separator=>';',format=>'%le',start=>'end-24h'); - GetOptions(\%opt, 'help|h', 'man', 'version', 'noaction|no-action|n', + GetOptions(\%opt, 'help|h', 'man', 'version', 'noaction|no-action|n','no-head', 'start=s','end=s','pattern=s','mode=s','separator=s','format=s') or exit(1); if($opt{help}) { pod2usage(1) } if($opt{man}) { pod2usage(-exitstatus => 0, -verbose => 2) } @@ -25,9 +25,9 @@ sub main() my $config = shift @ARGV; my $si = Smokeping::Info->new($config); - my $nodes = $si->fetch_nodes(pattern=>$opt{pattern},mode=>$opt{mode}); + my $nodes = $si->fetch_nodes(pattern=>$opt{filter},mode=>$opt{mode}); my @rows = qw(med_avg med_min med_max med_now loss_avg loss_max loss_now); - print '# ',join $opt{separator}, 'node_path',@rows; + print '# ',join $opt{separator}, 'node_path',@rows if not $opt{'no-head'}; print "\n"; for my $node (@$nodes) { my $data = $si->stat_node($node,'end-24h','now'); @@ -48,11 +48,11 @@ smokeinfo - poll smokeping site for numeric information B path/to/config.cfg [I] - --start x rrd graph start time + --start x rrd graph start time. (default now-24h) + + --end y rrd graph end time. (default now) - --end y rrd graph end time - - --filter filter_pattern search pattern for node selection + --filter pattern search pattern for node selection --mode plain (default) how to use the pattern - plain @@ -63,6 +63,8 @@ B path/to/config.cfg [I] --format %le (default) + --no-head do not print a header + --man show man-page and exit -h, --help display this help and exit --version output version information and exit @@ -72,6 +74,9 @@ B path/to/config.cfg [I] SmokeInfo is a simple frontend to the L module. It provides access to numeric data stored in the rrd files. +Note that --start and --end are passed directly to rrd graph. This means +they work on the same syntax. + =head2 Examples Get all data all nodes -- cgit v1.2.3-24-g4f1b