ansible icon indicating copy to clipboard operation
ansible copied to clipboard

enhancement(node_exporter): use systemd to create node_exporter_textfile_dir if it doesn't exist

Open ym opened this issue 1 year ago • 3 comments

We're currently using a directory inside tmpfs for textfile collectors to reduce possible unnecessary IO usage, and the directory will be removed after a reboot. This PR is to ensure that node_exporter_textfile_dir exists when node-exporter is started.

ym avatar Mar 23 '24 22:03 ym

I wonder if using systemd tmpfiles in this scenario would be a better solution? https://www.freedesktop.org/software/systemd/man/latest/tmpfiles.d.html

ping @ym

gardar avatar Oct 17 '24 13:10 gardar

I wonder if using systemd tmpfiles in this scenario would be a better solution? https://www.freedesktop.org/software/systemd/man/latest/tmpfiles.d.html

ping @ym

External scripts will also need to write to node_exporter_textfile_dir, so I think a predictable and static path might be a better idea. But if you have any good suggestions, I'm all ears.

ym avatar Oct 17 '24 14:10 ym

The path is not dynamic like what you get with mktemp, you define the path you wish to be created in a config file under tmpfiles.d and then systemd will take care of creating it.

gardar avatar Oct 17 '24 14:10 gardar