Add prometheus #118

Merged
esy merged 27 commits from prometheus2 into main 2024-05-23 21:52:10 +00:00
2 changed files with 9 additions and 8 deletions
Showing only changes of commit 9b3e7265dd - Show all commits

View file

@ -1,4 +1,5 @@
{
nodes,
lib,
config,
...
@ -10,11 +11,6 @@ in {
imports = [];
options.services.skynet."${name}" = {
#list of servers passed in for monitoring
servers = mkOption {
type = types.listOf types.str;
};
server = {
enable = mkEnableOption "Prometheus Server";
host = {
@ -31,6 +27,13 @@ in {
type = types.port;
default = 9001;
};
other_nodes = mkOption {
type = types.listOf types.str;
description = ''
To add other nodes outside of nix, specify ip and port that server should listen to here
'';
};
};
collecter_port = mkOption {
@ -57,7 +60,7 @@ in {
job_name = "node_exporter";
static_configs = [
{
targets = map (server: "${server}.skynet.ie:{collecter_port}") cfg.servers;
targets = map (hostname: "${hostname}:${collecter_port}") lib.attrsets.mapAttrsToList (server: server.deployment.hostname) nodes ++ cfg.other_nodes;
}
];
}

View file

@ -53,8 +53,6 @@ in {
};
services.skynet.prometheus = {
servers = lib.attrsets.mapAttrsToList (server: server.name) nodes;
server = {
host = {
ip = ip_pub;