modules/monitoring: Extract metrics from nginx logs
This commit is contained in:
@@ -52,6 +52,12 @@ let
|
||||
attrByPath ["clerie" "monitoring" "blackbox"] false host.config)
|
||||
monitoringHosts);
|
||||
|
||||
nginxlogMonitoringTargets = mapAttrsToList (name: host:
|
||||
"${host.config.networking.hostName}.mon.clerie.de:9117")
|
||||
(filterAttrs (name: host:
|
||||
attrByPath ["services" "prometheus" "exporters" "nginxlog" "enable"] false host.config)
|
||||
monitoringHosts);
|
||||
|
||||
eachWithEachOther = (f: x: y: lib.lists.flatten (lib.lists.forEach x (a: lib.lists.forEach y (b: f a b))));
|
||||
|
||||
in {
|
||||
@@ -536,6 +542,18 @@ in {
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
job_name = "nginxlog-exporter";
|
||||
scrape_interval = "20s";
|
||||
static_configs = [
|
||||
{
|
||||
targets = nginxlogMonitoringTargets;
|
||||
}
|
||||
];
|
||||
relabel_configs = [
|
||||
relabelAddressToInstance
|
||||
];
|
||||
}
|
||||
];
|
||||
alertmanagers = [
|
||||
{
|
||||
|
@@ -53,9 +53,6 @@
|
||||
'';
|
||||
return = "200 ''";
|
||||
};
|
||||
extraConfig = ''
|
||||
access_log /var/log/nginx/clerie.de.log combined_anon;
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@@ -83,9 +83,6 @@
|
||||
proxyPass = "http://[::1]:3000";
|
||||
};
|
||||
};
|
||||
extraConfig = ''
|
||||
access_log /var/log/nginx/git.clerie.de.log combined_anon;
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@@ -53,9 +53,6 @@
|
||||
types { } default_type "text/html; charset=utf-8";
|
||||
'';
|
||||
};
|
||||
extraConfig = ''
|
||||
access_log /var/log/nginx/ip.clerie.de.log vcombined_anon;
|
||||
'';
|
||||
};
|
||||
"ip4.clerie.de" = {
|
||||
enableACME = true;
|
||||
@@ -67,9 +64,6 @@
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
'';
|
||||
};
|
||||
extraConfig = ''
|
||||
access_log /var/log/nginx/ip.clerie.de.log vcombined_anon;
|
||||
'';
|
||||
};
|
||||
"ip6.clerie.de" = {
|
||||
enableACME = true;
|
||||
@@ -81,9 +75,6 @@
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
'';
|
||||
};
|
||||
extraConfig = ''
|
||||
access_log /var/log/nginx/ip.clerie.de.log vcombined_anon;
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user