Ad Widget

Collapse

Stop item preprocessing automatically ignoring leading zeros

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vanmaelst
    Junior Member
    • Sep 2023
    • 2

    #1

    Stop item preprocessing automatically ignoring leading zeros

    Hello,

    An SNMP item is sending a 64 bit bitmask, like "000101000000000000100000000000000000000000000 0000 000000000000000". For some reason, the least significant bit is to the left in this notation.
    I know the flag which each bit represents, and have written a javascript preprocessing step that converts this into a string with more verbose information about the flags, but I notice that even though I only specify to right trim the zeroes, as soon as I do any operation on this incoming value, it automatically ignores the leading zeroes:
    (so the resulting string contains incorrect information)

    Click image for larger version

Name:	image.png
Views:	145
Size:	33.9 KB
ID:	474389

    I'm fairly certain it's not a javascript issue. Inside javascript, the trimmed string is treated as a binary number, but zabbix seems to treat it as an integer. Is there any way to stop this behaviour, or maybe add a fixed number (2^64) to create a nonzero least significant bit?​
  • Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    #2
    When multiplied by a number ("Custom multiplier" step), the type is automatically converted from string to number w\o leading zero.

    Comment

    Working...