summaryrefslogtreecommitdiff
path: root/hosts
diff options
context:
space:
mode:
Diffstat (limited to 'hosts')
-rw-r--r--hosts/surtr/matrix/default.nix10
-rw-r--r--hosts/surtr/prometheus/default.nix11
-rw-r--r--hosts/surtr/prometheus/synapse-v2.rules78
3 files changed, 99 insertions, 0 deletions
diff --git a/hosts/surtr/matrix/default.nix b/hosts/surtr/matrix/default.nix
index b690ec9a..9c9c3565 100644
--- a/hosts/surtr/matrix/default.nix
+++ b/hosts/surtr/matrix/default.nix
@@ -27,6 +27,16 @@ with lib;
27 type = "http"; 27 type = "http";
28 x_forwarded = true; 28 x_forwarded = true;
29 } 29 }
30 { bind_addresses = ["::1" "127.0.0.1"];
31 port = 9092;
32 resources = [
33 { names = [ "metrics" ];
34 compress = false;
35 }
36 ];
37 tls = false;
38 type = "http";
39 }
30 ]; 40 ];
31 41
32 tls_certificate_path = "/run/credentials/matrix-synapse.service/synapse.li.pem"; 42 tls_certificate_path = "/run/credentials/matrix-synapse.service/synapse.li.pem";
diff --git a/hosts/surtr/prometheus/default.nix b/hosts/surtr/prometheus/default.nix
index e38fdcb2..0f0cf586 100644
--- a/hosts/surtr/prometheus/default.nix
+++ b/hosts/surtr/prometheus/default.nix
@@ -136,6 +136,14 @@ in {
136 ]; 136 ];
137 scrape_interval = "5s"; 137 scrape_interval = "5s";
138 } 138 }
139 { job_name = "synapse";
140 metrics_path = "/_synapse/metrics";
141 static_configs = [
142 { targets = ["localhost:9092"]; }
143 ];
144 relabel_configs = relabelHosts;
145 scrape_interval = "5s";
146 }
139 ]; 147 ];
140 148
141 rules = [ 149 rules = [
@@ -144,6 +152,9 @@ in {
144 ]; 152 ];
145 }) 153 })
146 ]; 154 ];
155 ruleFiles = [
156 ./synapse-v2.rules
157 ];
147 }; 158 };
148 users.users.${config.services.prometheus.exporters.unbound.user} = { 159 users.users.${config.services.prometheus.exporters.unbound.user} = {
149 description = "Prometheus unbound exporter service user"; 160 description = "Prometheus unbound exporter service user";
diff --git a/hosts/surtr/prometheus/synapse-v2.rules b/hosts/surtr/prometheus/synapse-v2.rules
new file mode 100644
index 00000000..7e405bf7
--- /dev/null
+++ b/hosts/surtr/prometheus/synapse-v2.rules
@@ -0,0 +1,78 @@
1groups:
2- name: synapse
3 rules:
4 - record: "synapse_federation_transaction_queue_pendingEdus:total"
5 expr: "sum(synapse_federation_transaction_queue_pendingEdus or absent(synapse_federation_transaction_queue_pendingEdus)*0)"
6 - record: "synapse_federation_transaction_queue_pendingPdus:total"
7 expr: "sum(synapse_federation_transaction_queue_pendingPdus or absent(synapse_federation_transaction_queue_pendingPdus)*0)"
8 - record: 'synapse_http_server_request_count:method'
9 labels:
10 servlet: ""
11 expr: "sum(synapse_http_server_request_count) by (method)"
12 - record: 'synapse_http_server_request_count:servlet'
13 labels:
14 method: ""
15 expr: 'sum(synapse_http_server_request_count) by (servlet)'
16
17 - record: 'synapse_http_server_request_count:total'
18 labels:
19 servlet: ""
20 expr: 'sum(synapse_http_server_request_count:by_method) by (servlet)'
21
22 - record: 'synapse_cache:hit_ratio_5m'
23 expr: 'rate(synapse_util_caches_cache:hits[5m]) / rate(synapse_util_caches_cache:total[5m])'
24 - record: 'synapse_cache:hit_ratio_30s'
25 expr: 'rate(synapse_util_caches_cache:hits[30s]) / rate(synapse_util_caches_cache:total[30s])'
26
27 - record: 'synapse_federation_client_sent'
28 labels:
29 type: "EDU"
30 expr: 'synapse_federation_client_sent_edus + 0'
31 - record: 'synapse_federation_client_sent'
32 labels:
33 type: "PDU"
34 expr: 'synapse_federation_client_sent_pdu_destinations:count + 0'
35 - record: 'synapse_federation_client_sent'
36 labels:
37 type: "Query"
38 expr: 'sum(synapse_federation_client_sent_queries) by (job)'
39
40 - record: 'synapse_federation_server_received'
41 labels:
42 type: "EDU"
43 expr: 'synapse_federation_server_received_edus + 0'
44 - record: 'synapse_federation_server_received'
45 labels:
46 type: "PDU"
47 expr: 'synapse_federation_server_received_pdus + 0'
48 - record: 'synapse_federation_server_received'
49 labels:
50 type: "Query"
51 expr: 'sum(synapse_federation_server_received_queries) by (job)'
52
53 - record: 'synapse_federation_transaction_queue_pending'
54 labels:
55 type: "EDU"
56 expr: 'synapse_federation_transaction_queue_pending_edus + 0'
57 - record: 'synapse_federation_transaction_queue_pending'
58 labels:
59 type: "PDU"
60 expr: 'synapse_federation_transaction_queue_pending_pdus + 0'
61
62 - record: synapse_storage_events_persisted_by_source_type
63 expr: sum without(type, origin_type, origin_entity) (synapse_storage_events_persisted_events_sep{origin_type="remote"})
64 labels:
65 type: remote
66 - record: synapse_storage_events_persisted_by_source_type
67 expr: sum without(type, origin_type, origin_entity) (synapse_storage_events_persisted_events_sep{origin_entity="*client*",origin_type="local"})
68 labels:
69 type: local
70 - record: synapse_storage_events_persisted_by_source_type
71 expr: sum without(type, origin_type, origin_entity) (synapse_storage_events_persisted_events_sep{origin_entity!="*client*",origin_type="local"})
72 labels:
73 type: bridges
74 - record: synapse_storage_events_persisted_by_event_type
75 expr: sum without(origin_entity, origin_type) (synapse_storage_events_persisted_events_sep)
76 - record: synapse_storage_events_persisted_by_origin
77 expr: sum without(type) (synapse_storage_events_persisted_events_sep)
78