/usr/lib/xymon/client/ext/netstats is in hobbit-plugins 20170219.
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 | #!/usr/bin/perl
use warnings;
use strict;
use Hobbit;
my @files = ( '/proc/net/snmp', '/proc/net/netstat' );
my $bb = new Hobbit ({ test => 'netstats'});
my $trends = Hobbit::trends();
my %asoc;
my @fields = ( 'Tcp.InErrs' ,
'Tcp.InCsumErrors',
'TcpExt.ListenDrops',
'TcpExt.TCPTimeouts',
'TcpExt.TCPLostRetransmit',
'TcpExt.TCPDSACKRecv',
'TcpExt.TCPDSACKOldSent',
'TcpExt.TCPDSACKOfoSent' );
foreach my $file (@files) {
open (IN, "< $file");
while (my $keyline = <IN>) {
my $valline = <IN>;
$keyline =~ s/^(.*): //;
$valline =~ s/^(.*): //;
chomp($keyline); chomp($valline);
my $module = $1;
my @keys = split(/ /, $keyline);
my @vals = split(/ /, $valline);
$bb->print ("<h2>$module</h2>\n");
for my $i (0 .. $#keys) {
$asoc{$module.'.'.$keys[$i]} = $vals[$i];
$bb->print ($keys[$i]. ": " .$vals[$i]. "\n" );
}
}
close IN;
}
foreach my $field (@fields) {
if (not defined $asoc{$field}) {
next;
}
$trends->print("[netstats,${field}.rrd]\n");
$trends->print("DS:count:DERIVE:600:0:U $asoc{$field}\n");
}
$bb->color_line("green", "OK\n");
$bb->send;
$trends->send;
|