[Xymon] FreeBSD [ifstat] processing
Jeremy Laidman
jlaidman at rebel-it.com.au
Thu Feb 20 03:46:14 CET 2014
On 17 February 2014 23:24, Jeremy Laidman <jlaidman at rebel-it.com.au> wrote:
> On 17 February 2014 18:48, Jeremy Laidman <jlaidman at rebel-it.com.au>wrote:
>
>> For this reason, it seems to make sense that the "link" lines are
>> probably the best for this, as I would think that they would show packets
>> contained only in physical frames (ethernet or some other medium).
>>
>
> So I'm proposing that the FreeBSD client be adjusted from this:
>
> echo "[ifstat]"
> netstat -i -b -n | egrep -v "^lo|<Link"
>
> To this:
>
> echo "[ifstat]"
> netstat -i -b -n | egrep "<Link"
>
> Seem reasonable? Would anyone be adversely impacted by this suggested
> change?
>
Anyone? Nobody else using FreeBSD?
I've implemented a work-around that works for me, by using the following
line in xymonclient-freebsd.sh:
netstat -ibn|egrep "<Link|Name"| grep -v ^lo | while read A B C D E F G; do
[ $A = "Name" ] || { C=0.0.0.0/0; D=0.0.0.0; }; printf "%-5s %5s %-13s
%-17s %12s %6s %14s %14s %6s %14s %6s\n" $A $B $C $D $E $F $G; done
The output now only includes interface lines with "<Link" that are not
loopback devices (thus ignoring all the non-physical entries), and the
"<Link#1>" and MAC address lines have been replaced with dummy values that
parse correctly on the server. I now have useful interface graphs for my
FreeBSD systems.
This is an ugly hack, and I only want this in place until a proper solution
can be implemented.
So, I'm proposing that the xymonclient-freebsd.sh script be modified to use
this line for [ifstat]:
netstat -ibn | egrep "<Link|Name"|grep -v ^lo
(This could leave the loopback addresses in place, and I don't think anyone
would mind.)
Then, the following (untested) patch to do_ifstat.c.
What say ye all?
Cheers
Jeremy
--- do_ifstat.c.orig 2014-02-20 13:35:33.000000000 +1100
+++ do_ifstat.c 2014-02-20 13:42:32.000000000 +1100
@@ -27,8 +27,10 @@
/* Name MTU Network IP Ipkts Ierrs Ibytes Opkts Oerrs
Obytes Coll */
/* lnc0 1500 172.16.10.0/24 172.16.10.151 26 - 1818 26 -
1802 - */
+/* Name MTU Network Address Ipkts Ierrs Ibytes Opkts Oerrs
Obytes Coll */
+/* em0 1500 <Link#1> 00:11:22:33:44:55 26 - 1818 26 -
1802 - */
static const char *ifstat_freebsd_exprs[] = {
-
"^([a-z0-9]+)\\s+\\d+\\s+[0-9.\\/]+\\s+[0-9.]+\\s+\\d+\\s+[0-9-]+\\s+(\\d+)\\s+\\d+\\s+[0-9-]+\\s+(\\d+)\\s+[0-9-]+"
+
"^([a-z0-9]+)\\s+\\d+\\s+<Link#\\d+>\\s+[:0-9]+\\s+\\d+\\s+[0-9-]+\\s+(\\d+)\\s+\\d+\\s+[0-9-]+\\s+(\\d+)\\s+[0-9-]+"
};
/* Name Mtu Network Address Ipkts Ierrs Idrop Ibytes
Opkts Oerrs Obytes Coll */
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20140220/85779e7a/attachment.html>
More information about the Xymon
mailing list