add synapse metrics

This commit is contained in:
Vivian 2022-07-29 13:02:03 +02:00
parent af1fe253e7
commit f8d90ddf41
6 changed files with 95 additions and 32 deletions

View file

@ -62,7 +62,7 @@ in
forceSSL = true;
locations."/".extraConfig = ''
add_header Content-Type 'text/html; charset=UTF-8';
return 200 meow;
return 200 '<h1>meow</h1>';
'';
locations."= /.well-known/matrix/client".extraConfig = mkWellKnown clientConfig;
locations."= /.well-known/matrix/server".extraConfig = mkWellKnown serverConfig;

View file

@ -6,6 +6,7 @@
let
vs = config.vault-secrets.secrets;
port = 8008;
metricsPort = 9000;
in
{
imports = [ ];
@ -23,7 +24,7 @@ in
# Additional packages
environment.systemPackages = with pkgs; [ ];
networking.firewall.allowedTCPPorts = [ port ];
networking.firewall.allowedTCPPorts = [ port metricsPort ];
vault-secrets.secrets.synapse = {
user = "matrix-synapse";
@ -65,6 +66,7 @@ in
server_name = "meowy.tech";
enable_registration = true;
public_baseurl = "https://chat.meowy.tech";
enable_metrics = true;
listeners = [
{
inherit port;
@ -79,6 +81,18 @@ in
}
];
}
{
port = metricsPort;
bind_addresses = [ "0.0.0.0" ];
type = "metrics";
tls = false;
resources = [
{
names = [ "metrics" ];
compress = false;
}
];
}
];
};
};

View file

@ -6,7 +6,8 @@
let
vmPort = 8428;
vs = config.vault-secrets.secrets;
in {
in
{
imports = [ ];
networking.hostName = "victoriametrics";
@ -32,7 +33,25 @@ in {
retentionPeriod = 12;
};
vault-secrets.secrets.grafana = {
services.vmagent = {
enable = true;
openFirewall = true;
prometheusConfig = {
global.scrape_interval = "5s";
scrape_configs = [
{
job_name = "synapse";
metrics_path = "/_synapse/metrics";
static_configs = [{
targets = [ "synapse.olympus:9000" ];
labels.app = "synapse";
}];
}
];
};
};
vault-secrets.secrets.grafana = {
user = "grafana";
group = "grafana";
};