Ad Widget

Collapse

Time() Function Not Working As Expected

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sbsjclark
    Junior Member
    • Nov 2011
    • 14

    #1

    Time() Function Not Working As Expected

    I don't want alerts for servers that reboot at night (between 6PM to 6AM), so I took the default "Host has been restarted" trigger and added "and time()>060000 and time()<180000" to the function.
    I've verified the Zabbix server time and the agent server time are correct and the triggers show the correct time of detection, but don't honor the function and trigger at inappropriate times.
    Am I missing something? Thanks fin advance for any hep provided.

    I Click image for larger version

Name:	image.png
Views:	235
Size:	26.4 KB
ID:	484717
    Click image for larger version

Name:	image.png
Views:	182
Size:	93.5 KB
ID:	484718
  • stanton79
    Junior Member
    • Jan 2020
    • 6

    #2
    You can try this

    last(/SERVER1,cole.local/system.uptime)<10m and (time()>060000 or time()<180000)

    Comment

    • cyber
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2006
      • 4807

      #3
      Originally posted by stanton79
      You can try this

      last(/SERVER1,cole.local/system.uptime)<10m and (time()>060000 or time()<180000)
      OR will never work there... take for example... 050000 ... if you put it to above equation... it becomes (FALSE OR TRUE) which results in TRUE... And it will trigger at any time.

      What happens if you use 600 instead of 10m ?

      Code:
      last(/SERVER1,cole.local/system.uptime)<600 and time()>060000 and time()<180000
      your data is in seconds... its value will not be 10m in DB... its 600

      Comment

      • sbsjclark
        Junior Member
        • Nov 2011
        • 14

        #4
        Thanks for the responses.
        The default trigger last(/SERVER1,cole.local/system.uptime)<10m was and is working fine, so not sure why that would be of concern. Nevertheless, I changed it to 600 and it works exactly the same way as the 10m format.
        The issue is that the addition of and (time()>060000 and time()<180000) is not working as expected to only allow be true between 0600 and 1800 hours, and the trigger fires at times outside that range.

        Comment

        • Markku
          Senior Member
          Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
          • Sep 2018
          • 1781

          #5
          What is your Zabbix version?

          Markku

          Comment

          Working...