/usr/sbin/smokeinfo is in smokeping 2.6.11-4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | #!/usr/bin/perl
use strict;
use warnings;
use Smokeping::Info;
use Getopt::Long 2.25 qw(:config no_ignore_case);
use Pod::Usage 1.14;
'$Revision: 3879 $ ' =~ /Revision: (\S*)/;
my $Revision = $1;
sub main()
{
# parse options
my %opt = (mode=>'plain',separator=>';',format=>'%le',start=>'end-24h',end=>'now');
GetOptions(\%opt, 'help|h', 'man', 'version', 'noaction|no-action|n','no-head',
'start=s','end=s','filter=s','mode=s','separator=s','format=s') or exit(1);
if($opt{help}) { pod2usage(1) }
if($opt{man}) { pod2usage(-exitstatus => 0, -verbose => 2) }
if($opt{version}) { print "smokeinfo $Revision\n"; exit(0) }
if($opt{noaction}) { die "ERROR: don't know how to \"no-action\".\n" }
my $config = shift @ARGV;
my $si = Smokeping::Info->new($config);
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 if not $opt{'no-head'};
print "\n";
for my $node (@$nodes) {
my $data = $si->stat_node($node,$opt{start},$opt{end});
print join $opt{separator},$node->{path},map {defined $data->{$_} ? sprintf($opt{format},$data->{$_}) : '?'} @rows;
print "\n";
}
}
main;
__END__
=head1 NAME
smokeinfo - poll smokeping site for numeric information
=head1 SYNOPSIS
B<smokeinfo> path/to/config.cfg [I<options>]
--start x rrd graph start time. (default now-24h)
--end y rrd graph end time. (default now)
--filter pattern search pattern for node selection
--mode plain (default) how to use the pattern
- plain
- recursive
- regexp
--separator ; (default)
--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
=head1 DESCRIPTION
SmokeInfo is a simple frontend to the L<Smokeping::Info> 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
smokeinfo /etc/smokeping/config
Only show nodes directly under /Customers
smokeinfo --filter=/Customers/ /etc/smokeping/config
Show all nodes under /Customers
smokeinfo --mode=recursive --filter=/Customers/ /etc/smokeping/config
Show all nodes with '_wlan_' in the name
smokeinfo --mode=regexp --filter=_wlan_ /etc/smokeping/config
=head1 COPYRIGHT
Copyright (c) 2009 by OETIKER+PARTNER AG. All rights reserved.
=head1 LICENSE
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
=head1 AUTHOR
S<Tobi Oetiker E<lt>tobi@oetiker.chE<gt>>
=head1 HISTORY
2009-01-05 to Initial Version
=cut
# Emacs Configuration
#
# Local Variables:
# mode: cperl
# eval: (cperl-set-style "PerlStyle")
# mode: flyspell
# mode: flyspell-prog
# End:
#
# vi: sw=4 et
|