cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

API to add monitoring rule on host or Host Group

Julien
Visitor

Hello,

Will be great to have an API to create/update/delete monitoring rule for a host or a hostgroup.

For example, in the GUI, we have to go on Hosts (or Host groups)> Settings > Process availability > Add monitoring rule

Thanks

3 REPLIES 3

Ingrida
Mentor

Hi Julien,

 

Ever tried settings API? (schema builtin:processavailability)

 

Example to call all defined rules:

 

https://[dtenv]/api/v2/settings/objects?schemaIds=builtin%3Aprocessavailability&fields=objectId%2Cvalue

 

Output:

{
  "items": [
    {
      "objectId": "vu9U3hXa3q0AAAABABtidWlsdGluOnByb2Nlc3NhdmFpbGFiaWxpdHkABEhPU1QAEDY2NkU0OTUxRTA3MDI1NTYAJGMyNGY2NDBlLTYzZGItMzllZS04Nzk4LTRmMjMxNDg5ODJkML7vVN4V2t6t",
      "value": {
        "enabled": true,
        "name": "Test",
        "rules": [
          {
            "property": "executable",
            "condition": "$contains(Elastic)"
          }
        ],
        "metadata": [
          {
            "metadataKey": "test",
            "metadataValue": "test_value"
          }
        ]
      }
    },
...

 

Regards,

Ingrida

 

Julien
Visitor

Hello Ingrida,

 

It works.

Thanks a lot

 

Regards,

 

Julien

Karolina_Linda
Community Team
Community Team

I'll convert the idea to a question in the Dynatrace API forum then 🙂

 

Thanks a lot for sorting this out so quickly!

Keep calm and build Community!

Featured Posts