Ad Widget

Collapse

Warranty expiry date for hosts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ltte
    Junior Member
    • Jan 2025
    • 3

    #1

    Warranty expiry date for hosts

    Dear Zabbix community members,

    Please advise me the best way to create a trigger action (send mail) on Warranty expiry date
    from host inventory field based on "Date HW purchased" increased with 36 months.
    I would like that Zabbix send reminder 30 days, 15 days, 7 days, 3,2 and 1 day before monitored
    host warranty expiring.
    Any suggestions would be highly appreciate.

    Have a nice day.
    Regards,
    Ltte


  • Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    #2
    I will briefly describe the steps to a possible solution.:
    1) Before saving the date in the inventory data, convert it to unixtime using js dpreprocessing
    2) create several dependent triggers that are triggered at your thresholds
    3) in the expression of triggers, compare the difference between a {INVENTORY.blabla} macro and the now() function with the required interval.

    Comment

    • ltte
      Junior Member
      • Jan 2025
      • 3

      #3
      Thank you for yours fast reply.
      I will try to implement it based on yours recommendation and inform the community.
      Maybe someone will need it as well in the future.

      Regards,
      Ltte

      Comment

      • ltte
        Junior Member
        • Jan 2025
        • 3

        #4
        I managed to create triggers and send mails on warranty expire reminder 30 days, 15 days, 7 days, 3,2 and 1 day before monitored
        host warranty expiring. I post my solution (so far) - this could be useful to someone in the future.

        This solution is not universal so I'm not 100% satisfied on the solution.

        - I was not able (or probably did not find appropriate way) to read field "Date HW purchased" on host inventory. Instead that I created
        a macro and fill the universal value for {$INVENTORY.HW.DATE.PURCHASE} with pre calculated value

        In Administration - Macros I defined a value for {$INVENTORY.HW.DATE.PURCHASE} in the form of YYYYMMDD (ie. 20250228)
        If someone is able to put me in the right direction I would be grateful.

        - I created a new calculated item for the host (with key host.warranty.expires.days) with the formula
        {$INVENTORY.HW.DATE.PURCHASE}-date() type number (unasigned)
        I calculate this value once a day so the set Update interval 1d

        - Then I created a trigger for every host based on the value of host.warranty.expires.days for every requested days (30 days, 15 days, 7 days, 3,2 and 1 day before and
        after warranty expired) with severity INFORMATION
        For 30 days before warranty expires
        Trigger name "Warranty for host_name expires in 30 days"
        last(host_name/host.warranty.expires.days)<=30 and last(host_name/host.warranty.expires.days)>=29
        Trigger name "Warranty for host_name expires in 15 days"
        For 15 days before warranty expires
        last(host_name/host.warranty.expires.days)<=15 and last(host_name/host.warranty.expires.days)>=14

        And so on for every host and every requested value

        - I created Trigger action for every trigger for every host. in Alerts - Actions - Trigger Actions

        This is working solution but require creating lots of triggers and triggers action and require to create an calculated item for every single host.
        Since we expect to have in the future more than 200 monitored hosts (that would have different expiry warranty date)
        that would create more than 1400 triggers just for this parameter is there any way to automatize this.
        Any suggestion on my solution and further upgrade would be welcomed.

        Sorry for may bad english I hope that I'm clear enough.
        We are using Zabbix 7.0.8 on Debian 12.

        Regards,
        Ltte

        Comment

        Working...