Debian Codegraph @

docs/content/exporting/textfile.md

raw symbols SCIP
1 ---
2 title: Node exporter textfile collector
3 weight: 2
4 ---
5
6 The [textfile collector](https://github.com/prometheus/node_exporter#textfile-collector)
7 allows machine-level statistics to be exported out via the Node exporter.
8
9 This is useful for monitoring cronjobs, or for writing cronjobs to expose metrics
10 about a machine system that the Node exporter does not support or would not make sense
11 to perform at every scrape (for example, anything involving subprocesses).
12
13 ```python
14 from prometheus_client import CollectorRegistry, Gauge, write_to_textfile
15
16 registry = CollectorRegistry()
17 g = Gauge('raid_status', '1 if raid array is okay', registry=registry)
18 g.set(1)
19 write_to_textfile('/configured/textfile/path/raid.prom', registry)
20 ```
21
22 A separate registry is used, as the default registry may contain other metrics
23 such as those from the Process Collector.