Skip to content

confused by labels, names, values #343

Open
@stefangweichinger

Description

@stefangweichinger

Forgive me asking newbie questions maybe, I am new to this json handling thing and trying to learn things right.

I use json_exporter successfully for extracting values from various appliances at a customer already.

Right now I try to

 # cat inst.json 

{
  "INST_VALUES": {
    "LOCAL_TIME": "2024-07-25T16:51:01+01:00",
    "V_L1": {
      "value": 229.906,
      "unit": "V"
    },
    "V_L2": {
      "value": 231.950,
      "unit": "V"
    },
    "V_L3": {
      "value": 231.341,
      "unit": "V"
    },
    "V_L12": {
      "value": 398.990,
      "unit": "V"
    },
    "V_L23": {
      "value": 401.072,
      "unit": "V"
    },

[..]

At first I tried something like:

  siemens_pac_inst:
    headers:
      X-Dummy: my-siemenspac-header3
    metrics:
    - name: inst_values
      type: object
      path: '{ .INST_VALUES }'
      help: somehelp
      values:
        V_L1: '{.V_L1}'
        V_L2: '{.V_L2}'
        V_L3: '{.V_L3}'
        V_L12: '{.V_L12}'
        V_L23: '{.V_L23}'

[..]

but I assume it should be more like

    - name: inst_values
      type: object
      path: '{ .INST_VALUES.V_L1 }'
      help: somehelp
      values:
        V_L1: '{.value}'

I also assume there is an elegant way of iterating over all these values ... but I could need some example and help for doing so.

If possible: is there an explanation for when to use labels and names?
I have modules in place and get metrics but I think my naming might be sub-optimal ...

thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions