Ad Widget

Collapse

Zabbix Triggering -dynamically- disabled?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • magio
    Junior Member
    • Apr 2021
    • 5

    #1

    Zabbix Triggering -dynamically- disabled?

    Hi All, I have the following scenario and I want to expose it here to read from other opinions of what you consider is the best way to do this

    I have many devices that I am monitoring but lets simplify them as 2.

    Device A
    Device B

    Both read the same information; they poll information trough an internal network so they have data from subdevice 1, subdevice2, subdevice3, etc.
    If they receive a signal ,device A will monitor all subdevices. If they receive otherwise device B will monitor subdevices and A will stop its job.

    The thing is that A and B are always on, is almost rare that they will loose IP connectivity (they have different power, etc).
    They have different IPs so they are 2 different zabbix devices. The info they collect is -discovered- so in zabbix the info shown is the same for one or the other.

    The problem is that if A is stopped and B starts polling info... zabbix will continue "seeing" the triggers of device A that do fail because device A does not loose IP connectivity but stops monitoring.

    I can read via Http which device is enabled at any time, so that info is available.
    The question is:

    So here is what i ask:
    1) Is there any trigger or similar way I can disable the triggers of a device based on that "flag" ?
    2) If option 1 is not possible, then should I do that with a workaround using the API and may be some python script running in the background?

    Of course my preferred option is to can everything in Zabbix but if there's no way I should use the API

    Any hints or thoughts about this?

    Thanks in advance


  • ISiroshtan
    Senior Member
    • Nov 2019
    • 324

    #2
    Hi mate.

    It would be good to know how exactly you collect data from A and B. And what data is coming from previous device when switch happens?

    In general, speaking abstractly, I'd go along the direction of:
    create a single host representing information from sub-device(s) with interfaces representing Device A and Device B. Set as main the interface of device which is currently active.
    Add HTTP check to read the active device.
    Add trigger with diff() function. Add Zabbix action aimed at that trigger only, action - execute a script on Zabbix server that would take the latest value from HTTP and switch primary interface of the host to that device via API call.


    But that is general direction. Other options can be reviewed based on how and what you get. Like:

    If it's active monitoring and data stops flowing after device switch - modify trigger expression to have 'and {host.item_key.nodata(5m)}=0'
    If device sends SNMP Traps on specific situation and not the raw metrics - review SNMP Trap if it actually has specification of sub-device who sent it. Then modify SNMP Trap processing engine to use that data as host and not source IP of sender and create separate hosts for each sub-device.
    If device A/B has some other indicators of who is main (like some open ports) - might be easier to have a single host and setup HA proxy(on Zabbix or external server) that would just route traffic to currently active device...
    Similar way, if A/B can do DNS update on role change, set it up and point Zabbix on DNS name not on IP...


    I know it's not a solid solution but hope it helps in some way!

    Comment

    Working...