From 2acb952670af2e23106b32487382f083753eead1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9sz=C3=A1ros=20Mih=C3=A1ly?= Date: Tue, 7 Jul 2020 20:29:49 +0200 Subject: [PATCH] tidy after PR #517 --- ChangeLog | 5 +++-- README.turnserver | 2 +- configure | 4 ++-- man/man1/turnadmin.1 | 2 +- man/man1/turnserver.1 | 10 +++++++++- man/man1/turnutils.1 | 2 +- src/apps/relay/prom_server.c | 4 ++-- 7 files changed, 19 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5307220a..1ac72709 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,8 @@ 24/06/2020 Oleg Moskalenko Mihály Mészáros Version 4.5.2 'dan Eider': - - Fix null pointer dereference in case of out of memory. (thanks to Thomas Moeller for the report) - + - fix null pointer dereference in case of out of memory. (thanks to Thomas Moeller for the report) + - merge PR #517 (by wolmi) + * add prometheus metrics 24/06/2020 Oleg Moskalenko Mihály Mészáros Version 4.5.1.3 'dan Eider': - merge PR #575: (by osterik) diff --git a/README.turnserver b/README.turnserver index d45930ca..b2064d28 100644 --- a/README.turnserver +++ b/README.turnserver @@ -267,7 +267,7 @@ Flags: initially used by the session). --no-prometheus Disable prometheus metrics. By default it is enabled and listening on port 9121 unther the path /metrics - also the path / on this port can be used as a health check + also the path / on this port can be used as a health check -h Help. diff --git a/configure b/configure index c816ee6c..d11f3717 100755 --- a/configure +++ b/configure @@ -1078,7 +1078,7 @@ if [ -z "${TURN_NO_PROMETHEUS}" ] ; then else ${ECHO_CMD} "ERROR: Libpromhttp development libraries are not installed properly in required location." ${ECHO_CMD} "Prometheus support will be disabled." - ${ECHO_CMD} "See the INSTALL file." + ${ECHO_CMD} "See the INSTALL file." OSCFLAGS="${OSCFLAGS} -DTURN_NO_PROMETHEUS" fi else @@ -1087,7 +1087,7 @@ if [ -z "${TURN_NO_PROMETHEUS}" ] ; then ${ECHO_CMD} "See the INSTALL file." OSCFLAGS="${OSCFLAGS} -DTURN_NO_PROMETHEUS" fi - + else OSCFLAGS="${OSCFLAGS} -DTURN_NO_PROMETHEUS" fi diff --git a/man/man1/turnadmin.1 b/man/man1/turnadmin.1 index 7432c99c..c301131e 100644 --- a/man/man1/turnadmin.1 +++ b/man/man1/turnadmin.1 @@ -1,5 +1,5 @@ .\" Text automatically generated by txt2man -.TH TURN 1 "29 April 2020" "" "" +.TH TURN 1 "08 July 2020" "" "" .SH GENERAL INFORMATION \fIturnadmin\fP is a TURN administration tool. This tool can be used to manage diff --git a/man/man1/turnserver.1 b/man/man1/turnserver.1 index df298c54..33146643 100644 --- a/man/man1/turnserver.1 +++ b/man/man1/turnserver.1 @@ -1,5 +1,5 @@ .\" Text automatically generated by txt2man -.TH TURN 1 "29 April 2020" "" "" +.TH TURN 1 "08 July 2020" "" "" .SH GENERAL INFORMATION The \fBTURN Server\fP project contains the source code of a TURN server and TURN client @@ -396,6 +396,14 @@ The flag that sets the origin consistency check: across the session, all requests must have the same main ORIGIN attribute value (if the ORIGIN was initially used by the session). +.RS +.TP +.B +\fB\-\-no\-prometheus\fP +Disable prometheus metrics. By default it is +enabled and listening on port 9121 unther the path /metrics +also the path / on this port can be used as a health check +.RE .TP .B \fB\-h\fP diff --git a/man/man1/turnutils.1 b/man/man1/turnutils.1 index 01dd4f86..6b4930d4 100644 --- a/man/man1/turnutils.1 +++ b/man/man1/turnutils.1 @@ -1,5 +1,5 @@ .\" Text automatically generated by txt2man -.TH TURN 1 "29 April 2020" "" "" +.TH TURN 1 "08 July 2020" "" "" .SH GENERAL INFORMATION A set of turnutils_* programs provides some utility functionality to be used diff --git a/src/apps/relay/prom_server.c b/src/apps/relay/prom_server.c index 368e3e7a..ec395125 100644 --- a/src/apps/relay/prom_server.c +++ b/src/apps/relay/prom_server.c @@ -36,7 +36,7 @@ int start_prometheus_server(void){ turn_total_traffic_peer_sentb = prom_collector_registry_must_register_metric(prom_counter_new("turn_total_traffic_peer_sentb", "Represents total peer sent bytes", 3, (const char *[]) {"realm", "user", "allocation" })); promhttp_set_active_collector_registry(NULL); - + struct MHD_Daemon *daemon = promhttp_start_daemon(MHD_USE_SELECT_INTERNALLY, DEFAULT_PROM_SERVER_PORT, NULL, NULL); if (daemon == NULL) { @@ -49,7 +49,7 @@ void prom_set_status(const char* realm, const char* user, unsigned long long all if (turn_params.prometheus == 1){ char allocation_chars[1024]; char lifetime_chars[1024]; - + snprintf(allocation_chars, sizeof(allocation_chars), "%018llu", allocation); snprintf(lifetime_chars, sizeof(lifetime_chars), "%lu", lifetime);