Ad Widget

Collapse

Can I set Maintenance with regexp?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sanq
    Junior Member
    • Apr 2021
    • 15

    #1

    Can I set Maintenance with regexp?

    Hello everyone on the forum, I'm a zabbix 5.4 user.


    Depending on work schedule, I sometimes need to set up a zabbix maintenance that corresponds to a particular host name. (To avoid unwanted alarms)

    I'm working on developing it as an api.


    The question is whether the maintenance can be set using regular expressions?

    For example, when selecting all Hosts, Hostname starting with redis, I wonder can I set the maintenance hostname just redis* without specifying the node number or hostname as a whole.

    I'm really want to know how to set that


    Please help me. Thank you.
  • johndoe2374
    Member
    • Aug 2021
    • 80

    #2
    As far as I remember, you can only use wildcards (*) when you work with API. If you're creating maintenance period using API, you'll have to specify at least one host or group ID. And you can get it using get methods which supports wildcards:
    1. Get hosts or group IDs using wildcard in first API call and extract them with JSONPath or any programming language.
    2. Put those IDs into 2nd API call which creates maintenance period.

    Comment


    • sanq
      sanq commented
      Editing a comment
      thx!
      Right, zabbix 5.4 require exact host group or host.
      But I remember... zabbix 3.0 or lower supported regexp. kinda name of 'filters'... That's what I want to find.

    • sanq
      sanq commented
      Editing a comment
      I adopted your way. It is convenient to use in api. and it worked well
      Thank you.
Working...