modules/nixos: monitoring
This commit is contained in:
parent
8fdaf7064d
commit
9d8bffd0fd
4 changed files with 86 additions and 0 deletions
|
@ -159,6 +159,7 @@
|
|||
github-org-backup = ./modules/nixos/github-org-backup.nix;
|
||||
hercules-ci = ./modules/nixos/hercules-ci;
|
||||
hydra = ./modules/nixos/hydra.nix;
|
||||
monitoring = ./modules/nixos/monitoring;
|
||||
nur-update = ./modules/nixos/nur-update.nix;
|
||||
raid = ./modules/nixos/raid.nix;
|
||||
remote-builder-build04 = ./modules/nixos/remote-builder/build04.nix;
|
||||
|
|
6
modules/nixos/monitoring/default.nix
Normal file
6
modules/nixos/monitoring/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./prometheus.nix
|
||||
./telegraf.nix
|
||||
];
|
||||
}
|
36
modules/nixos/monitoring/prometheus.nix
Normal file
36
modules/nixos/monitoring/prometheus.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
services.prometheus = {
|
||||
enable = true;
|
||||
webExternalUrl = "https://prometheus.nix-community.org";
|
||||
scrapeConfigs = [
|
||||
{
|
||||
job_name = "telegraf";
|
||||
scrape_interval = "60s";
|
||||
metrics_path = "/metrics";
|
||||
static_configs = [
|
||||
{
|
||||
targets = map (host: "${host}:9273")
|
||||
[
|
||||
"build01.nix-community.org"
|
||||
"build02.nix-community.org"
|
||||
"build03.nix-community.org"
|
||||
"build04.nix-community.org"
|
||||
"darwin02.nix-community.org"
|
||||
"darwin03.nix-community.org"
|
||||
"web01.nix-community.org"
|
||||
#"web02.nix-community.org"
|
||||
"localhost"
|
||||
];
|
||||
labels.org = "nix-community";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."prometheus.nix-community.org" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."/".proxyPass = "http://localhost:9090";
|
||||
};
|
||||
}
|
43
modules/nixos/monitoring/telegraf.nix
Normal file
43
modules/nixos/monitoring/telegraf.nix
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
services.telegraf.extraConfig.inputs = {
|
||||
http_response = [
|
||||
{
|
||||
urls = [ "https://lemmy.nix-community.org/" ];
|
||||
response_string_match = "Lemmy for Nix";
|
||||
tags.host = "web01.nix-community.org";
|
||||
tags.org = "nix-community";
|
||||
}
|
||||
{
|
||||
urls = [ "https://nur-update.nix-community.org/" ];
|
||||
response_string_match = "NUR update endpoint";
|
||||
tags.host = "build03.nix-community.org";
|
||||
tags.org = "nix-community";
|
||||
}
|
||||
];
|
||||
net_response =
|
||||
let
|
||||
hosts = [
|
||||
"build01.nix-community.org"
|
||||
"build02.nix-community.org"
|
||||
"build03.nix-community.org"
|
||||
"build04.nix-community.org"
|
||||
"darwin01.nix-community.org"
|
||||
"darwin02.nix-community.org"
|
||||
"darwin03.nix-community.org"
|
||||
"web01.nix-community.org"
|
||||
#"web02.nix-community.org"
|
||||
];
|
||||
in
|
||||
map
|
||||
(host: {
|
||||
protocol = "tcp";
|
||||
address = "${host}:22";
|
||||
send = "SSH-2.0-Telegraf";
|
||||
expect = "SSH-2.0";
|
||||
tags.host = host;
|
||||
tags.org = "nix-community";
|
||||
timeout = "10s";
|
||||
})
|
||||
hosts;
|
||||
};
|
||||
}
|
Loading…
Add table
Reference in a new issue