Prometheus pushgateway
This commit is contained in:
parent
2871c291bf
commit
a39a314e4c
2 changed files with 112 additions and 26 deletions
|
@ -1,32 +1,56 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
lib,
|
||||||
...
|
...
|
||||||
}: {
|
}: let
|
||||||
services.prometheus.exporters.node = {
|
hostname = config.networking.hostName;
|
||||||
enable = true;
|
mkFor = hosts: lib.mkIf (builtins.elem hostname hosts);
|
||||||
enabledCollectors = [
|
in {
|
||||||
"cpu"
|
services.prometheus.exporters = {
|
||||||
"conntrack"
|
node = mkFor ["sisko" "picard"] {
|
||||||
"diskstats"
|
enable = true;
|
||||||
"entropy"
|
enabledCollectors = [
|
||||||
"filefd"
|
"cpu"
|
||||||
"filesystem"
|
"conntrack"
|
||||||
"loadavg"
|
"diskstats"
|
||||||
"mdadm"
|
"entropy"
|
||||||
"meminfo"
|
"filefd"
|
||||||
"netdev"
|
"filesystem"
|
||||||
"netstat"
|
"loadavg"
|
||||||
"stat"
|
"mdadm"
|
||||||
"time"
|
"meminfo"
|
||||||
"vmstat"
|
"netdev"
|
||||||
"systemd"
|
"netstat"
|
||||||
"logind"
|
"stat"
|
||||||
"interrupts"
|
"time"
|
||||||
"ksmd"
|
"vmstat"
|
||||||
"textfile"
|
"systemd"
|
||||||
"pressure"
|
"logind"
|
||||||
];
|
"interrupts"
|
||||||
extraFlags = ["--collector.ethtool" "--collector.softirqs" "--collector.tcpstat" "--collector.wifi"];
|
"ksmd"
|
||||||
|
"textfile"
|
||||||
|
"pressure"
|
||||||
|
];
|
||||||
|
extraFlags = ["--collector.ethtool" "--collector.softirqs" "--collector.tcpstat" "--collector.wifi"];
|
||||||
|
};
|
||||||
|
wireguard = mkFor ["sisko" "picard"] {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
zfs = mkFor ["picard"] {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
# restic = mkFor ["sisko"] {
|
||||||
|
# enable = true;
|
||||||
|
# };
|
||||||
|
postgres = mkFor ["sisko"] {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
nginx = mkFor ["sisko"] {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
smartctl = mkFor ["sisko"] {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,12 @@
|
||||||
in {
|
in {
|
||||||
services.prometheus = {
|
services.prometheus = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
pushgateway = {
|
||||||
|
enable = true;
|
||||||
|
web = {
|
||||||
|
listen-address = "sisko.fleet:9094";
|
||||||
|
};
|
||||||
|
};
|
||||||
checkConfig = false; # Otherwise it will fail because it cannot access bearer_token_file
|
checkConfig = false; # Otherwise it will fail because it cannot access bearer_token_file
|
||||||
webExternalUrl = "https://status.aciceri.dev";
|
webExternalUrl = "https://status.aciceri.dev";
|
||||||
globalConfig.scrape_interval = "10s";
|
globalConfig.scrape_interval = "10s";
|
||||||
|
@ -17,6 +23,14 @@ in {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
job_name = "pushgateway";
|
||||||
|
static_configs = [
|
||||||
|
{
|
||||||
|
targets = [cfg.pushgateway.web.listen-address];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
{
|
{
|
||||||
job_name = "node";
|
job_name = "node";
|
||||||
static_configs = [
|
static_configs = [
|
||||||
|
@ -25,6 +39,54 @@ in {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
job_name = "wireguard";
|
||||||
|
static_configs = [
|
||||||
|
{
|
||||||
|
targets = builtins.map (host: "${host}.fleet:9586") ["picard"];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
job_name = "zfs";
|
||||||
|
static_configs = [
|
||||||
|
{
|
||||||
|
targets = builtins.map (host: "${host}.fleet:9134") ["picard"];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
job_name = "restic";
|
||||||
|
static_configs = [
|
||||||
|
{
|
||||||
|
targets = builtins.map (host: "${host}.fleet:9753") ["sisko"];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
job_name = "postgres";
|
||||||
|
static_configs = [
|
||||||
|
{
|
||||||
|
targets = builtins.map (host: "${host}.fleet:9187") ["sisko"];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
job_name = "nginx";
|
||||||
|
static_configs = [
|
||||||
|
{
|
||||||
|
targets = builtins.map (host: "${host}.fleet:9117") ["sisko"];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
job_name = "smartctl";
|
||||||
|
static_configs = [
|
||||||
|
{
|
||||||
|
targets = builtins.map (host: "${host}.fleet:9633") ["sisko"];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
environment.persistence."/persist".directories = [
|
environment.persistence."/persist".directories = [
|
||||||
|
|
Loading…
Add table
Reference in a new issue