Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON key with space #113

Open
saurabhtodankar opened this issue Jul 8, 2021 · 4 comments
Open

JSON key with space #113

saurabhtodankar opened this issue Jul 8, 2021 · 4 comments

Comments

@saurabhtodankar
Copy link

saurabhtodankar commented Jul 8, 2021

{
"List": "1000000013-N-DN2804-N"
"BrkList": "DN2804",
"No of connected clients:": "1",
"No of Socket Connections:": "37",
"No of Socket Connected prop true:": "5",
"REMARKS": "OK"
}

I want to get value of "no of connected clients"
can anyone pls help me ?
thanks in advance

@qwzhou89
Copy link

have a try,pls
values:
example: '{$["no of connected clients"]}'

@saurabhtodankar
Copy link
Author

Thanks but it didnt work for me

@fredr
Copy link

fredr commented Nov 8, 2021

Not the nicest, but this seems to work. Notice that your JSON is missing a ,, and many of the keys include :

metrics:
- name: connected_clients
  type: value
  path: "{$['No\\ of\\ connected\\ clients:']}"

@thewangcj
Copy link

i had the same issue,according to #114,i config like below and it works
json:

    {
        "data": {
            "FAN1": [
                {
                    "Device": "FAN",
                    "Fan": "F1",
                    "Speed (RPM)": "9398.00",
                    "Status": "OK"
                },
                {
                    "Device": "FAN",
                    "Fan": "F2",
                    "Speed (RPM)": "8953.00",
                    "Status": "OK"
                }
            ],
        },
        "executed_command": "show fan",
        "status": "OK",
        "status_message": ""
    }

config:

  metrics:
  - name: speed_rpm
    path: '{ .data.FAN1[0] }'
    type: object
    labels:
      device: '{.Device}' # static label
    values:
      speed: '{.Speed\ (RPM)}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants