I have grafana-agent on a Linux node and I am getting the metric into the dashboard. So far, so good.
I have a custom script (say foo.py) that computes some matrices. Currently, I am writing these metrics onto console. I am thinking of appending these metrics to a file let the node_exporter's textfile collector collects the metric. Is this a decent approach?
If I take this route, I have a question:
Can foo.py appending metrics to a prom file and file textfile will keep track of what is new in the metrics file? Or should I delete the old file and create a new one every time there is a new metric?
I really like using the textfile collector. But, I’ve also used the python prometheus client to record the output from a periodic script, and it works even better.
This is mostly boilerplate code and maybe a useful place to start re the exporter: