buzzrelay: add collectd postgresql stats
This commit is contained in:
parent
f2d5e97ecd
commit
850f35dad9
|
@ -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";
|
||||
|
|
Loading…
Reference in New Issue