Ad Widget

Collapse

Using value mapping with bitmapped values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mitchpeter
    Junior Member
    • Nov 2022
    • 8

    #1

    Using value mapping with bitmapped values

    I am using Zabbix 5.4 to monitor photocopiers (among other things) at a school. I have a calculated item which contains a numeric status code from the copier (values from 0 to 255), and I have a trigger which shows the status code as operational data when its value indicates there are problems.
    I want to get a meaningful message instead of the code. This sounds like a value mapping, but the code values are bit-mapped so each code from 0 to 255 would need a different string. For example 128 indicates low paper and 32 indicates low toner, but 160 indicates low paper and low toner.
    1. Is there a more feasible way I can generate a string from the calculated item to describe the problems that are present?
    2. What is the correct way to get this string to be displayed in the operational data?​
  • PeterZielony
    Senior Member
    • Nov 2022
    • 146

    #2
    you have int as only values and have them represented as string only when triggered in operational data in notification or dashboard?
    If you care for notification as a media - (like MS teams style) you could modify javascript (duplicate ms teams media to play with) to map values there and have unique media only for printers...

    Or..
    have another dependent item based on int and translate int codes in preprocessing to be as string codes - ideally custom js again, if you have a lot of codes - in js you can use macos too
    i have something similar (as in preprocessing) that maps IP addresses with names of the servers (ip comes as a value)
    {#IPMAPPING}
    127.0.0.1:localhost,
    8.8.8.8:Google,
    etc
    then i can use this as a macro in js to create add ip address to array(2x arrays" left and right side) and compare with incoming value - if it finds a match(left array) then replace it with string that is on same position with other array value (right arra)

    or simply preprocessing and type multiple time "replace" and create a big list of codes there (not sure if 255 replace would be good idea in preprocessing tho)


    you maybe want to have values like
    32 - low toner
    and workout trigger based on value (regex?) - when value IS NOT standard value return true (alarm)


    Unless someone will have better idea
    Last edited by PeterZielony; 15-12-2023, 09:51.

    Hiring in the UK? Drop a message

    Comment

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

      #3
      I still think value mapping is your best friend... It looks like there are 2^ as "base codes" and sums (128+32=160) for combinations...? How many of those have you ever seen? Create mapping for those and if needed add some later.. 10-20 mappings is no biggie..
      Or do you want to create somekind of preprocessing script and parses that value and save data as text already... gets more complicated than with mappings..

      Comment

      • Mitchpeter
        Junior Member
        • Nov 2022
        • 8

        #4
        I have made (in a template) a script item which I think would generate the required string - if I could get the code item fed into it. If I put test values in the value box in the parameters part of the script item, the test button gives me the correct output string.
        I don't know how to put the code (which is an unsigned numeric calculated item) into the script item parameter. I don't even know that Zabbix supports me doing this!

        Comment

        • PeterZielony
          Senior Member
          • Nov 2022
          • 146

          #5
          Originally posted by Mitchpeter
          I have made (in a template) a script item which I think would generate the required string - if I could get the code item fed into it. If I put test values in the value box in the parameters part of the script item, the test button gives me the correct output string.
          I don't know how to put the code (which is an unsigned numeric calculated item) into the script item parameter. I don't even know that Zabbix supports me doing this!
          Im not sure what you are trying to do with script item... you cant "feed" data into script item from another item

          Just map values and forget about it. Unless you have 255 values(all of them as complete list) to replace there is no need for script - and even so use preprocessing
          Last edited by PeterZielony; 16-12-2023, 12:37.

          Hiring in the UK? Drop a message

          Comment

          Working...