monitoring: replace prometheus with victoriametrics
VictoriaMetrics is known to be less resource intensive compared to prometheus. Prometheus' node_exporter is still used to scrape data from systemd, because it is very good, but entire Prometheus scraper and data storage is no longer necessary. The complete Node Exporter Full dashboard is also very nice to look at :)
This commit is contained in:
parent
3c9fc4014b
commit
0a042d8fab
1 changed files with 4 additions and 24 deletions
|
@ -6,7 +6,7 @@ let
|
|||
stream_parse: true
|
||||
static_configs:
|
||||
- targets:
|
||||
- 127.0.0.1:9002
|
||||
- 127.0.0.1:9100
|
||||
'';
|
||||
in
|
||||
{
|
||||
|
@ -14,45 +14,25 @@ in
|
|||
networking.firewall.extraCommands = ''
|
||||
iptables -A nixos-fw -p tcp --source 192.168.0.0/24 --dport 2342:2342 -j nixos-fw-accept
|
||||
iptables -A nixos-fw -p udp --source 192.168.0.0/24 --dport 2342:2342 -j nixos-fw-accept
|
||||
|
||||
iptables -A nixos-fw -p tcp --source 192.168.0.0/24 --dport 10052:10052 -j nixos-fw-accept
|
||||
iptables -A nixos-fw -p udp --source 192.168.0.0/24 --dport 10052:10052 -j nixos-fw-accept
|
||||
'';
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 9100 ];
|
||||
services = {
|
||||
victoriametrics = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# Collect data with conveniently declared 'scrapers'
|
||||
prometheus = {
|
||||
enable = true;
|
||||
port = 9001;
|
||||
|
||||
# Enable prometheus to collect data from systemd
|
||||
# Enable prometheus node_exporter
|
||||
exporters = {
|
||||
node = {
|
||||
enable = true;
|
||||
enabledCollectors = [
|
||||
"systemd"
|
||||
];
|
||||
port = 9002;
|
||||
port = 9100;
|
||||
};
|
||||
};
|
||||
|
||||
# Tell prometheus to collect data from defined exporters
|
||||
# Why this is not default config, I do not know.
|
||||
# Maybe this is for when exporter and scraper are on separate instances?
|
||||
scrapeConfigs = [
|
||||
{
|
||||
job_name = "prometheus-exporters";
|
||||
static_configs = [{
|
||||
targets = [
|
||||
"127.0.0.1:${toString config.services.prometheus.exporters.node.port}"
|
||||
];
|
||||
}];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Show data with fancy graphs
|
||||
|
|
Reference in a new issue