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/11499 Change subject: add MDCX command statistics to osmo-mgw ...................................................................... add MDCX command statistics to osmo-mgw Add a counter group for MDCX commands. The group contains counters for successful connection processing as well as various error conditions. This provides a quick overview of MDCX failures on each trunk throughout the lifetime of the osmo-mgw process. The counters are displayed by 'show mgcp stats' and 'show rate-counters'. Change-Id: I79c27425ba40c3a85edc6cd846cba325d847298c Depends: Ia2004f8063f3a50b5d7a838ebe8a784a47fcc50d Related: OS#2660 --- M include/osmocom/mgcp/mgcp.h M src/libosmo-mgcp/mgcp_protocol.c M src/libosmo-mgcp/mgcp_vty.c 3 files changed, 79 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/99/11499/1 diff --git a/include/osmocom/mgcp/mgcp.h b/include/osmocom/mgcp/mgcp.h index b866f91..c8c2cfd 100644 --- a/include/osmocom/mgcp/mgcp.h +++ b/include/osmocom/mgcp/mgcp.h @@ -137,6 +137,25 @@ MGCP_CRCX_FAIL_BIND_PORT, }; +/* Global MCGP MDCX related rate counters */ +enum { + MGCP_MDCX_SUCCESS, + MGCP_MDCX_FAIL_WILDCARD, + MGCP_MDCX_FAIL_NO_CONN, + MGCP_MDCX_FAIL_INVALID_CALLID, + MGCP_MDCX_FAIL_INVALID_CONNID, + MGCP_MDCX_FAIL_UNHANDLED_PARAM, + MGCP_MDCX_FAIL_NO_CONNID, + MGCP_MDCX_FAIL_CONN_NOT_FOUND, + MGCP_MDCX_FAIL_INVALID_MODE, + MGCP_MDCX_FAIL_INVALID_CONN_OPTIONS, + MGCP_MDCX_FAIL_NO_REMOTE_CONN_DESC, + MGCP_MDCX_FAIL_START_RTP, + MGCP_MDCX_FAIL_REJECTED_BY_POLICY, + MGCP_MDCX_FAIL_DEFERRED_BY_POLICY +}; + + struct mgcp_trunk_config { struct llist_head entry; @@ -177,6 +196,7 @@ /* rate counters */ struct rate_ctr_group *mgcp_crcx_ctr_group; + struct rate_ctr_group *mgcp_mdcx_ctr_group; }; enum mgcp_role { diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c index ccbdfc8..bef5be6 100644 --- a/src/libosmo-mgcp/mgcp_protocol.c +++ b/src/libosmo-mgcp/mgcp_protocol.c @@ -57,7 +57,7 @@ [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_INVALID_MODE] = {"crcx:invalid_mode", "invalid connection 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."}, @@ -78,6 +78,31 @@ .ctr_desc = mgcp_crcx_ctr_desc }; +static const struct rate_ctr_desc mgcp_mdcx_ctr_desc[] = { + [MGCP_MDCX_SUCCESS] = {"mdcx:success", "MDCX command processed successfully."}, + [MGCP_MDCX_FAIL_WILDCARD] = {"mdcx:wildcard", "wildcard endpoint names in MDCX commands are unsupported."}, + [MGCP_MDCX_FAIL_NO_CONN] = {"mdcx:no_conn", "endpoint specified in MDCX command has no active connections."}, + [MGCP_MDCX_FAIL_INVALID_CALLID] = {"mdcx:callid", "invalid CallId specified in MDCX command."}, + [MGCP_MDCX_FAIL_INVALID_CONNID] = {"mdcx:connid", "invalid connection ID specified in MDCX command."}, + [MGCP_MDCX_FAIL_UNHANDLED_PARAM] = {"crcx:unhandled_param", "unhandled parameter in MDCX command."}, + [MGCP_MDCX_FAIL_NO_CONNID] = {"mdcx:no_connid", "no connection ID specified in MDCX command."}, + [MGCP_MDCX_FAIL_CONN_NOT_FOUND] = {"mdcx:conn_not_found", "connection specified in MDCX command does not exist."}, + [MGCP_MDCX_FAIL_INVALID_MODE] = {"mdcx:invalid_mode", "invalid connection mode in MDCX command."}, + [MGCP_MDCX_FAIL_INVALID_CONN_OPTIONS] = {"mdcx:conn_opt", "connection options invalid."}, + [MGCP_MDCX_FAIL_NO_REMOTE_CONN_DESC] = {"mdcx:no_remote_conn_desc", "no opposite end specified for connection."}, + [MGCP_MDCX_FAIL_START_RTP] = {"mdcx:start_rtp_failure", "failure to start RTP processing."}, + [MGCP_MDCX_FAIL_REJECTED_BY_POLICY] = {"mdcx:conn_rejected", "connection rejected by policy."}, + [MGCP_MDCX_FAIL_DEFERRED_BY_POLICY] = {"mdcx:conn_deferred", "connection deferred by policy."}, +}; + +const static struct rate_ctr_group_desc mgcp_mdcx_ctr_group_desc = { + .group_name_prefix = "mdcx", + .group_description = "mdcx statistics", + .class_id = OSMO_STATS_CLASS_GLOBAL, + .num_ctr = ARRAY_SIZE(mgcp_mdcx_ctr_desc), + .ctr_desc = mgcp_mdcx_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); @@ -999,7 +1024,9 @@ /* MDCX command handler, processes the received command */ static struct msgb *handle_modify_con(struct mgcp_parse_data *p) { + struct mgcp_trunk_config *tcfg = p->endp->tcfg; struct mgcp_endpoint *endp = p->endp; + struct rate_ctr_group *rate_ctrs = tcfg->mgcp_mdcx_ctr_group; int error_code = 500; int silent = 0; int have_sdp = 0; @@ -1017,6 +1044,7 @@ LOGP(DLMGCP, LOGL_ERROR, "MDCX: endpoint:0x%x wildcarded endpoint names not supported.\n", ENDPOINT_NUMBER(endp)); + rate_ctr_inc(&rate_ctrs->ctr[MGCP_MDCX_FAIL_WILDCARD]); return create_err_response(endp, 507, "MDCX", p->trans); } @@ -1024,6 +1052,7 @@ LOGP(DLMGCP, LOGL_ERROR, "MDCX: endpoint:0x%x endpoint is not holding a connection.\n", ENDPOINT_NUMBER(endp)); + rate_ctr_inc(&rate_ctrs->ctr[MGCP_MDCX_FAIL_NO_CONN]); return create_err_response(endp, 400, "MDCX", p->trans); } @@ -1034,14 +1063,17 @@ switch (line[0]) { case 'C': if (mgcp_verify_call_id(endp, line + 3) != 0) { + rate_ctr_inc(&rate_ctrs->ctr[MGCP_MDCX_FAIL_INVALID_CALLID]); error_code = 516; goto error3; } break; case 'I': conn_id = (const char *)line + 3; - if ((error_code = mgcp_verify_ci(endp, conn_id))) + if ((error_code = mgcp_verify_ci(endp, conn_id))) { + rate_ctr_inc(&rate_ctrs->ctr[MGCP_MDCX_FAIL_INVALID_CONNID]); goto error3; + } break; case 'L': local_options = (const char *)line + 3; @@ -1060,6 +1092,7 @@ LOGP(DLMGCP, LOGL_NOTICE, "MDCX: endpoint:0x%x Unhandled MGCP option: '%c'/%d\n", ENDPOINT_NUMBER(endp), line[0], line[0]); + rate_ctr_inc(&rate_ctrs->ctr[MGCP_MDCX_FAIL_UNHANDLED_PARAM]); return create_err_response(NULL, 539, "MDCX", p->trans); break; } @@ -1070,15 +1103,19 @@ LOGP(DLMGCP, LOGL_ERROR, "MDCX: endpoint:0x%x insufficient parameters, missing ci (connectionIdentifier)\n", ENDPOINT_NUMBER(endp)); + rate_ctr_inc(&rate_ctrs->ctr[MGCP_MDCX_FAIL_NO_CONNID]); return create_err_response(endp, 515, "MDCX", p->trans); } conn = mgcp_conn_get_rtp(endp, conn_id); - if (!conn) + if (!conn) { + rate_ctr_inc(&rate_ctrs->ctr[MGCP_MDCX_FAIL_CONN_NOT_FOUND]); return create_err_response(endp, 400, "MDCX", p->trans); + } if (mode) { if (mgcp_parse_conn_mode(mode, endp, conn->conn) != 0) { + rate_ctr_inc(&rate_ctrs->ctr[MGCP_MDCX_FAIL_INVALID_MODE]); error_code = 517; goto error3; } @@ -1091,9 +1128,10 @@ &endp->local_options, local_options); if (rc != 0) { LOGP(DLMGCP, LOGL_ERROR, - "MDCX: endpoint:%x inavlid local connection options!\n", + "MDCX: endpoint:%x invalid local connection options!\n", ENDPOINT_NUMBER(endp)); error_code = rc; + rate_ctr_inc(&rate_ctrs->ctr[MGCP_MDCX_FAIL_INVALID_CONN_OPTIONS]); goto error3; } } @@ -1114,12 +1152,15 @@ "MDCX: endpoint:%x selected connection mode type requires an opposite end!\n", ENDPOINT_NUMBER(endp)); error_code = 527; + rate_ctr_inc(&rate_ctrs->ctr[MGCP_MDCX_FAIL_NO_REMOTE_CONN_DESC]); goto error3; } - if (setup_rtp_processing(endp, conn) != 0) + if (setup_rtp_processing(endp, conn) != 0) { + rate_ctr_inc(&rate_ctrs->ctr[MGCP_MDCX_FAIL_START_RTP]); goto error3; + } /* policy CB */ @@ -1132,6 +1173,7 @@ LOGP(DLMGCP, LOGL_NOTICE, "MDCX: endpoint:0x%x rejected by policy\n", ENDPOINT_NUMBER(endp)); + rate_ctr_inc(&rate_ctrs->ctr[MGCP_MDCX_FAIL_REJECTED_BY_POLICY]); if (silent) goto out_silent; return create_err_response(endp, 400, "MDCX", p->trans); @@ -1139,8 +1181,9 @@ case MGCP_POLICY_DEFER: /* stop processing */ LOGP(DLMGCP, LOGL_DEBUG, - "MDCX: endpoint:0x%x defered by policy\n", + "MDCX: endpoint:0x%x deferred by policy\n", ENDPOINT_NUMBER(endp)); + rate_ctr_inc(&rate_ctrs->ctr[MGCP_MDCX_FAIL_DEFERRED_BY_POLICY]); return NULL; break; case MGCP_POLICY_CONT: @@ -1165,6 +1208,7 @@ && endp->tcfg->keepalive_interval != MGCP_KEEPALIVE_NEVER) send_dummy(endp, conn); + rate_ctr_inc(&rate_ctrs->ctr[MGCP_MDCX_SUCCESS]); if (silent) goto out_silent; @@ -1457,6 +1501,11 @@ OSMO_ASSERT(trunk->mgcp_crcx_ctr_group); talloc_set_destructor(trunk->mgcp_crcx_ctr_group, free_rate_counter_group); rate_ctr_index++; + + trunk->mgcp_mdcx_ctr_group = rate_ctr_group_alloc(ctx, &mgcp_mdcx_ctr_group_desc, rate_ctr_index); + OSMO_ASSERT(trunk->mgcp_mdcx_ctr_group); + talloc_set_destructor(trunk->mgcp_mdcx_ctr_group, free_rate_counter_group); + rate_ctr_index++; } /*! allocate configuration with default values. diff --git a/src/libosmo-mgcp/mgcp_vty.c b/src/libosmo-mgcp/mgcp_vty.c index fdcca91..0d81e62 100644 --- a/src/libosmo-mgcp/mgcp_vty.c +++ b/src/libosmo-mgcp/mgcp_vty.c @@ -239,6 +239,10 @@ vty_out(vty, " %s:%s", cfg->mgcp_crcx_ctr_group->desc->group_description, VTY_NEWLINE); vty_out_rate_ctr_group_fmt(vty, " %25n: %10c (%S/s %M/m %H/h %D/d) %d", cfg->mgcp_crcx_ctr_group); } + if (show_stats && cfg->mgcp_mdcx_ctr_group) { + vty_out(vty, " %s:%s", cfg->mgcp_mdcx_ctr_group->desc->group_description, VTY_NEWLINE); + vty_out_rate_ctr_group_fmt(vty, " %25n: %10c (%S/s %M/m %H/h %D/d) %d", cfg->mgcp_mdcx_ctr_group); + } } #define SHOW_MGCP_STR "Display information about the MGCP Media Gateway\n" -- To view, visit https://gerrit.osmocom.org/11499 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: I79c27425ba40c3a85edc6cd846cba325d847298c Gerrit-Change-Number: 11499 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/20181029/98d20254/attachment.htm>