nixos-module: add collectd postgresql metrics
This commit is contained in:
parent
83bbbe7ae2
commit
50d9795e6e
|
@ -157,6 +157,30 @@ in
|
|||
GRANT ALL PRIVILEGES ON DATABASE caveman TO ${dbUser};
|
||||
'';
|
||||
};
|
||||
services.collectd.plugins.postgresql = ''
|
||||
<Query hosts_with_tokens>
|
||||
Statement "select count(distinct host) from instance_tokens;"
|
||||
<Result>
|
||||
Type gauge
|
||||
InstancePrefix "unique"
|
||||
ValuesFrom "count"
|
||||
</Result>
|
||||
</Query>
|
||||
<Query total_tokens>
|
||||
Statement "select count(*) from instance_tokens;"
|
||||
<Result>
|
||||
Type gauge
|
||||
InstancePrefix "total"
|
||||
ValuesFrom "count"
|
||||
</Result>
|
||||
</Query>
|
||||
|
||||
<Database ${config.networking.hostName}>
|
||||
Param database "caveman"
|
||||
Query total_tokens
|
||||
Query hosts_with_tokens
|
||||
</Database>
|
||||
'';
|
||||
|
||||
systemd.services.caveman-hunter = lib.mkIf cfg.hunter.enable {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
|
Loading…
Reference in New Issue