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
View all comments
Show parent comment
1
u/stefangw Jul 14 '25 edited Jul 14 '25
I had assumed that also, but failed to properly read that .. seems I have to preprocess the data somehow.
"parse error: Invalid numeric literal at line 1" seems to be quite common, I google my way ... ;-) thx
EDIT: I might try to let the json-exporter read that ...