This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Stefan Sperling gerrit-no-reply at lists.osmocom.orgStefan Sperling has uploaded this change for review. ( https://gerrit.osmocom.org/11463 Change subject: add MGCP CRCX command statistics to osmo-mgw ...................................................................... add MGCP CRCX command statistics to osmo-mgw Add a counter group for CRCX commands. The group contains counters for successful connection processing as well as various error conditions. This provides a quick overview of CRCX failures on each trunk throughout the lifetime of the osmo-mgw process. For example, after running the TTCN3 mgw test suite, the counters show the following values: OsmoMGW> show rate-counters crxc statistics for trunk 0: crcx:success: 88 (0/s 88/m 0/h 0/d) CRCX command processed successfully. crcx:bad_action: 0 (0/s 0/m 0/h 0/d) bad action in CRCX command. crcx:unhandled_param: 1 (0/s 1/m 0/h 0/d) unhandled parameter in CRCX command. crcx:missing_callid: 1 (0/s 1/m 0/h 0/d) missing CallId in CRCX command. crcx:invalid_mode: 1 (0/s 1/m 0/h 0/d) connection invalid mode in CRCX command. crcx:limit_exceeded: 0 (0/s 0/m 0/h 0/d) limit of concurrent connections was reached. crcx:unkown_callid: 0 (0/s 0/m 0/h 0/d) unknown CallId in CRCX command. crcx:alloc_conn_fail: 0 (0/s 0/m 0/h 0/d) connection allocation failure. crcx:no_remote_conn_desc: 1 (0/s 1/m 0/h 0/d) no opposite end specified for connection. crcx:start_rtp_failure: 0 (0/s 0/m 0/h 0/d) failure to start RTP processing. crcx:conn_rejected: 0 (0/s 0/m 0/h 0/d) connection rejected by policy. OsmoMGW> With input from Philipp Maier. Change-Id: Ida82fc340d5c66180e5fe9a0d195e9be6dc64c61 Depends: I027644f4b913e1f966c11b081e9027e61591a224 Related: OS#2660 --- M include/osmocom/mgcp/mgcp.h M src/libosmo-mgcp/mgcp_protocol.c 2 files changed, 78 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/63/11463/1 diff --git a/include/osmocom/mgcp/mgcp.h b/include/osmocom/mgcp/mgcp.h index bdc86fc..f9f0ac7 100644 --- a/include/osmocom/mgcp/mgcp.h +++ b/include/osmocom/mgcp/mgcp.h @@ -118,6 +118,21 @@ #define MGCP_KEEPALIVE_ONCE (-1) #define MGCP_KEEPALIVE_NEVER 0 +/* Global MCGP CRCX related rate counters */ +enum { + MGCP_CRCX_SUCCESS, + MGCP_CRCX_FAIL_BAD_ACTION, + MGCP_CRCX_FAIL_UNHANDLED_PARAM, + MGCP_CRCX_FAIL_MISSING_CALLID, + MGCP_CRCX_FAIL_INVALID_MODE, + MGCP_CRCX_FAIL_LIMIT_EXCEEDED, + MGCP_CRCX_FAIL_UNKNOWN_CALLID, + MGCP_CRCX_FAIL_ALLOC_CONN, + MGCP_CRCX_FAIL_NO_REMOTE_CONN_DESC, + MGCP_CRCX_FAIL_START_RTP, + MGCP_CRCX_FAIL_REJECTED_BY_POLICY, +}; + struct mgcp_trunk_config { struct llist_head entry; @@ -155,6 +170,9 @@ unsigned int number_endpoints; int vty_number_endpoints; struct mgcp_endpoint *endpoints; + + /* rate counters */ + struct rate_ctr_group *mgcp_crcx_ctr_group; }; enum mgcp_role { diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c index e17bdae..63e76cd 100644 --- a/src/libosmo-mgcp/mgcp_protocol.c +++ b/src/libosmo-mgcp/mgcp_protocol.c @@ -32,6 +32,7 @@ #include <osmocom/core/msgb.h> #include <osmocom/core/talloc.h> #include <osmocom/core/select.h> +#include <osmocom/core/stats.h> #include <osmocom/mgcp/mgcp.h> #include <osmocom/mgcp/mgcp_common.h> @@ -51,6 +52,28 @@ #define MGCP_REQUEST(NAME, REQ, DEBUG_NAME) \ { .name = NAME, .handle_request = REQ, .debug_name = DEBUG_NAME }, +static const struct rate_ctr_desc mgcp_crcx_ctr_desc[] = { + [MGCP_CRCX_SUCCESS] = {"crcx:success", "CRCX command processed successfully."}, + [MGCP_CRCX_FAIL_BAD_ACTION] = {"crcx:bad_action", "bad action in CRCX command."}, + [MGCP_CRCX_FAIL_UNHANDLED_PARAM] = {"crcx:unhandled_param", "unhandled parameter in CRCX command."}, + [MGCP_CRCX_FAIL_MISSING_CALLID] = {"crcx:missing_callid", "missing CallId in CRCX command."}, + [MGCP_CRCX_FAIL_INVALID_MODE] = {"crcx:invalid_mode", "connection invalid mode in CRCX command."}, + [MGCP_CRCX_FAIL_LIMIT_EXCEEDED] = {"crcx:limit_exceeded", "limit of concurrent connections was reached."}, + [MGCP_CRCX_FAIL_UNKNOWN_CALLID] = {"crcx:unkown_callid", "unknown CallId in CRCX command."}, + [MGCP_CRCX_FAIL_ALLOC_CONN] = {"crcx:alloc_conn_fail", "connection allocation failure."}, + [MGCP_CRCX_FAIL_NO_REMOTE_CONN_DESC] = {"crcx:no_remote_conn_desc", "no opposite end specified for connection."}, + [MGCP_CRCX_FAIL_START_RTP] = {"crcx:start_rtp_failure", "failure to start RTP processing."}, + [MGCP_CRCX_FAIL_REJECTED_BY_POLICY] = {"crcx:conn_rejected", "connection rejected by policy."}, +}; + +const static struct rate_ctr_group_desc mgcp_crcx_ctr_group_desc = { + .group_name_prefix = "crcx", + .group_description = "crxc statistics", + .class_id = OSMO_STATS_CLASS_GLOBAL, + .num_ctr = ARRAY_SIZE(mgcp_crcx_ctr_desc), + .ctr_desc = mgcp_crcx_ctr_desc +}; + static struct msgb *handle_audit_endpoint(struct mgcp_parse_data *data); static struct msgb *handle_create_con(struct mgcp_parse_data *data); static struct msgb *handle_delete_con(struct mgcp_parse_data *data); @@ -701,7 +724,7 @@ /* CRCX command handler, processes the received command */ static struct msgb *handle_create_con(struct mgcp_parse_data *p) { - struct mgcp_trunk_config *tcfg; + struct mgcp_trunk_config *tcfg = p->endp->tcfg; struct mgcp_endpoint *endp = p->endp; int error_code = 400; @@ -733,6 +756,7 @@ /* It is illegal to send a connection identifier * together with a CRCX, the MGW will assign the * connection identifier by itself on CRCX */ + rate_ctr_inc(&tcfg->mgcp_crcx_ctr_group->ctr[MGCP_CRCX_FAIL_BAD_ACTION]); return create_err_response(NULL, 523, "CRCX", p->trans); break; case 'M': @@ -759,19 +783,19 @@ LOGP(DLMGCP, LOGL_NOTICE, "CRCX: endpoint:%x unhandled option: '%c'/%d\n", ENDPOINT_NUMBER(endp), *line, *line); + rate_ctr_inc(&tcfg->mgcp_crcx_ctr_group->ctr[MGCP_CRCX_FAIL_UNHANDLED_PARAM]); return create_err_response(NULL, 539, "CRCX", p->trans); break; } } mgcp_header_done: - tcfg = p->endp->tcfg; - /* Check parameters */ if (!callid) { LOGP(DLMGCP, LOGL_ERROR, "CRCX: endpoint:%x insufficient parameters, missing callid\n", ENDPOINT_NUMBER(endp)); + rate_ctr_inc(&tcfg->mgcp_crcx_ctr_group->ctr[MGCP_CRCX_FAIL_MISSING_CALLID]); return create_err_response(endp, 516, "CRCX", p->trans); } @@ -779,6 +803,7 @@ LOGP(DLMGCP, LOGL_ERROR, "CRCX: endpoint:%x insufficient parameters, missing mode\n", ENDPOINT_NUMBER(endp)); + rate_ctr_inc(&tcfg->mgcp_crcx_ctr_group->ctr[MGCP_CRCX_FAIL_INVALID_MODE]); return create_err_response(endp, 517, "CRCX", p->trans); } @@ -795,6 +820,7 @@ } else { /* There is no more room for a connection, leave * everything as it is and return with an error */ + rate_ctr_inc(&tcfg->mgcp_crcx_ctr_group->ctr[MGCP_CRCX_FAIL_LIMIT_EXCEEDED]); return create_err_response(endp, 540, "CRCX", p->trans); } } @@ -812,6 +838,7 @@ else { /* This is not our call, leave everything as it is and * return with an error. */ + rate_ctr_inc(&tcfg->mgcp_crcx_ctr_group->ctr[MGCP_CRCX_FAIL_UNKNOWN_CALLID]); return create_err_response(endp, 400, "CRCX", p->trans); } } @@ -827,6 +854,7 @@ LOGP(DLMGCP, LOGL_ERROR, "CRCX: endpoint:0x%x unable to allocate RTP connection\n", ENDPOINT_NUMBER(endp)); + rate_ctr_inc(&tcfg->mgcp_crcx_ctr_group->ctr[MGCP_CRCX_FAIL_ALLOC_CONN]); goto error2; } @@ -890,6 +918,7 @@ "CRCX: endpoint:%x selected connection mode type requires an opposite end!\n", ENDPOINT_NUMBER(endp)); error_code = 527; + rate_ctr_inc(&tcfg->mgcp_crcx_ctr_group->ctr[MGCP_CRCX_FAIL_NO_REMOTE_CONN_DESC]); goto error2; } @@ -901,6 +930,7 @@ LOGP(DLMGCP, LOGL_ERROR, "CRCX: endpoint:0x%x could not start RTP processing!\n", ENDPOINT_NUMBER(endp)); + rate_ctr_inc(&tcfg->mgcp_crcx_ctr_group->ctr[MGCP_CRCX_FAIL_START_RTP]); goto error2; } @@ -915,6 +945,7 @@ "CRCX: endpoint:0x%x CRCX rejected by policy\n", ENDPOINT_NUMBER(endp)); mgcp_endp_release(endp); + rate_ctr_inc(&tcfg->mgcp_crcx_ctr_group->ctr[MGCP_CRCX_FAIL_REJECTED_BY_POLICY]); return create_err_response(endp, 400, "CRCX", p->trans); break; case MGCP_POLICY_DEFER: @@ -942,6 +973,7 @@ LOGP(DLMGCP, LOGL_NOTICE, "CRCX: endpoint:0x%x connection successfully created\n", ENDPOINT_NUMBER(endp)); + rate_ctr_inc(&tcfg->mgcp_crcx_ctr_group->ctr[MGCP_CRCX_SUCCESS]); return create_response_with_sdp(endp, conn, "CRCX", p->trans, true); error2: mgcp_endp_release(endp); @@ -1439,6 +1471,25 @@ return cfg; } +static void alloc_mgcp_crxc_rate_counters(struct mgcp_trunk_config *trunk, void *ctx) +{ + /* FIXME: Each new rate counter group requires a unique index. At the + * moment we generate an index using a counter, but perhaps there is + * a better way of assigning indices? */ + static unsigned int rate_ctr_index = 0; + struct rate_ctr_group_desc *rate_ctrs; + + rate_ctrs = talloc(ctx, struct rate_ctr_group_desc); + OSMO_ASSERT(rate_ctrs); + memcpy(rate_ctrs, &mgcp_crcx_ctr_group_desc, sizeof(*rate_ctrs)); + rate_ctrs->group_description = talloc_asprintf(ctx, "%s for trunk %d", + mgcp_crcx_ctr_group_desc.group_description, trunk->trunk_nr); + OSMO_ASSERT(rate_ctrs->group_description); + trunk->mgcp_crcx_ctr_group = rate_ctr_group_alloc(ctx, rate_ctrs, rate_ctr_index); + OSMO_ASSERT(trunk->mgcp_crcx_ctr_group); + rate_ctr_index++; +} + /*! allocate configuration with default values. * (called once at startup by VTY) * \param[in] cfg mgcp configuration @@ -1465,6 +1516,9 @@ trunk->omit_rtcp = 0; mgcp_trunk_set_keepalive(trunk, MGCP_KEEPALIVE_ONCE); llist_add_tail(&trunk->entry, &cfg->trunks); + + alloc_mgcp_crxc_rate_counters(trunk, trunk); + return trunk; } @@ -1509,6 +1563,9 @@ } tcfg->number_endpoints = tcfg->vty_number_endpoints; + + alloc_mgcp_crxc_rate_counters(tcfg, tcfg->cfg); + return 0; } -- To view, visit https://gerrit.osmocom.org/11463 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Ida82fc340d5c66180e5fe9a0d195e9be6dc64c61 Gerrit-Change-Number: 11463 Gerrit-PatchSet: 1 Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181025/5701e53c/attachment.htm>