buzzrelay: add collectd postgresql stats

This commit is contained in:
Astro 2023-03-31 20:21:04 +02:00
parent f2d5e97ecd
commit 850f35dad9
1 changed files with 29 additions and 0 deletions

View File

@ -41,7 +41,36 @@
package = pkgs.postgresql_15;
settings.log_min_duration_statement = 50;
upgrade.stopServices = [ "buzzrelay" ];
ensureUsers = [ {
name = "collectd";
ensurePermissions."DATABASE ${config.services.buzzrelay.database}" = "ALL PRIVILEGES";
} ];
};
collectd.plugins.postgresql = ''
<Query unique_followers>
Statement "select count(distinct id) from follows;"
<Result>
Type gauge
InstancePrefix "unique"
ValuesFrom "count"
</Result>
</Query>
<Query total_follows>
Statement "select count(id) from follows;"
<Result>
Type gauge
InstancePrefix "total"
ValuesFrom "count"
</Result>
</Query>
<Database ${config.networking.hostName}>
Param database "${config.services.buzzrelay.database}"
Query unique_followers
Query total_follows
</Database>
'';
};
system.stateVersion = "22.11";