Add uptime property to mod_sofia gateways

The 'UP' status indicates a gateway is online as determined by
registration and/or SIP OPTIONS pinging.

The time the gateway has been in the 'UP' status is recorded,
and can be monitored using 'sofia status' and 'sofia xmlstatus'.

This can be used to detect and graph when there are outages.

ref: FS-6772

Reviewed-by: Travis Cross <tc@traviscross.com>
This commit is contained in:
Steven Ayre
2014-09-03 21:44:11 +01:00
committed by Travis Cross
parent 5fadb52758
commit 93bd5833c2
4 changed files with 11 additions and 2 deletions
+2
View File
@@ -2584,6 +2584,7 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
stream->write_function(stream, "PingState\t%d/%d/%d\n", gp->ping_min, gp->ping_count, gp->ping_max);
stream->write_function(stream, "State \t%s\n", sofia_state_names[gp->state]);
stream->write_function(stream, "Status \t%s%s\n", status_names[gp->status], gp->pinging ? " (ping)" : "");
stream->write_function(stream, "Uptime \t%ld\n", gp->status == SOFIA_GATEWAY_UP ? switch_time_now()-gp->uptime : 0);
stream->write_function(stream, "CallsIN \t%u\n", gp->ib_calls);
stream->write_function(stream, "CallsOUT\t%u\n", gp->ob_calls);
stream->write_function(stream, "FailedCallsIN\t%u\n", gp->ib_failed_calls);
@@ -2827,6 +2828,7 @@ static void xml_gateway_status(sofia_gateway_t *gp, switch_stream_handle_t *stre
stream->write_function(stream, " <pinging>%d</pinging>\n", gp->pinging);
stream->write_function(stream, " <state>%s</state>\n", sofia_state_names[gp->state]);
stream->write_function(stream, " <status>%s</status>\n", status_names[gp->status]);
stream->write_function(stream, " <uptime>%ld</uptime>\n", gp->status == SOFIA_GATEWAY_UP ? switch_time_now()-gp->uptime : 0);
stream->write_function(stream, " <calls-in>%u</calls-in>\n", gp->ib_calls);
stream->write_function(stream, " <calls-out>%u</calls-out>\n", gp->ob_calls);
stream->write_function(stream, " <failed-calls-in>%u</failed-calls-in>\n", gp->ib_failed_calls);