[hobbit] Re: netstat -s output for hpux 11.11 (11i)

Henrik Stoerner henrik at hswn.dk
Mon Apr 24 07:48:41 CEST 2006


On Mon, Apr 24, 2006 at 07:31:03AM +0200, Dominique Frise wrote:
> Henrik Stoerner wrote:
> >(I'd like the same info for Darwin, but I don't know what commands you 
> > must use. If it's like the *BSD systems, perhaps "netstat -i -b -n" ?)
> >
> 
> zelda2:~ root# uname -a
> Darwin zelda2.unil.ch 8.6.0 Darwin Kernel Version 8.6.0: Tue Mar  7 
> 16:58:48 PST 2006; root:xnu-792.6.70.obj~1/RELEASE_PPC Power Macintosh 
> powerpc
> 
> zelda2:~ root# netstat -ibn
> Name  Mtu   Network       Address            Ipkts Ierrs     Ibytes        Opkts   Oerrs Obytes  Coll
> en0   1500  fe80::20d:9 fe80::20d:93ff:fe 2013711826     - 2131205566781 331648829     - 41815551289     -
> en0   1500  130.223.20/24 130.223.20.20   2013711826     - 2131205566781 331648829     - 41815551289     -

Excellent, thanks - it's just like the BSD systems, then.

If you want to try it out, use this patch on top of the 20060423 alfa 
version I sent out yesterday.


Regards,
Henrik

-------------- next part --------------
--- client/hobbitclient-darwin.sh	2006/04/20 07:11:16	1.10
+++ client/hobbitclient-darwin.sh	2006/04/24 05:44:03
@@ -34,6 +34,8 @@
 netstat -r
 echo "[netstat]"
 netstat -s
+echo "[ifstat]"
+netstat -ibn | egrep -v "^lo|<Link"
 echo "[ports]"
 netstat -an|grep "^tcp"
 echo "[ps]"
--- hobbitd/rrd/do_ifstat.c	2006/04/23 16:54:53	1.3
+++ hobbitd/rrd/do_ifstat.c	2006/04/24 05:47:01
@@ -42,6 +42,15 @@
 	"^([a-z0-9]+)\\s+\\d+\\s+[0-9.\\/]+\\s+[0-9.]+\\s+(\\d+)\\s+(\\d+)"
 };
 
+/*
+Name  Mtu   Network       Address            Ipkts Ierrs     Ibytes        Opkts   Oerrs Obytes  Coll
+en0   1500  fe80::20d:9 fe80::20d:93ff:fe 2013711826     - 2131205566781 331648829     - 41815551289     -
+en0   1500  130.223.20/24 130.223.20.20   2013711826     - 2131205566781 331648829     - 41815551289     -
+*/
+static const char *ifstat_darwin_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-]+"
+};
+
 /* dmfe:0:dmfe0:obytes64   107901705585  */
 /* dmfe:0:dmfe0:rbytes64   1224808818952 */
 /* dmfe:1:dmfe1:obytes64   0             */
@@ -90,6 +99,7 @@
 	static pcre **ifstat_freebsd_pcres = NULL;
 	static pcre **ifstat_openbsd_pcres = NULL;
 	static pcre **ifstat_netbsd_pcres = NULL;
+	static pcre **ifstat_darwin_pcres = NULL;
 	static pcre **ifstat_solaris_pcres = NULL;
 	static pcre **ifstat_aix_pcres = NULL;
 	static pcre **ifstat_hpux_pcres = NULL;
@@ -110,6 +120,8 @@
 						 (sizeof(ifstat_openbsd_exprs) / sizeof(ifstat_openbsd_exprs[0])));
 		ifstat_netbsd_pcres = compile_exprs("NETBSD", ifstat_netbsd_exprs, 
 						 (sizeof(ifstat_netbsd_exprs) / sizeof(ifstat_netbsd_exprs[0])));
+		ifstat_darwin_pcres = compile_exprs("DARWIN", ifstat_darwin_exprs, 
+						 (sizeof(ifstat_darwin_exprs) / sizeof(ifstat_darwin_exprs[0])));
 		ifstat_solaris_pcres = compile_exprs("SOLARIS", ifstat_solaris_exprs, 
 						 (sizeof(ifstat_solaris_exprs) / sizeof(ifstat_solaris_exprs[0])));
 		ifstat_aix_pcres = compile_exprs("AIX", ifstat_aix_exprs, 
@@ -191,6 +203,9 @@
 			break;
 
 		  case OS_DARWIN:
+			if (pickdata(bol, ifstat_darwin_pcres[0], &ifname, &rxstr, &txstr)) dmatch = 7;
+			break;
+
 		  case OS_OSF:
 		  case OS_IRIX:
 		  case OS_SNMP:


More information about the Xymon mailing list