netstat -s output for hpux 11.11 (11i)
list Henrik Størner
On Wed, Apr 05, 2006 at 07:22:00PM +0200, user-bb3e9041f07f@xymon.invalid wrote:
$ uname -r
B.11.11
$ netstat -s
tcp:
90934926 packets sentI already have the "netstat -s" output, but is statistics for TCP/IP. What I'm after right now is statistics about the physical network interfaces - how many bytes have been received and transmitted through the Ethernet network-card. From the public man-pages, it seems this might be the "netstat -in" command. What output does that give on HP-UX ? (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" ?) Regards, Henrik
list Lars Ebeling
It is very hard to get bytes out of HP-UX. Is this an answer for you?
Lars
# lanadmin -g mibstats 0
LAN INTERFACE STATUS DISPLAY
Sun, Apr 23,2006 15:51:14
PPA Number = 0
Description = lan0 Hewlett-Packard LAN Interface Hw Rev
0
Type (value) = ethernet-csmacd(6)
MTU Size = 1500
Speed = 10000000
Station Address = 0x80009a35c3b
Administration Status (value) = up(1)
Operation Status (value) = up(1)
Last Change = 300198077
Inbound Octets = 3111235429
Inbound Unicast Packets = 16596539
Inbound Non-Unicast Packets = 2554519
Inbound Discards = 75971167
Inbound Errors = 27
Inbound Unknown Protocols = 58
Outbound Octets = 3892111463
Outbound Unicast Packets = 118413162
Outbound Non-Unicast Packets = 956287
Outbound Discards = 21849
Outbound Errors = 0
Outbound Queue Length = 0
Specific = 655367
Ethernet-like Statistics Group
Index = 1
Alignment Errors = 0
FCS Errors = 0
Single Collision Frames = 375927
Multiple Collision Frames = 156248
Deferred Transmissions = 27291198
Late Collisions = 0
Excessive Collisions = 0
Internal MAC Transmit Errors = 0
Carrier Sense Errors = 324
Frames Too Long = 0
Internal MAC Receive Errors = 0
▸
----- Original Message -----
From: "Henrik Stoerner" <user-ce4a2c883f75@xymon.invalid>
To: <user-ae9b8668bcde@xymon.invalid>
Sent: Sunday, April 23, 2006 2:16 PM
Subject: [hobbit] Re: netstat -s output for hpux 11.11 (11i)
On Wed, Apr 05, 2006 at 07:22:00PM +0200, user-bb3e9041f07f@xymon.invalid wrote:$ uname -r B.11.11 $ netstat -s tcp: 90934926 packets sentI already have the "netstat -s" output, but is statistics for TCP/IP. What I'm after right now is statistics about the physical network interfaces - how many bytes have been received and transmitted through the Ethernet network-card. From the public man-pages, it seems this might be the "netstat -in" command. What output does that give on HP-UX ? (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" ?) Regards, Henrik
list Henrik Størner
▸
On Sun, Apr 23, 2006 at 03:54:02PM +0200, lars ebeling wrote:
It is very hard to get bytes out of HP-UX. Is this an answer for you?
# lanadmin -g mibstats 0[snip]
PPA Number = 0 Description = lan0 Hewlett-Packard LAN Interface Hw Rev 0 Inbound Octets = 3111235429 Outbound Octets = 3892111463
Ah yes, this is what I'm after. I managed to dig up some HP-UX man-pages, and as far as I can tell you need to use the lanscan command to determine the "PPA" numbers that are valid, and then the lanadmin command above to get the statistics for each interface card. Correct ? In that case, I would think that the HP-UX client code should do something like lanscan -p | while read PPA; do lanadmin -g mibstats $PPA; done Would that work ? And does it require root privs ? Thanks, Henrik
list Lars Ebeling
No, you don't have to be root to use lanadmin to display information. I tested your "script" below and it worked for me, but I only have one PPA. You should have the full path, /usr/sbin to both lanscan and lanadmin, since /usr/sbin is not in the normal users PATH Regards Lars
▸
----- Original Message -----
From: "Henrik Stoerner" <user-ce4a2c883f75@xymon.invalid>
To: <user-ae9b8668bcde@xymon.invalid>
Sent: Sunday, April 23, 2006 6:00 PM
Subject: Re: [hobbit] Re: netstat -s output for hpux 11.11 (11i)
On Sun, Apr 23, 2006 at 03:54:02PM +0200, lars ebeling wrote:It is very hard to get bytes out of HP-UX. Is this an answer for you? # lanadmin -g mibstats 0[snip]PPA Number = 0 Description = lan0 Hewlett-Packard LAN Interface Hw Rev 0 Inbound Octets = 3111235429 Outbound Octets = 3892111463Ah yes, this is what I'm after. I managed to dig up some HP-UX man-pages, and as far as I can tell you need to use the lanscan command to determine the "PPA" numbers that are valid, and then the lanadmin command above to get the statistics for each interface card. Correct ? In that case, I would think that the HP-UX client code should do something like lanscan -p | while read PPA; do lanadmin -g mibstats $PPA; done Would that work ? And does it require root privs ? Thanks, Henrik
list Kevin Pye
And here's some output from a random more complicated network setup.
(It's the server I happened to be logged in to at the time.)
This server has three network interfaces in use. Two are aggregated
together to give a single 2Gbps connection and the other is used as a
single 1Gps connection.
prompt> lanscan -p | while read PPA; do lanadmin -g mibstats $PPA; done
LAN INTERFACE STATUS DISPLAY
Mon, Apr 24,2006 10:00:38
PPA Number = 1
Description = lan1 HP PCI-X 1000Base-T Release B.11.23.05
Type (value) = ethernet-csmacd(6)
MTU Size = 1500
Speed = 1000000000
Station Address = 0x1185ebd29b
Administration Status (value) = up(1)
Operation Status (value) = up(1)
Last Change = 411
Inbound Octets = 14712215
Inbound Unicast Packets = 0
Inbound Non-Unicast Packets = 132446
Inbound Discards = 0
Inbound Errors = 0
Inbound Unknown Protocols = 132446
Outbound Octets = 0
Outbound Unicast Packets = 0
Outbound Non-Unicast Packets = 0
Outbound Discards = 0
▸
Outbound Errors = 0
Outbound Queue Length = 0
Specific = 655367
Ethernet-like Statistics Group
Index = 2
Alignment Errors = 0
FCS Errors = 0
Single Collision Frames = 0
Multiple Collision Frames = 0
Deferred Transmissions = 0
Late Collisions = 0
Excessive Collisions = 0
Internal MAC Transmit Errors = 0
Carrier Sense Errors = 0
Frames Too Long = 0
Internal MAC Receive Errors = 0
LAN INTERFACE STATUS DISPLAY
Mon, Apr 24,2006 10:00:38
PPA Number = 3
Description = lan3 HP PCI-X 1000Base-T Release B.11.23.05
Type (value) = ethernet-csmacd(6)
MTU Size = 1500
Speed = 1000000000
Station Address = 0x1185ebe2c0
Administration Status (value) = up(1)
Operation Status (value) = down(2)
Last Change = 0
Inbound Octets = 0
Inbound Unicast Packets = 0
Inbound Non-Unicast Packets = 0
Inbound Discards = 0
Inbound Errors = 0
Inbound Unknown Protocols = 0
Outbound Octets = 0
Outbound Unicast Packets = 0
Outbound Non-Unicast Packets = 0
Outbound Discards = 0
▸
Outbound Errors = 0
Outbound Queue Length = 0
Specific = 655367
Ethernet-like Statistics Group
Index = 4
Alignment Errors = 0
FCS Errors = 0
Single Collision Frames = 0
Multiple Collision Frames = 0
Deferred Transmissions = 0
Late Collisions = 0
Excessive Collisions = 0
Internal MAC Transmit Errors = 0
Carrier Sense Errors = 0
Frames Too Long = 0
Internal MAC Receive Errors = 0
LAN INTERFACE STATUS DISPLAY
Mon, Apr 24,2006 10:00:38
PPA Number = 4
Description = lan4 HP PCI-X 1000Base-T Release B.11.23.05
Type (value) = ethernet-csmacd(6)
MTU Size = 1500
Speed = 1000000000
Station Address = 0x1185ebe200
Administration Status (value) = up(1)
Operation Status (value) = down(2)
Last Change = 0
Inbound Octets = 0
Inbound Unicast Packets = 0
Inbound Non-Unicast Packets = 0
Inbound Discards = 0
Inbound Errors = 0
Inbound Unknown Protocols = 0
Outbound Octets = 0
Outbound Unicast Packets = 0
Outbound Non-Unicast Packets = 0
Outbound Discards = 0
▸
Outbound Errors = 0
Outbound Queue Length = 0
Specific = 655367
Ethernet-like Statistics Group
Index = 5
Alignment Errors = 0
FCS Errors = 0
Single Collision Frames = 0
Multiple Collision Frames = 0
Deferred Transmissions = 0
Late Collisions = 0
Excessive Collisions = 0
Internal MAC Transmit Errors = 0
Carrier Sense Errors = 0
Frames Too Long = 0
Internal MAC Receive Errors = 0
LAN INTERFACE STATUS DISPLAY
Mon, Apr 24,2006 10:00:38
PPA Number = 900
Description = lan900 Hewlett-Packard LinkAggregate
InterfaceType (value) = ethernet-csmacd(6)
MTU Size = 1500
Speed = 2000000000
Station Address = 0x001185afe673
Administration Status (value) = up(1)
Operation Status (value) = up(1)
Last Change = 414
Inbound Octets = 1124881132
Inbound Unicast Packets = 2452957923
Inbound Non-Unicast Packets = 2263913
Inbound Discards = 0
Inbound Errors = 0
Inbound Unknown Protocols = 178
Outbound Octets = 2426545181
Outbound Unicast Packets = 832427705
Outbound Non-Unicast Packets = 14393
Outbound Discards = 0
Outbound Errors = 0
Outbound Queue Length = 0
Specific = 0
LAN INTERFACE STATUS DISPLAY
Mon, Apr 24,2006 10:00:38
PPA Number = 901
Description = lan901 Hewlett-Packard LinkAggregate
InterfaceType (value) = ethernet-csmacd(6)
MTU Size = 1500
Speed = 1000000000
Station Address = 0x001185ebf229
Administration Status (value) = up(1)
Operation Status (value) = up(1)
Last Change = 421
Inbound Octets = 3900731164
Inbound Unicast Packets = 1276673283
Inbound Non-Unicast Packets = 129024
Inbound Discards = 173544
Inbound Errors = 0
Inbound Unknown Protocols = 4
Outbound Octets = 4293768766
Outbound Unicast Packets = 719623083
Outbound Non-Unicast Packets = 3420
Outbound Discards = 0
Outbound Errors = 0
Outbound Queue Length = 0
Specific = 0
LAN INTERFACE STATUS DISPLAY
Mon, Apr 24,2006 10:00:38
PPA Number = 902
Description = lan902 Hewlett-Packard LinkAggregate
InterfaceType (value) = other(1)
MTU Size = 1500
Speed = 0
Station Address = 0x000000000000
Administration Status (value) = up(1)
Operation Status (value) = down(2)
Last Change = 0
Inbound Octets = 0
Inbound Unicast Packets = 0
Inbound Non-Unicast Packets = 0
Inbound Discards = 0
Inbound Errors = 0
Inbound Unknown Protocols = 0
Outbound Octets = 0
Outbound Unicast Packets = 0
Outbound Non-Unicast Packets = 0
Outbound Discards = 0
Outbound Errors = 0
Outbound Queue Length = 0
Specific = 0
LAN INTERFACE STATUS DISPLAY
Mon, Apr 24,2006 10:00:38
PPA Number = 903
Description = lan903 Hewlett-Packard LinkAggregate
InterfaceType (value) = other(1)
MTU Size = 1500
Speed = 0
Station Address = 0x000000000000
Administration Status (value) = up(1)
Operation Status (value) = down(2)
Last Change = 0
Inbound Octets = 0
Inbound Unicast Packets = 0
Inbound Non-Unicast Packets = 0
Inbound Discards = 0
Inbound Errors = 0
Inbound Unknown Protocols = 0
Outbound Octets = 0
Outbound Unicast Packets = 0
Outbound Non-Unicast Packets = 0
Outbound Discards = 0
Outbound Errors = 0
Outbound Queue Length = 0
Specific = 0
LAN INTERFACE STATUS DISPLAY
Mon, Apr 24,2006 10:00:38
PPA Number = 904
Description = lan904 Hewlett-Packard LinkAggregate
InterfaceType (value) = other(1)
MTU Size = 1500
Speed = 0
Station Address = 0x000000000000
Administration Status (value) = up(1)
Operation Status (value) = down(2)
Last Change = 0
Inbound Octets = 0
Inbound Unicast Packets = 0
Inbound Non-Unicast Packets = 0
Inbound Discards = 0
Inbound Errors = 0
Inbound Unknown Protocols = 0
Outbound Octets = 0
Outbound Unicast Packets = 0
Outbound Non-Unicast Packets = 0
Outbound Discards = 0
Outbound Errors = 0
Outbound Queue Length = 0
Specific = 0
list Dominique Frise
▸
Henrik Stoerner wrote:
On Wed, Apr 05, 2006 at 07:22:00PM +0200, user-bb3e9041f07f@xymon.invalid wrote:$ uname -r B.11.11 $ netstat -s tcp: 90934926 packets sentI already have the "netstat -s" output, but is statistics for TCP/IP. What I'm after right now is statistics about the physical network interfaces - how many bytes have been received and transmitted through the Ethernet network-card. From the public man-pages, it seems this might be the "netstat -in" command. What output does that give on HP-UX ? (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 lo0 16384 <Link#1> 994100 0 96177441 994100 0 96177441 0 lo0 16384 127 127.0.0.1 994100 - 96177441 994100 - 96177441 - lo0 16384 ::1/128 ::1 994100 - 96177441 994100 - 96177441 - lo0 16384 fe80::1%lo0 fe80::1 994100 - 96177441 994100 - 96177441 - gif0* 1280 <Link#2> 0 0 0 0 0 0 0 stf0* 1280 <Link#3> 0 0 0 0 0 0 0 en0 1500 <Link#4> 00:0d:93:9d:eb:3a 2013711826 0 2131205566781 331648829 0 41815551289 0 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 - en1* 1500 <Link#5> 00:0d:93:9d:eb:3b 0 0 0 0 0 0 0 fw0* 4078 <Link#6> 00:14:51:ff:fe:1e:f4:ce 0 0 0 0 0 0 0 Dominique
list Henrik Størner
▸
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: