Given a list of readings in the following format:
1 1 0 0 2 3 23101 23101 0 0 2 0 5 2 0 0
1 1 0 0 2 2 23104 23104 0 0 1 0 5 1 0 0
What would be an approriate (and clean !) way to map them to their labels (the labels are not in a fixed format, I just know from the documentation that column 1 maps to X, column 2 maps to Y etc. etc.).
The output is going into a text file for prometheus to read, so the desired format would be a two line format as follows:
# TYPE label_goes_here counter
label_goes_here value_goes_here
Ideally I would like this to use sh or ksh native tools. perl is ok too as its widely installed as default, unlike, say, python.
Edit to add example:
Given:
1 1 0 0 2 3 23101 23101 0 0 2 0 5 2 0 0
We could expect the output to look like:
# TYPE name_of_label_1 counter
name_of_label_1 1
# TYPE name_of_label_2 counter
name_of_label_2 1
# TYPE name_of_label_3 counter
name_of_label_3 0
etc.
etc.
# TYPE name_of_label_16 counter
name_of_label_16 0