feat(server): add remote host metrics
This commit is contained in:
parent
7efd6d5b84
commit
bb0bbc15af
6 changed files with 118 additions and 12 deletions
|
@ -1,5 +1,16 @@
|
|||
{config, ...}: {
|
||||
imports = [./common.nix];
|
||||
{
|
||||
config,
|
||||
_utils,
|
||||
...
|
||||
}: let
|
||||
secrets = _utils.setupSharedSecrets config {
|
||||
secrets = ["vmAuthToken"];
|
||||
};
|
||||
in {
|
||||
imports = [
|
||||
./common.nix
|
||||
secrets.generate
|
||||
];
|
||||
|
||||
_module.args.nixinate = {
|
||||
host = config.networking.hostName;
|
||||
|
@ -27,5 +38,29 @@
|
|||
port = 9091;
|
||||
enabledCollectors = ["systemd"];
|
||||
};
|
||||
|
||||
vmagent = {
|
||||
enable = true;
|
||||
remoteWrite.url = "https://metrics.uku3lig.net/api/v1/write";
|
||||
extraArgs = ["-remoteWrite.bearerToken $VM_AUTH_TOKEN"];
|
||||
prometheusConfig = {
|
||||
global.scrape_interval = "15s";
|
||||
|
||||
scrape_configs = [
|
||||
{
|
||||
job_name = "node";
|
||||
static_configs = [{targets = ["localhost:${builtins.toString config.services.prometheus.exporters.node.port}"];}];
|
||||
relabel_configs = [
|
||||
{
|
||||
target_label = "instance";
|
||||
replacement = config.networking.hostName;
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.vmagent.serviceConfig.EnvironmentFile = secrets.get "vmAuthToken";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue