Add prometheus #118
2 changed files with 9 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
|
@ -53,8 +53,6 @@ in {
|
|||
};
|
||||
|
||||
services.skynet.prometheus = {
|
||||
servers = lib.attrsets.mapAttrsToList (server: server.name) nodes;
|
||||
|
||||
server = {
|
||||
host = {
|
||||
ip = ip_pub;
|
||||
|
|
Loading…
Reference in a new issue