Csv file import and scrape metrics into Prometheus

3,006 views
Skip to first unread message

Shruthi P

unread,
Sep 9, 2022, 6:19:09 AM9/9/22
to Prometheus Users
Hi All,
I have a csv and yaml file with some data. I want prometheus to monitor the data and add metrics for the data to finally use it in grafana for visualization /
Please give pointers there

Brian Candler

unread,
Sep 9, 2022, 8:21:55 AM9/9/22
to Prometheus Users
Are you saying these csv / yaml files are static (containing historical data only), or are they changing?

If they are static, then you need to backfill the data into prometheus:

It's up to you to convert the csv data into openmetrics format

If they are changing, then you'll need to write an 'exporter' to allow prometheus to 'scrape' the data, which means reading the most recent values of each metric.

Olivier Harand

unread,
Sep 9, 2022, 9:34:36 AM9/9/22
to Shruthi P, Prometheus Users
Hello everyone, 

In a personal small lab, i remember that i did convert a CSV to SQlite, then used one of the SQL / Query exporter available to move the data to Prometheus. So i could trace the changes, evolution over time, requesting data with promQL in Grafana Dashboards. 

If you are not interested in viewing the changes over time, better use a SQLite or even CSV datasource in Grafana. 

Have a good day ! 

--
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 prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/70d0b2b8-814e-4f51-8388-d24701c968bfn%40googlegroups.com.


--

Olivier Harand

Chief Monitoring Officer

+33012028
+33783296234
olivier...@outscale.com
319 Bureaux de la Colline - 92210 Saint-Cloud

IMPORTANT : The information contained in this message may be privileged and confidential and
protected from disclosure. If the reader of this message is not the intended recipient, or
an employee or agent responsible for delivering this message to the intended recipient, you
are hereby notified that any dissemination, distribution or copying of this communication is
strictly prohibited. If you have received this communication in error, please notify us immediately
by replying to the message and deleting it from your computer.

Pradumn Mishra

unread,
Feb 13, 2023, 6:42:54 AM2/13/23
to Prometheus Users
I have a similar usecase where I have json files with metrics which also has Timestamps (string format). Do I need to  backfill the data into prometheus or write a exporter. I have tried the latter. so a sample of my data has :
{some attributes (including timestamp)} value
I used the observable gauge using Measurment<T> in C#. 
But the metric I am getting in prometheus is like this:
metric_name{attribute1:attribute1_value, .........timestamp:timestamp_value} value timestamp
I want the my timestamp_value present in the attribute to be the actual timestamp of the prometheus and not the current timestamp recorded by prometheus. Any suggestions???
Reply all
Reply to author
Forward
0 new messages