summaryrefslogtreecommitdiffstats
path: root/tapset/linuxmib.stp
diff options
context:
space:
mode:
authorDavid J. Wilder <wilder@wilder.ibm.com>2009-07-16 16:47:01 -0700
committerDavid J. Wilder <wilder@wilder.ibm.com>2009-07-16 16:47:01 -0700
commit5a80613abf2b6e0d50575fcacebb92f415ab2d0f (patch)
treed710c715f21c1231b67c30fc4a7bc5a344a98dc4 /tapset/linuxmib.stp
parent88eaee9fc6d629529e47820525080f26775a9ba6 (diff)
downloadsystemtap-steved-5a80613abf2b6e0d50575fcacebb92f415ab2d0f.tar.gz
systemtap-steved-5a80613abf2b6e0d50575fcacebb92f415ab2d0f.tar.xz
systemtap-steved-5a80613abf2b6e0d50575fcacebb92f415ab2d0f.zip
This SNMP group of tapsets provides probes used to count SNMP management
events. The probes mirror many of the SNMP statistics defined in /usr/include/linux/snmp.h. Each probe represents a single SNMP statistic or MIB. Each of the probe's handler is called when system performs an operation that would alter the associated statistic. Along with each probe is defined an indexed set of counters used to record probe hits. The probe handlers call a user supplied callback functions to determine which counter to alter. The user's callback should returns a key value that will be used to index the counter. For example a callback could return a unique value for each socket. This would results in a separate counter being used for each socket. tcpipstat.stp shows how snmp tapsets could be used. Tcpipstat collects and displays network statistics related to individual TCP sockets or groups of sockets. The statistics that are collected are simmer to that of the command netstat -s, only sorted and grouped by individual sockets. Signed-off-by: David Wilder <dwilder@us.ibm.com>
Diffstat (limited to 'tapset/linuxmib.stp')
-rw-r--r--tapset/linuxmib.stp102
1 files changed, 102 insertions, 0 deletions
diff --git a/tapset/linuxmib.stp b/tapset/linuxmib.stp
new file mode 100644
index 00000000..e19755a9
--- /dev/null
+++ b/tapset/linuxmib.stp
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2009 IBM Corp.
+ * This file is part of systemtap, and is free software. You can
+ * redistribute it and/or modify it under the terms of the GNU General
+ * Public License (GPL); either version 2, or (at your option) any
+ * later version.
+ *
+ * Version 1.0 wilder@us.ibm.com 2009-07-06
+ */
+
+global DelayedACKs /* LINUX_MIB_DELAYEDACKS */
+global ListenOverflows /* LINUX_MIB_LISTENOVERFLOWS */
+global ListenDrops /* LINUX_MIB_LISTENDROPS */
+global TCPMemoryPressures /* LINUX_MIB_TCPMEMORYPRESSURES */
+
+/**
+ * probe tcpmib.DelayedACKs - Count of delayed acks.
+ * @sk: Pointer to the struct sock being acted on.
+ * @op: Value to be added to the counter (Operation).
+ *
+ * Counter Name: DelayedACKs
+ * MIB: LINUX_MIB_DELAYEDACKS
+ *
+ */
+global indelack_timer
+probe linuxmib.DelayedACKs = _linuxmib.DelayedACKs.* {}
+
+probe _linuxmib.DelayedACKs.A = kernel.function("tcp_send_ack")
+{
+ sk=$sk
+ if ( !indelack_timer[sk] ) next
+ op=1
+ key = linuxmib_filter_key(sk,op);
+ if ( key ) DelayedACKs[key] += op;
+}
+
+probe _linuxmib.DelayedACKs.B = kernel.function("tcp_delack_timer")
+{
+ sk=$data
+ indelack_timer[sk]=1
+}
+
+probe _linuxmib.DelayedACKs.C = kernel.function("tcp_delack_timer").return
+{
+ sk=$data
+ indelack_timer[sk]=0;
+}
+
+/**
+ * probe tcpmib.ListenOverflows - Count of times a listen queue overflowed
+ * @sk: Pointer to the struct sock being acted on.
+ * @op: Value to be added to the counter (Operation).
+ *
+ * Counter Name: ListenOverflows
+ * MIB: LINUX_MIB_LISTENOVERFLOWS
+ *
+ */
+probe linuxmib.ListenOverflows=kernel.function("tcp_v4_syn_recv_sock").return
+{
+ sk = $sk
+ if ( $return ) next
+ if ( $sk->sk_ack_backlog <= $sk->sk_max_ack_backlog ) next
+ op = 1;
+ key = linuxmib_filter_key(sk,op);
+ if ( key ) ListenOverflows[key] += op;
+}
+
+/**
+ * probe tcpmib.ListenDrops - Count of times conn request that were dropped.
+ * @sk: Pointer to the struct sock being acted on.
+ * @op: Value to be added to the counter (Operation).
+ *
+ * Counter Name: ListenDrops
+ * MIB: LINUX_MIB_LISTENDROPS
+ *
+ */
+probe linuxmib.ListenDrops=kernel.function("tcp_v4_syn_recv_sock").return
+{
+ sk = $sk
+ if ( $return ) next
+ op = 1;
+ key = linuxmib_filter_key(sk,op);
+ if ( key ) ListenDrops[key] += op;
+}
+
+/**
+ * probe tcpmib.TCPMemoryPressures - Count of times memory pressure was used.
+ * @sk: Pointer to the struct sock being acted on.
+ * @op: Value to be added to the counter (Operation).
+ *
+ * Counter Name: TCPMemoryPressures
+ * MIB: LINUX_MIB_TCPMEMORYPRESSURES
+ *
+ */
+probe linuxmib.TCPMemoryPressures=kernel.function("tcp_enter_memory_pressure")
+{
+ sk = $sk
+ op = 1;
+ if ( $tcp_memory_pressure ) next
+ key = linuxmib_filter_key(sk,op);
+ if ( key ) TCPMemoryPressures[key] += op;
+}