Ad Widget

Collapse

Actions based on values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nfonz23
    Junior Member
    • Jun 2024
    • 3

    #1

    Actions based on values

    Hi, We have a large-scale deployment of Zabbix. What I'm trying to do is update a host's templates and groups based on values it receives from an item, particularly on hosts running the agent.
    Previously, we did this via network discovery. We had a check run a PowerShell script to return the list of server roles installed, and based on the results, we had an action to apply a template for the DHCP, NPS DNS, etc., as well as add them to specific groups.

    For security reasons, we enabled encryption, which of course, doesn't support network discovery.

    Does anyone have a suggested solution to overcome this? We currently create hosts via an integration we built that looks up our CMDB; I can add templates and groups at this point, but I want Zabbix to automatically update the templates based on values it receives back from items.

    My ideal result is in the below example:

    1: A new host is created for Windows server and has the following template applied:
    Template OS Windows by Zabbix agent active.

    2: Item in "Template OS Windows by Zabbix agent active" returns a value for server roles that are installed, One of which is DHCP.
    3: Action is triggered to add the template for Windows DHCP Monitoring.

    4: A few months down the track the DHCP role is removed from the server and the zabbix value for server roles installed no longer has DHCP.
    5: Action is triggered to remove the template for Windows DHCP Monitoring.

    Thanks, any help appreciated!
  • Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1781

    #2
    One way is to configure a trigger on the item to raise a problem when the value is changed. The use a trigger action to run a script that does the template (dis)associations and maybe close the problem, using Zabbix API.

    Markku

    Comment

    • nfonz23
      Junior Member
      • Jun 2024
      • 3

      #3
      Thanks Markku
      I was thinking that as well, but was hoping there would be a more straightforward way / some sort of native functionality. Looks like I may be writing script for it.

      Comment

      • nfonz23
        Junior Member
        • Jun 2024
        • 3

        #4
        For anyone following along, I ended up writing a script that is executed by a trigger. The trigger passes the hostid and value of the item to the script which then updates the templates and groups.

        Thanks

        Comment

        Working...