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

JSONPath problem - maybe... #285

Open
mikkop71 opened this issue Jan 23, 2024 · 2 comments
Open

JSONPath problem - maybe... #285

mikkop71 opened this issue Jan 23, 2024 · 2 comments

Comments

@mikkop71
Copy link

mikkop71 commented Jan 23, 2024

Hello,

Site I am trying to read returns following json data:

{
  "hrmWebFrontStatus": {
    "isAnonymousUser": true,
    "hrmWebFrontVersion": "1.6.2311.2797",
    "hrmWebFrontType": "YKS",
    "maxRequestSize": "~ 20 MiB"
  },
  "hrmBackendStatus": {
    "hrmBackendStatusOk": true,
    "hrmBackendHttpOk": true,
    "hrmBackendType": "YKS",
    "hrmBackendVersion": "1.6.2311.2797",
    "hrmBackendVersionOk": true,
    "hrmBackendDatabaseOk": true,
    "hrmBackendDatabaseVersion": 6830,
    "hrmBackendDatabaseNewestScriptVersion": 6830,
    "hrmBackendDatabaseVersionOk": true,
    "maxRequestSize": "> 30 MiB",
    "hrmBackendMalwareScanOk": true
  },
  "authStatus": {
    "authBothOk": false,
    "authHttpOk": false,
    "exception": true
  }
}

My json_exporter config is following:

modules:
  default:
    headers:
      MyHeader: MyHeaderValue
    metrics:
      - name: webfrontstatus
        type: object
        help: General statistics of the webfrontstatus
        path: '{.hrmWebFrontStatus}'
        values:
          isAnonymousUser: '{.isAnonymousUser}'
          hrmWebFrontVersion: '{.hrmWebFrontVersion}'
      - name: webbackstatus
        type: object
        help: General statistics of the webbackstatus
        path: '{.hrmBackendStatus}'
        values:
          hrmBackendStatusOk: '{.hrmBackendStatusOk}'
          hrmBackendHttpOk: '{.hrmBackendHttpOk}'
          hrmBackendVersion: '{.hrmBackendVersion}'
          hrmBackendVersionOk: '{.hrmBackendVersionOk}'
          hrmBackendDatabaseOk: '{.hrmBackendDatabaseOk}'
          hrmBackendDatabaseVersion: '{.hrmBackendDatabaseVersion}'
          hrmBackendDatabaseVersionOk: '{.hrmBackendDatabaseVersionOk}'

When I try to following command: curl http://localhost:7979/probe?target=https://xxxweb.xxx.xx/home/status?format=json
nothing seems to happen, no error messages just nothing.

Is there something wrong with the config or how I could debug situtation?

@rustycl0ck
Copy link
Member

Your query string is not URL-encoded, which might be causing this. There shouldn't be 2 ? in the url. Maybe try replacing the second ? with %3F to see if that works.

@mikkop71
Copy link
Author

Actually prometheus target formats to this url if I click the link there, but it doesn't seem to work either: http://localhost:7979/probe?target=https%3A%2F%2Fxxxweb.xxx.xx%2Fhome%2Fstatus%3Fformat%3Djson

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

2 participants