Atomically write to output file
Prometheus' node exporter wants to scrape the metrics from a file. As we have no control over when this file is read, the script should write directly to this file in an atomic way, e.g. by using the method described in the Node Exporter documentation.