Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Help Needed in Writing New exporter for CSV file(comma separated value)

19 views
Skip to first unread message

Navjyot Ramteke

unread,
Dec 13, 2024, 4:26:48 AM12/13/24
to Prometheus Developers
Hi All,
          We have a process which periodically writes all the stats into a CSV file in one folder(in linux virtual machine). The name of the file will contain the date and timestamp to distinguish different files. 

folder contents:
stats_13_12_12_00.csv >>> 13th dec, 12 am
stats_13_12_12_05.csv
stats_13_12_12_10.csv
stats_13_12_12_15.csv
stats_13_12_12_20.csv
stats_13_12_12_25.csv

in this example, our process will keep writing new file every 5 min. so next file will be written at time 12:30.
the format of the file is given below.

csv file format:
720,500,300,10,"abc",0,,120

this file will contains values corresponding to various stats. the ordering is fixed.
in this example
total_bytes = 720
input_bytes =  500
output_bytes = 300
dropped_bytes =  10
interface_name = abc
error_count = 0
invalid_pkt =  <not applicable. hence its value is NULL>
charged_bytes = 120

we will have 3000-5000 such variables in each file.
Now we wanted to fed these variables in Prometheus so that it can be viewed on Grafana.
is there any existing exporter which we can use it?
if no, can we enhance some existing exporter?
else any help in writing exporter from scratch.


Regards
Navjyot.






Benjamin Ridley

unread,
Dec 18, 2024, 7:30:48 AM12/18/24
to Navjyot Ramteke, Prometheus Developers
One easy way might be to utilise the Textfile Collector, which is part of the Node Exporter, and allows you to expose files on your system for collection by Prometheus.

In this case, you would need to write some kind of script that reads your statistics files, then spits out textfile that contains the metrics, and Node exporter will then serve them.

You can find example scripts here that will give you examples of how to create the text file.

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/prometheus-developers/0607f0e7-201a-4b8c-b286-a39648bbb1f5n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages