Search code examples
prometheusprometheus-node-exporter

How to set --collector.textfile.directory in node exporter


I'm following this article about exporting metrics using textfile collector.

I did a text file /var/lib/node_exporter/textfile_collector/directory_size.prom with metrics of size of directories, but it doesn't push it to prometheus.

I read that the flag --collector.textfile.directory is responsible for the path of the dir to read from. How can I check what is the directory of the collector, and how can I change it?


Solution

  • node_exporter service file you must add

    --collector.textfile.directory=/var/lib/node_exporter/textfile_collector

    Example:

    [Unit]
    Description=Node Exporter
    After=network.target
    
    [Service]
    Type=simple
    ExecStart=/path/binary/node_exporter --collector.textfile.directory=/path/to/read/directory
    
    [Install]
    WantedBy=multi-user.target