summaryrefslogtreecommitdiff
path: root/accel-pppd/extra
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2013-10-29 20:49:24 +0400
committerDmitry Kozlov <xeb@mail.ru>2013-10-29 20:49:24 +0400
commite68a3f9dd5633f83dc740a71418d66ef6fe7db97 (patch)
tree205f58bbedb453f1e27cbbd59fcc7ac950f0234e /accel-pppd/extra
parentc19c04567bbe0bcd6631485795311cf83a07e5fc (diff)
downloadaccel-ppp-e68a3f9dd5633f83dc740a71418d66ef6fe7db97.tar.gz
accel-ppp-e68a3f9dd5633f83dc740a71418d66ef6fe7db97.zip
net-snmp: add ipoe statistics
Diffstat (limited to 'accel-pppd/extra')
-rw-r--r--accel-pppd/extra/net-snmp/ACCEL-PPP-MIB.txt23
-rw-r--r--accel-pppd/extra/net-snmp/CMakeLists.txt1
-rw-r--r--accel-pppd/extra/net-snmp/statIPOE.c93
-rw-r--r--accel-pppd/extra/net-snmp/statIPOE.h11
4 files changed, 128 insertions, 0 deletions
diff --git a/accel-pppd/extra/net-snmp/ACCEL-PPP-MIB.txt b/accel-pppd/extra/net-snmp/ACCEL-PPP-MIB.txt
index 20f7f941..847a270d 100644
--- a/accel-pppd/extra/net-snmp/ACCEL-PPP-MIB.txt
+++ b/accel-pppd/extra/net-snmp/ACCEL-PPP-MIB.txt
@@ -33,6 +33,7 @@ statPPP OBJECT IDENTIFIER ::= { accelPPPStat 2 }
statPPTP OBJECT IDENTIFIER ::= { accelPPPStat 3 }
statL2TP OBJECT IDENTIFIER ::= { accelPPPStat 4 }
statPPPOE OBJECT IDENTIFIER ::= { accelPPPStat 5 }
+statIPOE OBJECT IDENTIFIER ::= { accelPPPStat 6 }
--statRadius OBJECT IDENTIFIER ::= { accelPPPStat 6 }
@@ -155,6 +156,27 @@ statPPPOEActive OBJECT-TYPE
"count of active connections"
::= { statPPPOE 2 }
+--
+-- IPOE stats
+--
+
+statIPOEStarting OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "count of connections which are
+ in starting phase"
+ ::= { statIPOE 1 }
+
+statIPOEActive OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "count of active connections"
+ ::= { statIPOE 2 }
+
--
-- PPP session table
@@ -227,6 +249,7 @@ sesType OBJECT-TYPE
pptp(1),
l2tp(2),
pppoe(3)
+ ipoe(4)
}
MAX-ACCESS read-only
STATUS current
diff --git a/accel-pppd/extra/net-snmp/CMakeLists.txt b/accel-pppd/extra/net-snmp/CMakeLists.txt
index 7633f371..5571849f 100644
--- a/accel-pppd/extra/net-snmp/CMakeLists.txt
+++ b/accel-pppd/extra/net-snmp/CMakeLists.txt
@@ -10,6 +10,7 @@ SET(sources
statPPP.c
statPPPOE.c
statPPTP.c
+ statIPOE.c
terminate.c
shutdown.c
exec_cli.c
diff --git a/accel-pppd/extra/net-snmp/statIPOE.c b/accel-pppd/extra/net-snmp/statIPOE.c
new file mode 100644
index 00000000..1e156601
--- /dev/null
+++ b/accel-pppd/extra/net-snmp/statIPOE.c
@@ -0,0 +1,93 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.int_watch.conf 13957 2005-12-20 15:33:08Z tanders $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "triton.h"
+#include "statIPOE.h"
+
+/*
+ * The variables we want to tie the relevant OIDs to.
+ * The agent will handle all GET and (if applicable) SET requests
+ * to these variables automatically, changing the values as needed.
+ */
+
+void ipoe_get_stat(unsigned int **, unsigned int **);
+
+static unsigned int *stat_starting;
+static unsigned int *stat_active;
+
+/*
+ * Our initialization routine, called automatically by the agent
+ * (Note that the function name must match init_FILENAME())
+ */
+void
+init_statIPOE(void)
+{
+ netsnmp_handler_registration *reg;
+ netsnmp_watcher_info *winfo;
+
+ static oid statIPOEStarting_oid[] = { 1,3,6,1,4,1,8072,100,1,5,1 };
+ static oid statIPOEActive_oid[] = { 1,3,6,1,4,1,8072,100,1,5,2 };
+
+ /*
+ * a debugging statement. Run the agent with -DstatIPOE to see
+ * the output of this debugging statement.
+ */
+ DEBUGMSGTL(("statIPOE", "Initializing the statIPOE module\n"));
+
+ if (!triton_module_loaded("ipoe"))
+ return;
+
+ ipoe_get_stat(&stat_starting, &stat_active);
+
+ /*
+ * Register scalar watchers for each of the MIB objects.
+ * The ASN type and RO/RW status are taken from the MIB definition,
+ * but can be adjusted if needed.
+ *
+ * In most circumstances, the scalar watcher will handle all
+ * of the necessary processing. But the NULL parameter in the
+ * netsnmp_create_handler_registration() call can be used to
+ * supply a user-provided handler if necessary.
+ *
+ * This approach can also be used to handle Counter64, string-
+ * and OID-based watched scalars (although variable-sized writeable
+ * objects will need some more specialised initialisation).
+ */
+ DEBUGMSGTL(("statIPOE",
+ "Initializing statIPOEStarting scalar integer. Default value = %d\n",
+ 0));
+ reg = netsnmp_create_handler_registration(
+ "statIPOEStarting", NULL,
+ statIPOEStarting_oid, OID_LENGTH(statIPOEStarting_oid),
+ HANDLER_CAN_RONLY);
+ winfo = netsnmp_create_watcher_info(
+ stat_starting, sizeof(*stat_starting),
+ ASN_INTEGER, WATCHER_FIXED_SIZE);
+ if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
+ snmp_log( LOG_ERR, "Failed to register watched statIPOEStarting" );
+ }
+
+ DEBUGMSGTL(("statIPOE",
+ "Initializing statIPOEActive scalar integer. Default value = %d\n",
+ 0));
+ reg = netsnmp_create_handler_registration(
+ "statIPOEActive", NULL,
+ statIPOEActive_oid, OID_LENGTH(statIPOEActive_oid),
+ HANDLER_CAN_RONLY);
+ winfo = netsnmp_create_watcher_info(
+ stat_active, sizeof(*stat_active),
+ ASN_INTEGER, WATCHER_FIXED_SIZE);
+ if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
+ snmp_log( LOG_ERR, "Failed to register watched statIPOEActive" );
+ }
+
+
+ DEBUGMSGTL(("statIPOE",
+ "Done initalizing statIPOE module\n"));
+}
diff --git a/accel-pppd/extra/net-snmp/statIPOE.h b/accel-pppd/extra/net-snmp/statIPOE.h
new file mode 100644
index 00000000..a8e9be75
--- /dev/null
+++ b/accel-pppd/extra/net-snmp/statIPOE.h
@@ -0,0 +1,11 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.int_watch.conf 13957 2005-12-20 15:33:08Z tanders $
+ */
+#ifndef STATPPPOE_H
+#define STATPPPOE_H
+
+/* function declarations */
+void init_statIPOE(void);
+
+#endif /* STATPPPOE_H */