public-cof: improve monitoring of system and nextcloud performance

This commit is contained in:
Raito Bezarius 2022-03-06 20:22:03 +01:00
parent bfdfa5a206
commit 2721ad9b71
2 changed files with 66 additions and 3 deletions

View file

@ -1,5 +1,7 @@
{ config, ... }: { config, lib, pkgs, ... }:
{ {
services.nginx.statusPage = true;
services.netdata = { services.netdata = {
enable = true; enable = true;
config = { config = {
@ -9,12 +11,63 @@
"accept a streaming request every seconds" = 0; "accept a streaming request every seconds" = 0;
}; };
}; };
python.extraPackages = ps: [
ps.psycopg2
];
}; };
systemd.services.netdata.serviceConfig.SupplementaryGroups = [ "nginx" ];
systemd.services.netdata.restartTriggers = map (v: config.environment.etc."netdata/${v}.conf".source) [ systemd.services.netdata.restartTriggers = map (v: config.environment.etc."netdata/${v}.conf".source) [
"stream" "stream"
"go.d/phpfpm"
"go.d/nginx"
"python.d/postgres"
]; ];
services.postgresql.initialScript = pkgs.writeText "grant-pgmonitor-to-netdata" ''
GRANT pg_monitor TO netdata;
'';
services.postgresql.ensureUsers = [
{ name = "netdata"; }
];
environment.etc."netdata/python.d/postgres.conf" = {
user = "netdata";
group = "netdata";
mode = "0600";
text = builtins.toJSON (
if config.services.postgresql.enable then
{
name = "socket";
user = "netdata";
database = "postgres";
}
else {}
);
};
environment.etc."netdata/go.d/phpfpm.conf" = {
user = "netdata";
group = "netdata";
mode = "0600";
text = builtins.toJSON {
jobs =
map (pool: { name = "local_socket"; inherit (pool) socket; })
(builtins.attrValues config.services.phpfpm.pools);
};
};
environment.etc."netdata/go.d/nginx.conf" = {
user = "netdata";
group = "netdata";
mode = "0600";
text = builtins.toJSON {
jobs =
if config.services.nginx.statusPage then [ { name = "local"; url = "http://localhost/nginx_status"; } ]
else [];
};
};
environment.etc."netdata/stream.conf" = { environment.etc."netdata/stream.conf" = {
user = "netdata"; user = "netdata";

View file

@ -1,4 +1,4 @@
{ config, ... }: { config, lib, ... }:
{ {
services.nextcloud = { services.nextcloud = {
enable = true; enable = true;
@ -16,6 +16,15 @@
defaultPhoneRegion = "FR"; defaultPhoneRegion = "FR";
}; };
poolSettings = {
pm = "dynamic";
"pm.max_children" = 100;
"pm.start_servers" = 16;
"pm.min_spare_servers" = 8;
"pm.max_spare_servers" = 16;
"pm.status_path" = "/status";
};
}; };
services.nginx = { services.nginx = {
@ -23,6 +32,7 @@
"nuage.beta.rz.ens.wtf" = { "nuage.beta.rz.ens.wtf" = {
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
http2 = true;
}; };
}; };
}; };