Ad Widget

Collapse

Disable hosts when these are offline for some time and re-enable when back online

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • geoffke
    Junior Member
    • Dec 2020
    • 7

    #1

    Disable hosts when these are offline for some time and re-enable when back online

    Hope you guys can help me out.

    We have about 2000 hosts where 90% of them are installed as active monitoring using the Zabbix agent and the rest are mainly printers and network equipment using SNMP. We work in shifts which means that about 400 hosts or more can go offline per shift. Meaning that if the late shift comes up, the people from the morning shift close down their forklift terminals so the forklift can charge until a new morning shift starts. During these "offline" periods the Zabbix queue goes up quite high due to item values not being collected.

    If we disable these hosts the queue comes back to normal off course, but we cannot do this manually each time. Is there any way I could prevent the queue to go up during these offline periods? I have tried to look at maintenance rules, but this doesn't work as we do not know which devices will go offline.
    I have tried to write a script using the API, which works on the trigger "Zabbix agent not available" and puts the host in disabled state, but then it is not possible to re-enable it again automatically since the host is disabled and there is no recovery possible from the trigger. I thought auto-registration would take care of this adding "enable host" to the operations, but this doesn't work either. It seems that once the agent has registered, it doesn't re-register when coming back online.

    Thanks!
    Geoff.
    Last edited by geoffke; 12-01-2021, 17:57.
  • NilsA
    Senior Member
    • Sep 2020
    • 102

    #2
    You could try to disable all other items on the host. That way you won't get the huge queue and you will be able to have them enabled again once the agent is online again.

    Comment


    • geoffke
      geoffke commented
      Editing a comment
      That would be a way I guess, but we do have some items that are disabled on certain hosts, so we would need to put the state somewhere in a logfile then to remember. That way if we re-enable the items once the agent is online, it doesn't enable the items that were disabled before applying this process...
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #3
    Maintenance periods? Hostgroups by shifts and then you can set those hosts in maintenance mode, with or without data collection...

    Comment


    • geoffke
      geoffke commented
      Editing a comment
      Yes I know that is the proper way to do it. But unfortunately we do not have control over these hosts, meaning most of them are forklifts and sometimes these get swapped over weekends. Our hosts wouldn't match our shift groups that long... I thought there would have been an automated way to do this using API and the autoregister feature, but that doesn't work.
Working...