ping_exporter: also add to fra1-b and vno1-gdrx

This commit is contained in:
Motiejus Jakštys 2024-09-16 14:49:07 +03:00
parent 4eb57ba5e7
commit c9d69cc3e6
5 changed files with 90 additions and 49 deletions

View File

@ -76,6 +76,7 @@ in
services = { services = {
node_exporter.enable = true; node_exporter.enable = true;
ping_exporter.enable = true;
tailscale.enable = true; tailscale.enable = true;
ssh8022.server = { ssh8022.server = {

View File

@ -342,39 +342,23 @@ in
evaluation_interval = "1m"; evaluation_interval = "1m";
}; };
exporters.ping = {
enable = true;
settings = {
options.disableIPv6 = true;
ping = {
interval = "1s";
timeout = "5s";
history-size = 10;
};
targets = [
"1.1.1.1"
"8.8.4.4"
"fb.com"
"rrt.lt"
"kam.lt"
"lrs.lt"
"15min.lt"
"fra1-b.jakstys.lt"
myData.hosts."fra1-b.servers.jakst".jakstIP
];
};
};
scrapeConfigs = scrapeConfigs =
let
port = builtins.toString myData.ports.exporters.node;
in
[ [
{ {
job_name = "ping"; job_name = "ping";
static_configs = [ static_configs = [
{ targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.ping.port}" ]; } (
let
port = toString config.services.prometheus.exporters.ping.port;
in
{
targets = [
"127.0.0.1:${port}"
"${myData.hosts."fra1-b.servers.jakst".jakstIP}:${port}"
"${myData.hosts."vno1-gdrx.motiejus.jakst".jakstIP}:${port}"
];
}
)
]; ];
} }
{ {
@ -401,19 +385,23 @@ in
static_configs = [ { targets = [ "${myData.hosts."vno1-vinc.vincentas.jakst".jakstIP}:9100" ]; } ]; static_configs = [ { targets = [ "${myData.hosts."vno1-vinc.vincentas.jakst".jakstIP}:9100" ]; } ];
} }
] ]
++ ++ map
map (
(s: { let
port = builtins.toString myData.ports.exporters.node;
in
s: {
job_name = s; job_name = s;
static_configs = [ { targets = [ "${myData.hosts.${s}.jakstIP}:${port}" ]; } ]; static_configs = [ { targets = [ "${myData.hosts.${s}.jakstIP}:${port}" ]; } ];
}) }
[ )
"fra1-b.servers.jakst" [
"fwminex.servers.jakst" "fra1-b.servers.jakst"
"mtworx.motiejus.jakst" "fwminex.servers.jakst"
"vno3-rp3b.servers.jakst" "mtworx.motiejus.jakst"
"vno1-gdrx.motiejus.jakst" "vno3-rp3b.servers.jakst"
]; "vno1-gdrx.motiejus.jakst"
];
}; };
}; };
@ -441,6 +429,13 @@ in
hass.enable = true; hass.enable = true;
syncthing-relay.enable = true; syncthing-relay.enable = true;
ping_exporter.enable = true;
node_exporter = {
enable = true;
extraSubnets = [ myData.subnets.vno1.cidr ];
};
ssh8022.server = { ssh8022.server = {
enable = true; enable = true;
keyfile = config.age.secrets.ssh8022-server.path; keyfile = config.age.secrets.ssh8022-server.path;
@ -596,11 +591,6 @@ in
sshKey = "/etc/ssh/ssh_host_ed25519_key"; sshKey = "/etc/ssh/ssh_host_ed25519_key";
}; };
node_exporter = {
enable = true;
extraSubnets = [ myData.subnets.vno1.cidr ];
};
deployerbot = { deployerbot = {
main = { main = {
enable = true; enable = true;

View File

@ -89,6 +89,13 @@ in
}; };
services = { services = {
ping_exporter.enable = true;
node_exporter = {
enable = true;
extraSubnets = [ myData.subnets.vno1.cidr ];
};
ssh8022.client = { ssh8022.client = {
enable = true; enable = true;
keyfile = config.age.secrets.ssh8022-client.path; keyfile = config.age.secrets.ssh8022-client.path;
@ -142,11 +149,6 @@ in
maxJobs = 2; maxJobs = 2;
}; };
node_exporter = {
enable = true;
extraSubnets = [ myData.subnets.vno1.cidr ];
};
deployerbot = { deployerbot = {
follower = { follower = {
publicKeys = [ myData.hosts."fwminex.servers.jakst".publicKey ]; publicKeys = [ myData.hosts."fwminex.servers.jakst".publicKey ];

View File

@ -15,6 +15,7 @@
./minidlna ./minidlna
./node_exporter ./node_exporter
./nsd-acme ./nsd-acme
./ping_exporter
./photoprism ./photoprism
./postfix ./postfix
./remote-builder ./remote-builder

View File

@ -0,0 +1,47 @@
{
config,
lib,
myData,
...
}:
let
cfg = config.mj.services.ping_exporter;
in
{
options.mj.services.ping_exporter = with lib.types; {
enable = lib.mkEnableOption "Enable ping_exporter";
};
config = lib.mkIf cfg.enable {
services.prometheus.exporters.ping = {
enable = true;
settings = {
options.disableIPv6 = true;
ping = {
interval = "1s";
timeout = "5s";
history-size = 10;
};
targets = [
"1.1.1.1"
"8.8.4.4"
"fb.com"
"rrt.lt"
"kam.lt"
"lrs.lt"
"15min.lt"
"fra1-b.jakstys.lt"
myData.hosts."fra1-b.servers.jakst".jakstIP
];
};
};
mj.services.friendlyport.ports = [
{
subnets = [ myData.subnets.tailscale.cidr ];
tcp = [ config.services.prometheus.exporters.ping.port ];
}
];
};
}