modules/nixos/monitoring: import hosts from knownHosts
This commit is contained in:
parent
cf9f6100a9
commit
06c99f6ef1
3 changed files with 10 additions and 16 deletions
modules/nixos/monitoring
|
@ -1,9 +0,0 @@
|
||||||
[
|
|
||||||
"build01.nix-community.org"
|
|
||||||
"build02.nix-community.org"
|
|
||||||
"build03.nix-community.org"
|
|
||||||
"build04.nix-community.org"
|
|
||||||
"darwin01.nix-community.org"
|
|
||||||
"darwin02.nix-community.org"
|
|
||||||
#"web02.nix-community.org"
|
|
||||||
]
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ pkgs, ... }:
|
{ inputs, pkgs, ... }:
|
||||||
{
|
{
|
||||||
systemd.services.prometheus.after = pkgs.lib.mkForce [ "network-online.target" ];
|
systemd.services.prometheus.after = pkgs.lib.mkForce [ "network-online.target" ];
|
||||||
systemd.services.prometheus.wants = [ "network-online.target" ];
|
systemd.services.prometheus.wants = [ "network-online.target" ];
|
||||||
|
@ -19,11 +19,13 @@
|
||||||
metrics_path = "/metrics";
|
metrics_path = "/metrics";
|
||||||
static_configs =
|
static_configs =
|
||||||
let
|
let
|
||||||
hosts = import ./hosts.nix;
|
hosts = (import "${inputs.self}/modules/shared/known-hosts.nix").programs.ssh.knownHosts;
|
||||||
in
|
in
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
targets = map (host: "${host}:9273") hosts ++ [ "localhost:9273" ];
|
targets = builtins.concatMap (host: map (name: "${name}:9273") host.hostNames) (
|
||||||
|
builtins.attrValues hosts
|
||||||
|
);
|
||||||
labels.org = "nix-community";
|
labels.org = "nix-community";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
{ inputs, ... }:
|
||||||
{
|
{
|
||||||
services.telegraf.extraConfig.inputs = {
|
services.telegraf.extraConfig.inputs = {
|
||||||
http_response = [
|
http_response = [
|
||||||
|
@ -28,17 +29,17 @@
|
||||||
];
|
];
|
||||||
net_response =
|
net_response =
|
||||||
let
|
let
|
||||||
hosts = import ./hosts.nix;
|
hosts = (import "${inputs.self}/modules/shared/known-hosts.nix").programs.ssh.knownHosts;
|
||||||
in
|
in
|
||||||
map (host: {
|
map (host: {
|
||||||
protocol = "tcp";
|
protocol = "tcp";
|
||||||
address = "${host}:22";
|
address = "${toString host.hostNames}:22";
|
||||||
send = "SSH-2.0-Telegraf";
|
send = "SSH-2.0-Telegraf";
|
||||||
expect = "SSH-2.0";
|
expect = "SSH-2.0";
|
||||||
tags.host = host;
|
tags.host = toString host.hostNames;
|
||||||
tags.org = "nix-community";
|
tags.org = "nix-community";
|
||||||
timeout = "10s";
|
timeout = "10s";
|
||||||
}) hosts;
|
}) (builtins.attrValues hosts);
|
||||||
prometheus.urls = [ "https://events.ofborg.org/prometheus.php" ];
|
prometheus.urls = [ "https://events.ofborg.org/prometheus.php" ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue