Ad Widget

Collapse

Item units Kilo instead of Mega

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Tex74
    Junior Member
    • Dec 2021
    • 22

    #1

    Item units Kilo instead of Mega

    Hi there,

    I monitor a receiver oid and get operational frequency in Hz with a discovery.
    The frequency is for example 2182000 Hz and the value I read round it to 2.18 MHz

    There are 2 ways the value would be readable for us:
    2.182 MHz
    2182 Khz
    I tried preprocessing like "return(Math.round(value* 10000) / 10000)" but it doesn't change a thing.

    Is there a way I can manage this for this specific item? (zabbix 5 at this time)
    If not, I'll remove units information

    Regards,
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4806

    #2
    I think there is no option to change the precision.. Or highest level to round it ...

    Comment

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

      #3
      What values do you see in the "latest data" for this item (view as history)?
      2182000 or 2.18 ?
      Last edited by Hamardaban; 25-10-2024, 07:12.

      Comment

      • Tex74
        Junior Member
        • Dec 2021
        • 22

        #4
        The value in history is 2182000

        Comment

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

          #5
          You have an automatic unit conversion triggered. https://www.zabbix.com/documentation...nit-conversion

          Here the number of decimal places displayed is fixed (2). You can change it by changing the frontend code (php).

          But there is a simpler option! Create a dependent item (named for ex "frequency in kilohertz") in which divide your value by 1000 (in preprocessing) and put an exclamation mark in the UNIT field.​

          Comment

          • Tex74
            Junior Member
            • Dec 2021
            • 22

            #6
            I've been thinking of this simpler solution but my original item comes from a discovery in a template I created.
            It seems that discovery item cannot be a master item. Not in host's item, in template's item nether.

            Comment

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

              #7
              No a problem! Use preprocessing at the discovered item to divide value by 1000 and so on

              Comment

              • Tex74
                Junior Member
                • Dec 2021
                • 22

                #8
                Thanks Hamardaban.
                This workaround works fine with with a frequency like I used in my example. Unfortunatly it won't when my frequency change like this 2187500 Hz
                I had 2.19 Mhz at first time and when I divide by 1000 the Item, with the exclamation mark, I get 2187 KHz, not 2187.5 Khz

                I'll go back without units or with !Hz and this will be ok.
                Thanks for the exclamation mark solution.

                Comment

                Working...