Ad Widget

Collapse

String of bits - how to evaluate a single bit?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sovr
    Junior Member
    • May 2013
    • 6

    #1

    String of bits - how to evaluate a single bit?

    Hi everyboody,
    I'm using Zabbix 1.8.13 and I'm monitoring an SNMP host which returns its status as a sting of bits in which each bit carries information.

    I'd like to set triggers according to the status of each bit.

    E.g. strings received "01100010"

    trigger 1: if first bit = 1 then "memory fault"
    trigger 2: if second bit = 1 then "processor load too high"
    etc...

    could anyone please suggest how to?

    I made some Google search and found not much on it, sorry if this issue has been already discussed.

    Thanks in advance,
    sovr
  • nilie
    Junior Member
    • May 2013
    • 16

    #2
    Is the returned value a character string or an unsigned binary ?

    Comment

    • sovr
      Junior Member
      • May 2013
      • 6

      #3
      It's a character string.

      Comment

      • nilie
        Junior Member
        • May 2013
        • 16

        #4
        I haven't got the chance of doing this myself but I would give it a try like this :
        - create a character type SNMP item for the desired OID
        - create regular expressions to match the position for each one of the relevant bit (the 2nd, the 3rd etc.)
        - create a trigger using the regexp function that will test the presence of character 1 in the position dictated by the regular expression you build in previous step

        Comment

        • sovr
          Junior Member
          • May 2013
          • 6

          #5
          it works great thank you!

          Unfortunately, I found out that the SNMP host actually doesn't return its status as string of bits, but as a decimal coded integer!

          Hard to find which bits are 'up' in such integer...any idea?
          Since it's a different topic, I'll open a new thread.

          Thanks a lot anyway.
          Sovr

          Comment

          Working...