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 = {
node_exporter.enable = true;
ping_exporter.enable = true;
tailscale.enable = true;
ssh8022.server = {

View File

@ -342,39 +342,23 @@ in
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 =
let
port = builtins.toString myData.ports.exporters.node;
in
[
{
job_name = "ping";
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" ]; } ];
}
]
++
map
(s: {
++ map
(
let
port = builtins.toString myData.ports.exporters.node;
in
s: {
job_name = s;
static_configs = [ { targets = [ "${myData.hosts.${s}.jakstIP}:${port}" ]; } ];
})
[
"fra1-b.servers.jakst"
"fwminex.servers.jakst"
"mtworx.motiejus.jakst"
"vno3-rp3b.servers.jakst"
"vno1-gdrx.motiejus.jakst"
];
}
)
[
"fra1-b.servers.jakst"
"fwminex.servers.jakst"
"mtworx.motiejus.jakst"
"vno3-rp3b.servers.jakst"
"vno1-gdrx.motiejus.jakst"
];
};
};
@ -441,6 +429,13 @@ in
hass.enable = true;
syncthing-relay.enable = true;
ping_exporter.enable = true;
node_exporter = {
enable = true;
extraSubnets = [ myData.subnets.vno1.cidr ];
};
ssh8022.server = {
enable = true;
keyfile = config.age.secrets.ssh8022-server.path;
@ -596,11 +591,6 @@ in
sshKey = "/etc/ssh/ssh_host_ed25519_key";
};
node_exporter = {
enable = true;
extraSubnets = [ myData.subnets.vno1.cidr ];
};
deployerbot = {
main = {
enable = true;

View File

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

View File

@ -15,6 +15,7 @@
./minidlna
./node_exporter
./nsd-acme
./ping_exporter
./photoprism
./postfix
./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 ];
}
];
};
}