improve all the things
This commit is contained in:
parent
7cbd49fe42
commit
0357003655
10 changed files with 171 additions and 41 deletions
88
hosts/monitoring/prometheus.nix
Normal file
88
hosts/monitoring/prometheus.nix
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
services.prometheus = {
|
||||
enable = true;
|
||||
retentionTime = "14d";
|
||||
listenAddress = "[::1]";
|
||||
scrapeConfigs = [
|
||||
{
|
||||
job_name = "hedgedoc";
|
||||
scrape_interval = "15s";
|
||||
scheme = "https";
|
||||
static_configs = [{ targets = ["md.berlin.ccc.de:443"]; }];
|
||||
}
|
||||
{
|
||||
job_name = "synapse";
|
||||
scrape_interval = "15s";
|
||||
static_configs = [{ targets = ["matrix.berlin.ccc.de:9009"]; }];
|
||||
}
|
||||
{
|
||||
job_name = "node";
|
||||
scrape_interval = "15s";
|
||||
static_configs = [
|
||||
{
|
||||
targets = [
|
||||
"matrix.${config.networking.domain}:${toString config.services.prometheus.exporters.node.port}"
|
||||
"md.${config.networking.domain}:${toString config.services.prometheus.exporters.node.port}"
|
||||
"postgres.${config.networking.domain}:${toString config.services.prometheus.exporters.node.port}"
|
||||
"monitoring:${toString config.services.prometheus.exporters.node.port}"
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
job_name = "nginx";
|
||||
scrape_interval = "15s";
|
||||
static_configs = [
|
||||
{
|
||||
targets = [
|
||||
"monitoring:${toString config.services.prometheus.exporters.nginx.port}"
|
||||
"matrix:${toString config.services.prometheus.exporters.nginx.port}"
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
ruleFiles = [
|
||||
# https://github.com/element-hq/synapse/tree/master/contrib/prometheus
|
||||
(pkgs.writeText "prom-synapse-rules.yaml" ''
|
||||
groups:
|
||||
- name: synapse
|
||||
rules:
|
||||
- record: 'synapse_federation_client_sent'
|
||||
labels:
|
||||
type: "EDU"
|
||||
expr: 'synapse_federation_client_sent_edus_total + 0'
|
||||
- record: 'synapse_federation_client_sent'
|
||||
labels:
|
||||
type: "PDU"
|
||||
expr: 'synapse_federation_client_sent_pdu_destinations_count_total + 0'
|
||||
- record: 'synapse_federation_client_sent'
|
||||
labels:
|
||||
type: "Query"
|
||||
expr: 'sum(synapse_federation_client_sent_queries) by (job)'
|
||||
- record: 'synapse_federation_server_received'
|
||||
labels:
|
||||
type: "EDU"
|
||||
expr: 'synapse_federation_server_received_edus_total + 0'
|
||||
- record: 'synapse_federation_server_received'
|
||||
labels:
|
||||
type: "PDU"
|
||||
expr: 'synapse_federation_server_received_pdus_total + 0'
|
||||
- record: 'synapse_federation_server_received'
|
||||
labels:
|
||||
type: "Query"
|
||||
expr: 'sum(synapse_federation_server_received_queries) by (job)'
|
||||
- record: 'synapse_federation_transaction_queue_pending'
|
||||
labels:
|
||||
type: "EDU"
|
||||
expr: 'synapse_federation_transaction_queue_pending_edus + 0'
|
||||
- record: 'synapse_federation_transaction_queue_pending'
|
||||
labels:
|
||||
type: "PDU"
|
||||
expr: 'synapse_federation_transaction_queue_pending_pdus + 0'
|
||||
'')
|
||||
];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue