On Monday, 30 January 2023 at 21:46:39 UTC [email protected] wrote:
*Example CSV file: *
testserver1,service1,stopped
testserver1,service2,running
testserver2,service1,running
testserver2,service2,stopped

I should add: I notice that the CSV sample data isn't timestamped, so it 
seems that every 30 minutes you just want to ingest the *current* versions 
of those values, not any previous history of what's been going on over the 
last 30 minutes.  In that case, it is pretty straightforward:

* On a host of your choice (which could be the prometheus server itself), 
run node_exporter with the textfile collector 
<https://github.com/prometheus/node_exporter#textfile-collector> enabled:   
--collector.textfile.directory=/var/lib/node_exporter

* Whenever you get a new CSV file, run it through a simple script (which 
you'll have to write yourself) to convert it into openmetrics format.  In 
this case, the output would be:

foo_status{instance="testserver1",service="service1",state="stopped"} 1
foo_status{instance="testserver1",service="service1",state="running"} 0
foo_status{instance="testserver1",service="service2",state="stopped"} 0
foo_status{instance="testserver1",service="service2",state="running"} 1
foo_status{instance="testserver2",service="service1",state="stopped"} 0
foo_status{instance="testserver2",service="service1",state="running"} 1
foo_status{instance="testserver2",service="service2",state="stopped"} 1
foo_status{instance="testserver2",service="service2",state="running"} 0

* Write this to /var/lib/node_exporter/my_status.prom.new, and then rename 
/var/lib/node_exporter/my_status.prom.new to 
/var/lib/node_exporter/my_status.prom

* Configure prometheus to scrape node_exporter at least once every 2 
minutes - I'd recommend once per minute or more.

These metrics will then appear in prometheus, and will be updated whenever 
you decide to update the CSV file.

Longer term, you can consider changing the process for collecting this data 
so that it is exposed directly in openmetrics format and can be scraped 
directly.

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/78423731-11c3-432e-b5ae-5d60d9c50aa8n%40googlegroups.com.

Reply via email to