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

New monitor proposed "HTTP(s) - JSON Custom Function" #2431

Closed
1 task done
alexmaurer-madis opened this issue Dec 18, 2022 · 0 comments · Fixed by #3253
Closed
1 task done

New monitor proposed "HTTP(s) - JSON Custom Function" #2431

alexmaurer-madis opened this issue Dec 18, 2022 · 0 comments · Fixed by #3253
Labels
feature-request Request for new features to be added

Comments

@alexmaurer-madis
Copy link

alexmaurer-madis commented Dec 18, 2022

⚠️ Please verify that this feature request has NOT been suggested before.

  • I checked and didn't find similar feature request

🏷️ Feature Request Type

New Monitor

🔖 Feature description

Some services require more complex checks of the response than a simple KEYWORD or REGEX to perform the validation "Status UP" or "Status DOWN".

It would be awesome to be able to allow custom Javascript code to be run against a parsed JSON Object from an HTTP(s) response.

  • The parsed JSON Object could be accessible from the custom JavaScript code as a variable named "msg" for example.
  • The custom Javascript code must return true or false or an array for more precise result.

✔️ Solution

This could be achieved by the creation of a new Monitor "HTTP(s) JSON Custom Function" derived from the "HTTP(s) - Keyword".

In the UI a new text zone to write the custom JavaScript code.

❓ Alternatives

No response

📝 Additional Context

This idea is inspired from the node-red "Function" node

Take for example the following simplified JSON response we typically encounter with the Syncthing API GET /rest/system/status

{
    "connectionServiceStatus":{
        "tcp://0.0.0.0:22000":{
            "error":null
        },
        "dynamic+https://relays.syncthing.net/endpoint":{
            "error":null
        }
    },
    "discoveryStatus":{
        "IPv4 local":{
            "error":null
        },
        "IPv6 local":{
            "error":null
        }
    }
}

connectionServiceStatus and discoveryStatus can contain multiple error fields to check and this could be easily achieved with custom Javascript code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features to be added
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant