build03: add postgresql to telegraf

This commit is contained in:
zowoq 2024-05-04 20:47:25 +10:00
parent 7d9e9ec0f0
commit 2979fc5268

View file

@ -1,6 +1,18 @@
{ pkgs, ... }:
{
services.postgresql.ensureUsers = [{
name = "telegraf";
}];
systemd.services.postgresql.postStart = ''
$PSQL -tAc 'GRANT pg_read_all_stats TO telegraf' -d postgres
'';
services.telegraf.extraConfig.inputs.postgresql = {
address = "host=/run/postgresql user=telegraf database=postgres";
};
services.postgresql = {
enable = true;
# enableJIT seems to be broken, can't set a version without also needing to add withJIT