Ad Widget

Collapse

Zabbix 5 API Query maintenance.get Only Current Window With Specific Tags

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ccsonetwo
    Junior Member
    • Dec 2023
    • 8

    #1

    Zabbix 5 API Query maintenance.get Only Current Window With Specific Tags


    Hey all, a little patience here please. I'm new to the zabbix api and I'm trying to create a query that will return all the current maintenance windows with a specific tag. I've read the documentation and unfortunately I am either not understanding it or having problems with getting it to work.

    My query looks like this:

    Code:
    {
        "jsonrpc": "2.0",
        "method": "maintenance.get",
        "params": {
            "groupids": "<gid>",
            "selectTags": [
                "tag",
                "value"
            ],
            "filter": [
                {
                    "tags": [
                        {
                            "tag": "<tag1>",
                            "value": "<value1>",
                            "operator": 0
                        }
                    ]
                }
            ]
        },
        "auth": "<token>",
        "id": 1
    }
    Unfortunately this will return all the maintenance windows for the <gid>, expired and with other tags. Is there a way to get just the current maintenance with specific tags? Should I be iterating over the returned maintenance instances instead?

    End goal here is to create a script that will return the existing and current maintenance windows that apply to a specific group. Am I using the wrong query?
Working...