3 * udpstat.d - print UDP statistics. Uses DTrace.
5 * This prints UDP statistics every second, retrieved from the MIB provider.
7 * $Id: udpstat.d 59 2007-10-03 08:21:58Z brendan $
12 * UDP_out UDP datagrams sent
13 * UDP_outErr UDP datagrams errored on send
14 * UDP_in UDP datagrams received
15 * UDP_inErr UDP datagrams undeliverable
16 * UDP_noPort UDP datagrams received to closed ports
18 * The above UDP statistics are documented in the mib2_udp struct
19 * in the /usr/include/inet/mib2.h file; and also in the mib provider
20 * chapter of the DTrace Guide, http://docs.sun.com/db/doc/817-6223.
22 * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
26 * The contents of this file are subject to the terms of the
27 * Common Development and Distribution License, Version 1.0 only
28 * (the "License"). You may not use this file except in compliance
31 * You can obtain a copy of the license at Docs/cddl1.txt
32 * or http://www.opensolaris.org/os/licensing.
33 * See the License for the specific language governing permissions
34 * and limitations under the License.
38 * 25-Jul-2005 Brendan Gregg Created this.
39 * 25-Jul-2005 " " Last update.
42 #pragma D option quiet
49 UDP_in = 0; UDP_out = 0;
50 UDP_inErr = 0; UDP_outErr = 0; UDP_noPort = 0;
57 profile:::tick-1sec { line--; }
62 printf("%11s %11s %11s %11s %11s\n",
63 "UDP_out", "UDP_outErr", "UDP_in", "UDP_inErr", "UDP_noPort");
71 mib:::udp*InDatagrams { UDP_in += arg0; }
72 mib:::udp*OutDatagrams { UDP_out += arg0; }
73 mib:::udpInErrors { UDP_inErr += arg0; }
74 mib:::udpInCksumErrs { UDP_inErr += arg0; }
75 mib:::udpOutErrors { UDP_outErr += arg0; }
76 mib:::udpNoPorts { UDP_noPort += arg0; }
83 printf("%11d %11d %11d %11d %11d\n",
84 UDP_out, UDP_outErr, UDP_in, UDP_inErr, UDP_noPort);