Kaynağa Gözat

Disable prometheus by default

Mészáros Mihály 5 yıl önce
ebeveyn
işleme
c9cd99e4f5
7 değiştirilmiş dosya ile 105 ekleme ve 105 silme
  1. 1 1
      README.md
  2. 11 5
      configure
  3. 4 4
      examples/etc/turnserver.conf
  4. 15 17
      man/man1/turnadmin.1
  5. 39 40
      man/man1/turnserver.1
  6. 29 32
      man/man1/turnutils.1
  7. 6 6
      src/apps/relay/mainrelay.c

+ 1 - 1
README.md

@@ -70,7 +70,7 @@ Supported user databases (for user repository, with passwords or keys, if authen
 
 Redis can also be used for status and statistics storage and notification.
 
-By default a [prometheus](https://prometheus.io/) exporter endpoint is enabled on port 9121 under path /metrics
+By default a [prometheus](https://prometheus.io/) exporter endpoint is disabled, if it is enabeled it will listen on port 9121 under path /metrics
 
 Supported message integrity digest algorithms:
 

+ 11 - 5
configure

@@ -1070,21 +1070,27 @@ if [ -z "${TURN_NO_PROMETHEUS}" ] ; then
 			if ! [ ${ER} -eq 0 ] ; then
 				${ECHO_CMD} "Microhttpd lib found."
 			else
-				${ECHO_CMD} "ERROR: microhttpd development libraries are not installed properly in required location."
+				${ECHO_CMD}
+				${ECHO_CMD} "Warning: microhttpd development libraries are not installed properly in required location."
 				${ECHO_CMD} "Prometheus support will be disabled."
 				${ECHO_CMD} "See the INSTALL file."
+				${ECHO_CMD}
 				OSCFLAGS="${OSCFLAGS} -DTURN_NO_PROMETHEUS"
 			fi
 		else
-			${ECHO_CMD} "ERROR: Libpromhttp development libraries are not installed properly in required location."
+			${ECHO_CMD}
+			${ECHO_CMD} "Warning: 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."
+			${ECHO_CMD}
 			OSCFLAGS="${OSCFLAGS} -DTURN_NO_PROMETHEUS"
 		fi
 	else
-        ${ECHO_CMD} "\nERROR: Libprom development libraries are not installed properly in required location."
+		${ECHO_CMD}
+		${ECHO_CMD} "Warning: Libprom development libraries are not installed properly in required location."
 		${ECHO_CMD} "Prometheus support will be disabled."
-        ${ECHO_CMD} "See the INSTALL file.\n"
+		${ECHO_CMD} "See the INSTALL file."
+		${ECHO_CMD}
 		OSCFLAGS="${OSCFLAGS} -DTURN_NO_PROMETHEUS"
 	fi
 

+ 4 - 4
examples/etc/turnserver.conf

@@ -186,9 +186,9 @@
 #
 #no-auth
 
-# Disable prometheus exporter
-# By default the turnserver will expose an endpoint with stats on a prometheus format
-# this endpoint is on a different port to conflict with other configurations.
+# Enable prometheus exporter
+# If enabled the turnserver will expose an endpoint with stats on a prometheus format
+# this endpoint is listening on a different port to not conflict with other configurations.
 #
 # You can simply run the turnserver and access the port 9121 and path /metrics
 #
@@ -196,7 +196,7 @@
 # https://prometheus.io/docs/introduction/overview/
 # https://prometheus.io/docs/concepts/data_model/
 #
-# no-prometheus
+#prometheus
 
 # TURN REST API flag.
 # (Time Limited Long Term Credential)

+ 15 - 17
man/man1/turnadmin.1

@@ -1,5 +1,5 @@
 .\" Text automatically generated by txt2man
-.TH TURN 1 "08 July 2020" "" ""
+.TH TURN 1 "28 July 2020" "" ""
 .SH GENERAL INFORMATION
 
 \fIturnadmin\fP is a TURN administration tool. This tool can be used to manage
@@ -48,8 +48,8 @@ is equivalent to:
 .fi
 You have always the use the \fB\-r\fP <realm> option with commands for long term credentials \-
 because data for multiple realms can be stored in the same database.
-.PP
-=====================================
+.SH =====================================
+
 .SS  NAME
 \fB
 \fBturnadmin \fP\- a TURN relay administration tool.
@@ -288,8 +288,8 @@ $ \fIturnadmin\fP \fB\-\-file\-key\-path\fP <key\-file> \fB\-v\fP <encrypted>
 Help:
 .PP
 $ \fIturnadmin\fP \fB\-h\fP
-.PP
-=======================================
+.SH =======================================
+
 .SS  DOCS
 
 After installation, run the \fIcommand\fP:
@@ -301,8 +301,8 @@ or in the project root directory:
 $ man \fB\-M\fP man \fIturnadmin\fP
 .PP
 to see the man page.
-.PP
-=====================================
+.SH =====================================
+
 .SS  FILES
 
 /etc/turnserver.conf
@@ -314,8 +314,8 @@ to see the man page.
 /var/lib/turn/turndb
 .PP
 /usr/local/etc/turnserver.conf
-.PP
-=====================================
+.SH =====================================
+
 .SS  DIRECTORIES
 
 /usr/local/share/\fIturnserver\fP
@@ -323,14 +323,13 @@ to see the man page.
 /usr/local/share/doc/\fIturnserver\fP
 .PP
 /usr/local/share/examples/\fIturnserver\fP
-.PP
-======================================
+.SH ======================================
+
 .SS  SEE ALSO
 
 \fIturnserver\fP, \fIturnutils\fP
-.RE
-.PP
-======================================
+.SH ======================================
+
 .SS  WEB RESOURCES
 
 project page:
@@ -344,9 +343,8 @@ https://github.com/coturn/coturn/wiki
 forum:
 .PP
 https://groups.google.com/forum/?fromgroups=#!forum/turn\-server\-project\-rfc5766\-turn\-server/
-.RE
-.PP
-======================================
+.SH ======================================
+
 .SS  AUTHORS
 
 Oleg Moskalenko <[email protected]>

+ 39 - 40
man/man1/turnserver.1

@@ -1,5 +1,5 @@
 .\" Text automatically generated by txt2man
-.TH TURN 1 "08 July 2020" "" ""
+.TH TURN 1 "28 July 2020" "" ""
 .SH GENERAL INFORMATION
 
 The \fBTURN Server\fP project contains the source code of a TURN server and TURN client
@@ -78,7 +78,8 @@ is equivalent to:
 
 .fam T
 .fi
-=====================================
+.SH =====================================
+
 .SS  NAME
 \fB
 \fBturnserver \fP\- a TURN relay server implementation.
@@ -839,15 +840,15 @@ By default it is disabled for security resons!
 .B
 \fB\-\-ne\fP=[1|2|3]
 Set network engine type for the process (for internal purposes).
-.PP
-==================================
+.SH ==================================
+
 .SH LOAD BALANCE AND PERFORMANCE TUNING
 
 This topic is covered in the wiki page:
 .PP
 https://github.com/coturn/coturn/wiki/turn_performance_and_load_balance
-.PP
-===================================
+.SH ===================================
+
 .SH WEBRTC USAGE
 
 This is a set of notes for the WebRTC users:
@@ -884,8 +885,8 @@ Usually WebRTC uses fingerprinting (\fB\-f\fP).
 .IP 5) 4
 \fB\-\-min\-port\fP and \fB\-\-max\-port\fP may be needed if you want to limit the relay endpoints ports
 number range.
-.PP
-===================================
+.SH ===================================
+
 .SH TURN REST API
 
 In WebRTC, the browser obtains the TURN connection information from the web
@@ -1023,8 +1024,8 @@ examples/scripts/restapi/shared_secret_maintainer.pl .
 .PP
 A very important thing is that the nonce must be totally random and it must be
 different for different clients and different sessions.
-.PP
-===================================
+.SH ===================================
+
 .SH DATABASES
 
 For the user database, the \fIturnserver\fP has the following \fIoptions\fP:
@@ -1087,8 +1088,8 @@ it will set the users for you (see the \fIturnadmin\fP manuals). If you are usin
 \fIturnserver\fP or \fIturnadmin\fP will initialize the empty database, for you, when started. The
 TURN server installation process creates an empty initialized SQLite database in the default
 location (/var/db/turndb or /usr/local/var/db/turndb or /var/lib/turn/turndb, depending on the system).
-.PP
-=================================
+.SH =================================
+
 .SH ALPN
 
 The server supports ALPNs "stun.turn" and "stun.nat\-discovery", when
@@ -1097,16 +1098,16 @@ ClientHello message that contains one or both of those ALPNs, then the
 server chooses the first stun.* label and sends it back (in the ServerHello)
 in the ALPN extension field. If no stun.* label is found, then the server
 does not include the ALPN information into the ServerHello.
-.PP
-=================================
+.SH =================================
+
 .SH LIBRARIES
 
 In the lib/ sub\-directory the build process will create TURN client messaging library.
 In the include/ sub\-directory, the necessary include files will be placed.
 The C++ wrapper for the messaging functionality is located in TurnMsgLib.h header.
 An example of C++ code can be found in stunclient.c file.
-.PP
-=================================
+.SH =================================
+
 .SH DOCS
 
 After installation, run the command:
@@ -1121,8 +1122,8 @@ to see the man page.
 .PP
 In the docs/html subdirectory of the original archive tree, you will find the client library
 reference. After the installation, it will be placed in PREFIX/share/doc/\fIturnserver\fP/html.
-.PP
-=================================
+.SH =================================
+
 .SH LOGS
 
 When the \fBTURN Server\fP starts, it makes efforts to create a log file turn_<pid>.log
@@ -1145,8 +1146,8 @@ log messages are sent only to the standard output of the process.
 .PP
 This behavior can be controlled by \fB\-\-log\-file\fP, \fB\-\-syslog\fP and \fB\-\-no\-stdout\-log\fP
 \fIoptions\fP.
-.PP
-=================================
+.SH =================================
+
 .SH HTTPS MANAGEMENT INTERFACE
 
 The \fIturnserver\fP process provides an HTTPS Web access as statistics and basic
@@ -1159,8 +1160,8 @@ populated with the admin user \fBaccount\fP(s). An admin user can be a superuser
 (if not assigned to a particular realm) or a restricted user (if assigned to
 a realm). The restricted admin users can perform only limited actions, within
 their corresponding realms.
-.PP
-=================================
+.SH =================================
+
 .SH TELNET CLI
 
 The \fIturnserver\fP process provides a telnet CLI access as statistics and basic management
@@ -1168,8 +1169,8 @@ interface. By default, the \fIturnserver\fP starts a telnet CLI listener on IP 1
 port 5766. That can be changed by the command\-cline \fIoptions\fP of the \fIturnserver\fP process
 (see \fB\-\-cli\-ip\fP and \fB\-\-cli\-port\fP \fIoptions\fP). The full list of telnet CLI commands is provided
 in "help" command output in the telnet CLI.
-.PP
-=================================
+.SH =================================
+
 .SH CLUSTERS
 
 \fBTURN Server\fP can be a part of the cluster installation. But, to support the "even port" functionality
@@ -1178,8 +1179,8 @@ in "help" command output in the telnet CLI.
 the RTP and RTCP relaying endpoints must be allocated on the same relay IP. It would be possible
 to design a scheme with the application\-level requests forwarding (and we may do that later) but
 it would affect the performance.
-.PP
-=================================
+.SH =================================
+
 .SH FILES
 
 /etc/turnserver.conf
@@ -1191,8 +1192,8 @@ it would affect the performance.
 /var/lib/turn/turndb
 .PP
 /usr/local/etc/turnserver.conf
-.PP
-=================================
+.SH =================================
+
 .SH DIRECTORIES
 
 /usr/local/share/\fIturnserver\fP
@@ -1200,16 +1201,15 @@ it would affect the performance.
 /usr/local/share/doc/\fIturnserver\fP
 .PP
 /usr/local/share/examples/\fIturnserver\fP
-.PP
-=================================
+.SH =================================
+
 .SH STANDARDS
 
 obsolete STUN RFC 3489
 .PP
 new STUN RFC 5389
-.PP
-TURN RFC 5766
-.PP
+.SH TURN RFC 5766
+
 TURN\-TCP extension RFC 6062
 .PP
 TURN IPv6 extension RFC 6156
@@ -1217,14 +1217,13 @@ TURN IPv6 extension RFC 6156
 STUN/TURN test vectors RFC 5769
 .PP
 STUN NAT behavior discovery RFC 5780
-.PP
-=================================
+.SH =================================
+
 .SH SEE ALSO
 
 \fIturnadmin\fP, \fIturnutils\fP
-.RE
-.PP
-======================================
+.SH ======================================
+
 .SS  WEB RESOURCES
 
 project page:
@@ -1238,8 +1237,8 @@ https://github.com/coturn/coturn/wiki
 forum:
 .PP
 https://groups.google.com/forum/?fromgroups=#!forum/turn\-server\-project\-rfc5766\-turn\-server
-.PP
-======================================
+.SH ======================================
+
 .SS  AUTHORS
 
 Oleg Moskalenko <[email protected]>

+ 29 - 32
man/man1/turnutils.1

@@ -1,5 +1,5 @@
 .\" Text automatically generated by txt2man
-.TH TURN 1 "08 July 2020" "" ""
+.TH TURN 1 "28 July 2020" "" ""
 .SH GENERAL INFORMATION
 
 A set of turnutils_* programs provides some utility functionality to be used
@@ -63,8 +63,8 @@ script in examples/scripts/oauth.sh.
 .RE
 .PP
 
-.RS
-=====================================
+.SH =====================================
+
 .SS  NAME
 \fB
 \fBturnutils_uclient \fP\- this client emulation application is supplied for the test purposes only.
@@ -276,8 +276,8 @@ the ORIGIN STUN attribute value.
 Bandwidth for the bandwidth request in ALLOCATE. The default value is zero.
 .PP
 See the examples in the "examples/scripts" directory.
-.PP
-======================================
+.SH ======================================
+
 .SS  NAME
 \fB
 \fBturnutils_peer \fP\- a simple UDP\-only echo backend server.
@@ -314,8 +314,8 @@ If no listener \fBaddress\fP(es) defined, then it listens on all IPv4 and IPv6 a
 .B
 \fB\-v\fP
 Verbose
-.PP
-========================================
+.SH ========================================
+
 .SS  NAME
 \fB
 \fBturnutils_stunclient \fP\- a basic STUN client.
@@ -354,8 +354,8 @@ and if it finds that the STUN server supports RFC 5780
 requests with different parameters, to demonstrate the NAT discovery capabilities.
 .PP
 This utility does not support the "old" "classic" STUN protocol (RFC 3489).
-.PP
-=====================================
+.SH =====================================
+
 .SS  NAME
 \fB
 \fBturnutils_rfc5769check \fP\- a utility that tests the correctness of STUN protocol implementation.
@@ -380,8 +380,8 @@ check procedure, it is not copied to the installation destination.
 Usage:
 .PP
 $ \fIturnutils_rfc5769check\fP
-.PP
-=====================================
+.SH =====================================
+
 .SS  NAME
 \fB
 \fBturnutils_natdiscovery \fP\- a utility that discovers NAT mapping and filtering
@@ -462,8 +462,8 @@ Used by mapping lifetime behavior discovery
 Usage:
 .PP
 $ \fIturnutils_natdiscovery\fP \fB\-m\fP \fB\-f\fP stun.example.com
-.PP
-=====================================
+.SH =====================================
+
 .SS  NAME
 \fB
 \fBturnutils_oauth \fP\- a utility that helps OAuth access_token generation/encryption and validation/decyption
@@ -568,8 +568,8 @@ stun client hmac algorithm
 Usage:
 .PP
 $ \fIturnutils_natdiscovery\fP
-.PP
-===================================
+.SH ===================================
+
 .SH DOCS
 
 After installation, run the command:
@@ -581,8 +581,8 @@ or in the project root directory:
 $ man \fB\-M\fP man \fIturnutils\fP
 .PP
 to see the man page.
-.PP
-=====================================
+.SH =====================================
+
 .SH FILES
 
 /etc/turnserver.conf
@@ -594,8 +594,8 @@ to see the man page.
 /var/lib/turn/turndb
 .PP
 /usr/local/etc/turnserver.conf
-.PP
-=================================
+.SH =================================
+
 .SH DIRECTORIES
 
 /usr/local/share/\fIturnserver\fP
@@ -603,14 +603,13 @@ to see the man page.
 /usr/local/share/doc/\fIturnserver\fP
 .PP
 /usr/local/share/examples/\fIturnserver\fP
-.PP
-===================================
+.SH ===================================
+
 .SH STANDARDS
 
 new STUN RFC 5389
-.PP
-TURN RFC 5766
-.PP
+.SH TURN RFC 5766
+
 TURN\-TCP extension RFC 6062
 .PP
 TURN IPv6 extension RFC 6156
@@ -618,14 +617,13 @@ TURN IPv6 extension RFC 6156
 STUN/TURN test vectors RFC 5769
 .PP
 STUN NAT behavior discovery RFC 5780
-.PP
-====================================
+.SH ====================================
+
 .SH SEE ALSO
 
 \fIturnserver\fP, \fIturnadmin\fP
-.RE
-.PP
-======================================
+.SH ======================================
+
 .SS  WEB RESOURCES
 
 project page:
@@ -639,9 +637,8 @@ https://github.com/coturn/coturn/wiki
 forum:
 .PP
 https://groups.google.com/forum/?fromgroups=#!forum/turn\-server\-project\-rfc5766\-turn\-server/
-.RE
-.PP
-======================================
+.SH ======================================
+
 .SS  AUTHORS
 
 Oleg Moskalenko <[email protected]>

+ 6 - 6
src/apps/relay/mainrelay.c

@@ -156,7 +156,7 @@ TURN_CREDENTIALS_NONE, /* ct */
 0, /* total_quota */
 0, /* user_quota */
 #if !defined(TURN_NO_PROMETHEUS)
-1, /* prometheus enabled by default */
+0, /* prometheus disabled by default */
 #endif
 ///////////// Users DB //////////////
 { (TURN_USERDB_TYPE)0, {"\0"}, {0,NULL, {NULL,0}} },
@@ -537,7 +537,7 @@ static char Usage[] = "Usage: turnserver [options]\n"
 "						The connection string has the same parameters as redis-userdb connection string.\n"
 #endif
 #if !defined(TURN_NO_PROMETHEUS)
-" --no-prometheus				Disable prometheus metrics. By default it is enabled and listening on port 9121 unther the path /metrics\n"
+" --prometheus					Enable prometheus metrics. It is disabled by default. If it is enabled it will listen on port 9121 unther the path /metrics\n"
 "						also the path / on this port can be used as a health check\n"
 #endif
 " --use-auth-secret				TURN REST API flag.\n"
@@ -750,7 +750,7 @@ enum EXTRA_OPTS {
 	MAX_ALLOCATE_LIFETIME_OPT,
 	CHANNEL_LIFETIME_OPT,
 	PERMISSION_LIFETIME_OPT,
-	NO_PROMETHEUS_OPT,
+	PROMETHEUS_OPT,
 	AUTH_SECRET_OPT,
 	NO_AUTH_PINGS_OPT,
 	NO_DYNAMIC_IP_LIST_OPT,
@@ -858,7 +858,7 @@ static const struct myoption long_options[] = {
 				{ "redis-statsdb", required_argument, NULL, 'O' },
 #endif
 #if !defined(TURN_NO_PROMETHEUS)
-				{ "no-prometheus", optional_argument, NULL, NO_PROMETHEUS_OPT },
+				{ "prometheus", optional_argument, NULL, PROMETHEUS_OPT },
 #endif
 				{ "use-auth-secret", optional_argument, NULL, AUTH_SECRET_OPT },
 				{ "static-auth-secret", required_argument, NULL, STATIC_AUTH_SECRET_VAL_OPT },
@@ -1461,8 +1461,8 @@ static void set_option(int c, char *value)
 		break;
 #endif
 #if !defined(TURN_NO_PROMETHEUS)
-	case NO_PROMETHEUS_OPT:
-		turn_params.prometheus = 0;
+	case PROMETHEUS_OPT:
+		turn_params.prometheus = 1;
 		break;
 #endif
 	case AUTH_SECRET_OPT: