aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-01-16 12:32:20 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-01-17 11:33:13 +0100
commitb35116711832d2adc04954c56baffab32b400df5 (patch)
tree708315da4973c9020c31fdf2df962a317d54dfac
parent4a3743440bd77aa0cec240e103aa2c7ce954b714 (diff)
stats: Add rate_counter for more statistics on the MTP side
-rw-r--r--include/Makefile.am2
-rw-r--r--include/counter.h47
-rw-r--r--src/Makefile.am5
-rw-r--r--src/counter.c66
4 files changed, 117 insertions, 3 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index a0a54b9..765520b 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,5 +1,5 @@
noinst_HEADERS = mtp_level3.h mtp_data.h ipaccess.h thread.h mtp_pcap.h \
mgcp_ss7.h bss_patch.h bssap_sccp.h bsc_data.h udp_input.h \
- snmp_mtp.h cellmgr_debug.h bsc_sccp.h bsc_ussd.h
+ snmp_mtp.h cellmgr_debug.h bsc_sccp.h bsc_ussd.h counter.h
SUBDIRS = mgcp
diff --git a/include/counter.h b/include/counter.h
new file mode 100644
index 0000000..ea7c5a0
--- /dev/null
+++ b/include/counter.h
@@ -0,0 +1,47 @@
+/* Counter for the Link and Link-Set */
+/*
+ * (C) 2011 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * (C) 2011 by On-Waves
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+#ifndef counter_h
+#define counter_h
+
+#include <osmocore/rate_ctr.h>
+
+enum {
+ MTP_LSET_SLTM_TOUT,
+ MTP_LSET_TOTA_MSG,
+ MTP_LSET_TOTA_IN_MSG,
+ MTP_LSET_SCCP_IN_MSG,
+ MTP_LSET_IUSP_IN_MSG,
+ MTP_LSET_TOTA_OUT_MSG,
+ MTP_LSET_SCCP_OUT_MSG,
+ MTP_LSET_ISUP_OUT_MSG,
+};
+
+enum {
+ MTP_LNK_IN,
+ MTP_LNK_OUT,
+ MTP_LNK_ERROR,
+};
+
+const struct rate_ctr_group_desc *mtp_link_set_rate_ctr_desc();
+const struct rate_ctr_group_desc *mtp_link_rate_ctr_desc();
+
+#endif
diff --git a/src/Makefile.am b/src/Makefile.am
index 83acf8d..a602e00 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,12 +11,13 @@ mgcp_mgw_LDADD = $(LAFORGE_LIBS) $(NEXUSWARE_C7_LIBS) $(NEXUSWARE_UNIPORTE_LIBS)
cellmgr_ng_SOURCES = main.c mtp_layer3.c thread.c input/ipaccess.c pcap.c \
bss_patch.c bssap_sccp.c bsc_sccp.c bsc_ussd.c links.c \
- msc_conn.c link_udp.c snmp_mtp.c debug.c vty_interface.c isup.c
+ msc_conn.c link_udp.c snmp_mtp.c debug.c vty_interface.c \
+ isup.c counter.c
cellmgr_ng_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOSCCP_LIBS) $(LIBOSMOVTY_LIBS) $(NEXUSWARE_C7_LIBS) \
-lpthread -lnetsnmp -lcrypto
udt_relay_SOURCES = main_udt.c mtp_layer3.c thread.c input/ipaccess.c pcap.c \
msc_conn.c link_udp.c snmp_mtp.c debug.c vty_interface.c \
- bss_patch.c isup.c links.c
+ bss_patch.c isup.c links.c counter.c
udt_relay_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOSCCP_LIBS) $(LIBOSMOVTY_LIBS) $(NEXUSWARE_C7_LIBS) \
-lpthread -lnetsnmp -lcrypto
diff --git a/src/counter.c b/src/counter.c
new file mode 100644
index 0000000..7a8a623
--- /dev/null
+++ b/src/counter.c
@@ -0,0 +1,66 @@
+/* Counter for the Link and Link-Set */
+/*
+ * (C) 2011 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * (C) 2011 by On-Waves
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <counter.h>
+
+#include <osmocore/utils.h>
+
+static const struct rate_ctr_desc mtp_lset_cfg_description[] = {
+ [MTP_LSET_SLTM_TOUT] = { "sltm.timeouts", "SLTM timeouts "},
+ [MTP_LSET_TOTA_MSG] = { "total.messages", "Total messages "},
+ [MTP_LSET_TOTA_IN_MSG] = { "total.in", "Total messages in "},
+ [MTP_LSET_SCCP_IN_MSG] = { "sccp.in", "SCCP messages in "},
+ [MTP_LSET_IUSP_IN_MSG] = { "isup.in", "ISUP messages in "},
+ [MTP_LSET_TOTA_OUT_MSG] = { "total.out", "Total messages out "},
+ [MTP_LSET_SCCP_IN_MSG] = { "sccp.out", "SCCP messages out "},
+ [MTP_LSET_IUSP_IN_MSG] = { "isup.out", "ISUP messages out "},
+};
+
+static const struct rate_ctr_desc mtp_link_cfg_description[] = {
+ [MTP_LNK_IN] = { "total.in", "Messages in "},
+ [MTP_LNK_OUT] = { "total.out", "Messages out "},
+ [MTP_LNK_ERROR] = { "total.error", "Errors occured "},
+};
+
+static const struct rate_ctr_group_desc mtp_lset_ctrg_desc = {
+ .group_name_prefix = "mtp_lset",
+ .group_description = "MTP LinkSet",
+ .num_ctr = ARRAY_SIZE(mtp_lset_cfg_description),
+ .ctr_desc = mtp_lset_cfg_description,
+};
+
+static const struct rate_ctr_group_desc mtp_link_ctrg_desc = {
+ .group_name_prefix = "mtp_link",
+ .group_description = "MTP Link",
+ .num_ctr = ARRAY_SIZE(mtp_link_cfg_description),
+ .ctr_desc = mtp_link_cfg_description,
+};
+
+const struct rate_ctr_group_desc *mtp_link_set_rate_ctr_desc()
+{
+ return &mtp_lset_ctrg_desc;
+}
+
+const struct rate_ctr_group_desc *mtp_link_rate_ctr_desc()
+{
+ return &mtp_link_ctrg_desc;
+}