Prometheus isn't designed to be used this way. The normal operating mode of 
prometheus is "scraping", where it makes a periodic outbound HTTP call (say 
once per minute) to fetch the *current* version of each metric, and ingest 
it into its database.

In particular you should note:

1. There is a "backfill 
<https://prometheus.io/docs/prometheus/latest/storage/#backfilling-from-openmetrics-format>"
 
capability but the data has to be in Openmetrics format, not CSV.  And 
there are a number of restrictions, like not being able to import data from 
the last 3 hours. It's really just for importing historical data, with new 
data coming from regular scrapes.

2. All metrics in Prometheus are numeric; you can't have values like 
"stopped" or "running".  To model that, you'd normally make an enumerated 
set of timeseries:

foo_state{instance="testserver1",service="service1",state="stopped"} 1
foo_state{instance="testserver1",service="service1",state="running"} 0

3. You *could* write a program which reads your CSV every half hour, and 
then uses the remote_write 
<https://prometheus.io/docs/prometheus/latest/storage/#remote-storage-integrations>
 
capability to post the data to Prometheus.  But you're going to have to do 
all that integration work yourself, i.e. it involves programming against 
the remote write API.  I don't see any existing integration 
<https://prometheus.io/docs/operating/integrations/#remote-endpoints-and-storage>
 
for CSV.

In short: you're using Prometheus the wrong way, and if you need to work 
this way you're probably better off using a different database.

On Monday, 30 January 2023 at 21:46:39 UTC [email protected] wrote:

> Hi,
>
> I need help on how to import the below sample csv file every 30 mins into 
> prometheus server in order to see the trend of down services. Can you help 
> me with an example & documentation if any?
>
> *Example CSV file: *
> testserver1,service1,stopped
> testserver1,service2,running
> testserver2,service1,running
> testserver2,service2,stopped
>
> Prometheus URL: http://localhost:9090
>
>
> Thanks
> Sandosh
>

-- 
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/a1a6a77f-7b91-4adc-9249-25830c733b48n%40googlegroups.com.

Reply via email to