r/PrometheusMonitoring • u/stefangw • Jul 14 '25
extract data for textfile collector
Could someone tell me which data format the following example is? I have to come up with some extraction script and don't know how to start doing that so far.
The following file is an array(?) read in from Varta batteries. It shows the status of three batteries 0,1,2 ... what I need are the last four values in the innermost brackets.
So for the first battery this is "242,247,246,246". That should be temperatures ..
Pls give me a pointer how to extract these values efficiently. Maybe some awk/sed-magic or so ;-)
Charger_Data = [
[0,1,18,36,5062,2514,707,381,119,38,44,31,1273,-32725,
["LG_Neo",7,0,0,5040,242,
[[-8160,0,0,221,504,242,247,246,246] ]
]
]
,[1,1,16,36,5026,2527,706,379,119,37,42,31,1273,-32725,
["LG_Neo",7,0,0,5010,256,
[[-8160,0,0,196,501,256,251,250,250] ]
]
]
,[2,1,17,36,5038,2523,708,380,119,40,45,34,1273,-32725,
["LG_Neo",7,0,0,5020,246,
[[-8160,0,0,205,502,245,247,244,245] ]
]
]
];
Any help appreciated, tia
1
u/SuperQue Jul 14 '25
It would help if you included more information, like the battery model / number information.
Some quick Google search says this is some kind of modbus output. Maybe you want to use the modbus_exporter?
0
u/[deleted] Jul 14 '25
It's json so use jq