Monitor nginx via Prometheus

This commit is contained in:
coolneng 2023-04-18 21:18:38 +02:00
parent 841ee6758d
commit 80259e6afd
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
2 changed files with 19 additions and 7 deletions

View File

@ -56,8 +56,11 @@ with pkgs;
wireguard.enable = true; wireguard.enable = true;
postgres.enable = true; postgres.enable = true;
smartctl.enable = true; smartctl.enable = true;
#nginx.enable = true;
dnsmasq.enable = true; dnsmasq.enable = true;
nginx = {
enable = true;
scrapeUri = "http://localhost:8282/nginx_status";
};
}; };
scrapeConfigs = [{ scrapeConfigs = [{
job_name = "zion"; job_name = "zion";
@ -77,6 +80,9 @@ with pkgs;
"localhost:${ "localhost:${
toString config.services.prometheus.exporters.dnsmasq.port toString config.services.prometheus.exporters.dnsmasq.port
}" }"
"localhost:${
toString config.services.prometheus.exporters.nginx.port
}"
"localhost:9641" "localhost:9641"
]; ];
}]; }];

View File

@ -49,12 +49,6 @@
add_header Access-Control-Allow-Origin * always; add_header Access-Control-Allow-Origin * always;
''; '';
}; };
"/nginx_status/".extraConfig = ''
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
'';
}; };
}; };
"radicale.coolneng.duckdns.org" = { "radicale.coolneng.duckdns.org" = {
@ -164,6 +158,18 @@
proxyWebsockets = true; proxyWebsockets = true;
}; };
}; };
"/nginx_status/" = {
listen = [{
addr = "127.0.0.1";
port = 8282;
}];
extraConfig = ''
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
'';
};
}; };
}; };