Ad Widget

Collapse

String Manipulation in Calculated Values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pkhooper
    Junior Member
    • Jan 2010
    • 5

    #1

    String Manipulation in Calculated Values

    Hello All,

    I have a number of elements in different MIBs where the supplier has put a string to describe the value as well as the value, for example:

    1. 10dBm
    2. 100sec
    3. 10m

    I want to be able to preform a calculation on these values, for example:

    last(substr(dBmValue, 0, -3)) * 100

    The question is, is there a way to perform this substring manipulation in calculated values?

    Or, is there another way to store the substring value in a field for use in calculated values?

    I want to do this in zabbix, not in an external script and bring the values in via zabbix-sender.

    Regards,
    Patrick.
  • moriny1606
    Junior Member
    • Nov 2010
    • 5

    #2
    Same needs for string manipulation

    Hello Patrick,

    Did you find any solution for your problem?

    I have a similair issue, I need to extract the port value from TRAP messages that Zabbix is receiving from 6500 switches.

    TRAP messages are "Event of type linkDown: Port 17 ( GigabitEthernet3/15 ) Lost Carrier on SWITCHNAME"

    I need the port number (17) to get the alias (description) of the port that issue the TRAP message using IF-MIB::ifAlias.iIndex where iIndex = 17

    Thanks for your help
    Yves

    Comment

    • nelsonab
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Sep 2006
      • 1233

      #3
      Right now there are pretty much two ways to do it. The first is the most supported and that is to write an external check which queries the api (or db if you know what you're doing) does your manipulation and then returns the result.

      Or option two, I have written an experimental Lua patch (see the patch section). Unfortunately right now the patch works in a similar manner to the first suggestion with the exception that it runs internal to the server itself. Over the next few weeks/months I will be working on polishing the patch, and have been thinking of making extensible actions for items such as before_check after_check which could manipulate the data before it's retrieved or stored.
      RHCE, author of zbxapi
      Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
      Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

      Comment

      Working...