Ad Widget

Collapse

How to strip characters in SNMP value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sharafy
    Junior Member
    • May 2012
    • 15

    #1

    How to strip characters in SNMP value

    Zabbix Version: 3.0.9

    Hi,

    I'm trying to monitor a system using SNMP. I added the OID, however when I get the data it contain a text and then the value. For example:

    Code:
    # snmpwalk -v 2c -c public 192.168.1.5 netSnmpExtendMIB.4.1.2.4.105.110.102.111.11
    NET-SNMP-EXTEND-MIB::netSnmpExtendMIB.4.1.2.4.105.110.102.111.11 = STRING: "session-total: 0"
    In zabbix, the value that I'm getting for the above item is "session-total: 0". Also, I will be setting up trigger and alert for this item. How can I discard the "session-total:" and simply keep 0 for this item? I came across few posts that mentioned the use of Regex and Macros but I'm not sure what is the best way to do this.

    Can someone please help me with this?

    Thanks.

    Zabbix Version: 3.0.9
  • ovas
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Apr 2017
    • 138

    #2
    Hello sharafy!

    This functionality will only be released soon: https://www.zabbix.com/documentation..._preprocessing
    What you are left with currently, I believe, is to implement externalscript or UserParameter for this kind of item and trim the returned value using third-party tools like sed and awk.

    Functions are used for trigger operations mainly, while macros are the values to be substituted from host to host, not entirely your case.

    Comment

    • sharafy
      Junior Member
      • May 2012
      • 15

      #3
      Hi Ovas,

      Thanks.

      I came across the preprocessing feature. I will wait until that is released.In the meantime, I will look into the external script.

      Thanks again.

      Comment

      Working...