Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arch Linux
infrastructure
Commits
67d32f8e
Verified
Commit
67d32f8e
authored
May 21, 2021
by
Jan Alexander Steffens (heftig)
Browse files
matrix: Export prometheus metrics
parent
128edca7
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
group_vars/all/vault_matrix.yml
View file @
67d32f8e
This diff is collapsed.
Click to expand it.
roles/matrix/defaults/main.yml
View file @
67d32f8e
...
...
@@ -41,3 +41,16 @@ matrix_nginx_config:
locations
:
-
"
/_matrix"
-
"
/_synapse"
matrix_metrics_htpasswd
:
/etc/nginx/auth/matrix_metrics
matrix_metrics_endpoints
:
-
name
:
synapse.homeserver
port
:
8019
-
name
:
synapse.appservice
port
:
8020
-
name
:
synapse.federation_reader
port
:
8021
-
name
:
synapse.federation_writer
port
:
8022
-
name
:
synapse.media_repository
port
:
8023
roles/matrix/files/worker-appservice.yaml
View file @
67d32f8e
worker_name
:
appservice
worker_app
:
synapse.app.appservice
worker_listeners
:
-
port
:
8020
type
:
metrics
bind_addresses
:
[
'
127.0.0.1'
]
# vim:ft=yaml sw=2 et:
roles/matrix/files/worker-federation_reader.yaml
View file @
67d32f8e
...
...
@@ -8,5 +8,8 @@ worker_listeners:
resources
:
-
names
:
[
federation
]
compress
:
false
-
port
:
8021
type
:
metrics
bind_addresses
:
[
'
127.0.0.1'
]
# vim:ft=yaml sw=2 et:
roles/matrix/files/worker-federation_sender.yaml
View file @
67d32f8e
worker_name
:
federation_sender
worker_app
:
synapse.app.federation_sender
worker_listeners
:
-
port
:
8022
type
:
metrics
bind_addresses
:
[
'
127.0.0.1'
]
# vim:ft=yaml sw=2 et:
roles/matrix/files/worker-media_repository.yaml
View file @
67d32f8e
...
...
@@ -8,5 +8,8 @@ worker_listeners:
resources
:
-
names
:
[
media
]
compress
:
false
-
port
:
8023
type
:
metrics
bind_addresses
:
[
'
127.0.0.1'
]
# vim:ft=yaml sw=2 et:
roles/matrix/tasks/main.yml
View file @
67d32f8e
...
...
@@ -28,7 +28,7 @@
-
pkgconf
-
postgresql-libs
-
python
-
python
2
-
python
-passlib
-
redis
-
tcl
-
tk
...
...
@@ -246,6 +246,15 @@
group
:
synapse
mode
:
0640
-
name
:
create htpasswd for matrix metrics endpoint
htpasswd
:
path
:
"
{{
matrix_metrics_htpasswd
}}"
name
:
"
{{
vault_matrix_secrets.metrics_user
}}"
password
:
"
{{
vault_matrix_secrets.metrics_password
}}"
owner
:
root
group
:
http
mode
:
0640
-
name
:
make nginx log dir
file
:
path=/var/log/nginx/{{ matrix_domain }} state=directory owner=root group=root mode=0755
...
...
roles/matrix/templates/homeserver.yaml.j2
View file @
67d32f8e
...
...
@@ -312,6 +312,13 @@ listeners:
# module: my_module.CustomRequestHandler
# config: {}
# Turn on the twisted ssh manhole service on localhost on the given
# port.
#
#- port: 9000
# bind_addresses: ['::1', '127.0.0.1']
# type: manhole
-
port
:
9093
type
:
http
bind_addresses
:
[
'
::1'
,
'
127.0.0.1'
]
...
...
@@ -319,12 +326,9 @@ listeners:
-
names
:
[
replication
]
compress
:
false
# Turn on the twisted ssh manhole service on localhost on the given
# port.
#
#- port: 9000
# bind_addresses: ['::1', '127.0.0.1']
# type: manhole
-
port
:
8019
type
:
metrics
bind_addresses
:
[
'
127.0.0.1'
]
# Forward extremities can build up in a room due to networking delays between
# homeservers. Once this happens in a large room, calculation of the state of
...
...
@@ -728,8 +732,8 @@ acme:
#
# By default, no domains are monitored in this way.
#
#
federation_metrics_domains:
#
- matrix.org
federation_metrics_domains
:
-
matrix.org
# - example.com
# Uncomment to disable profile lookup over federation. By default, the
...
...
@@ -1482,7 +1486,7 @@ account_validity:
# Enable collection and rendering of performance metrics
#
#
enable_metrics:
fals
e
enable_metrics
:
tru
e
# Enable sentry integration
# NOTE: While attempts are made to ensure that the logs don't contain
...
...
@@ -1502,7 +1506,7 @@ metrics_flags:
# servers this homeserver knows about, including itself. May cause
# performance problems on large homeservers.
#
#
known_servers: true
known_servers
:
true
# Whether or not to report anonymized homeserver usage statistics.
#
...
...
roles/matrix/templates/nginx.d.conf.j2
View file @
67d32f8e
...
...
@@ -50,6 +50,22 @@ server {
{% endfor %}
{% endfor %}
location /metrics {
auth_basic "Matrix metrics";
auth_basic_user_file {{ matrix_metrics_htpasswd }};
{% for ep in matrix_metrics_endpoints %}
location = /metrics/{{ ep.name }} {
proxy_pass http://127.0.0.1:{{ ep.port }}/{{ ep.path | default('') }};
}
{% endfor %}
location = /metrics {
add_header Content-Type text/plain;
return 200 "Available endpoints:\n{% for ep in matrix_metrics_endpoints %} /metrics/{{ ep.name }}\n{% endfor %}";
}
}
location = / {
add_header Content-Type text/plain;
return 200 "Nothing to see here.";
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment