Ad Widget

Collapse

system.uptime incorrect format when sending email notifications

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fndz
    Junior Member
    • Apr 2024
    • 9

    #1

    system.uptime incorrect format when sending email notifications

    Hello,

    I'm using Zabbix v6.4.13 and having trouble using proper syntax to display host information in correct format when sending email notifications (using trigger actions) in HTML format. For some reason it does not recognize host.ip, system.uptime displays value in seconds instead of readable format. CPU and Memory should be displayed in %.
    Click image for larger version

Name:	image.png
Views:	427
Size:	74.7 KB
ID:	482059
    Click image for larger version

Name:	image.png
Views:	407
Size:	13.6 KB
ID:	482062
    Click image for larger version

Name:	image.png
Views:	329
Size:	12.1 KB
ID:	482063​​
    {HOST.NAME} ({HOST.IP})
    {?last(/{HOST.HOST}/system.uptime)}
    {?last(/{HOST.HOST}/system.cpu.util)}
    {?last(/{HOST.HOST}/vm.memory.util)}​

    Result:
    Click image for larger version

Name:	image.png
Views:	334
Size:	16.4 KB
ID:	482061
    I searched throughout the forum and not sure if i'm the one making a syntax error or is this some kind of bug. What do i need to fix?​​
    Attached Files
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    But... system uptime is stored in seconds... You are querying the last value as it is in DB, so that's exactly how you get value... in seconds..
    For some things macro functions may help https://www.zabbix.com/documentation...acro_functions

    about HOST.IP... do you have a value in hosts config for that?

    Comment

    • Fndz
      Junior Member
      • Apr 2024
      • 9

      #3
      Hello,
      I'm new to Zabbix so still trying to figure out things. So if the data from system.uptime is getting fetched exactly as it is, is there some way to convert it to display in format HH:mm:ss ?
      As for Host.ip, i suspected that it will be somewhere in hosts config, but as soon as I input the IP address into the config file, i lose connection to it:
      Click image for larger version

Name:	image.png
Views:	333
Size:	56.5 KB
ID:	482174
      Click image for larger version

Name:	image.png
Views:	305
Size:	15.1 KB
ID:	482175

      Comment

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

        #4
        If you do not have any passive checks, then that part stays unknown... Your active checks seem to be working ok. If that IP field stays empty, then its normal that your script says UNKNOWN, it just has nothing to put there...

        Comment

        • Fndz
          Junior Member
          • Apr 2024
          • 9

          #5
          Thank you for clarification about Host.IP.

          Regarding the macros, here is the code i tried:

          {{?last(/{HOST.HOST}/system.cpu.util)}.fmtnum(2)}%
          {{?last(/{HOST.HOST}/vm.memory.util)}.fmtnum(2)}%

          Here is the result:
          Click image for larger version

Name:	image.png
Views:	309
Size:	8.4 KB
ID:	482267
          What am I doing wrong?

          Comment

          • Fndz
            Junior Member
            • Apr 2024
            • 9

            #6
            Any ideas?

            Comment

            • runwu2012
              Junior Member
              • Nov 2024
              • 1

              #7
              Fndz hey,i have solved the cpu usage percent . we should use zabbix function "round()" instead of macros "fmtnum()".
              below is my code:
              CPU Usage: Latest:{?round(last(/{HOST.HOST}/system.cpu.util),2)}
              And if we use email with html format, use `%` as the symbol %

              Comment

              Working...