Ad Widget

Collapse

Aggregate discovery using key that includes escaped quotes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • socrhombus00
    Junior Member
    • Dec 2019
    • 2

    #1

    Aggregate discovery using key that includes escaped quotes

    Hello all. I'm trying to setup an aggregate prototype item, which is based on an SNMP prototype item. The SNMP prototype key contains quoted strings and I'm having trouble figuring out how to escape them when reference the key in my aggregate prototype's key. I'm able to setup a single aggregate item by escaping everything in the key, but I do not see a way to do this when setting up the Aggregate item prototype. I'm running 4.4.3 and I listed details below on what I've tried so far.

    Here is the key from the original SNMP item prototype:
    Code:
    gtmPoolMbrStatPreferred.a.[{#SNMPINDEX}]
    Here is a key of a discovered SNMP item. Zabbix escapes the quoted strings in the raw SNMP data, then encloses all within set of double quotes.
    Code:
    gtmPoolMbrStatPreferred.a.["\"/Partition/GTMPool\".\"/Partition/GTMServer\".\"/Partition/VirtualServer\""]


    Here is an aggregate item key (not prototype) that worked for me. I had to add a backslash before every double quote in the brackets, including double quotes that were already escaped.
    Code:
    grpsum["GTM Host Group","gtmPoolMbrStatPreferred.a.[\"\\"/Partition/GTMPool\\".\\"/Partition/GTMServer\\".\\"/Partition/VirtualServer\\"\"]",last]


    When creating my Aggregrate prototype item, I first tried using the following key
    Code:
    grpsum["GTM Host Group","gtmPoolMbrStatPreferred.a.[{#SNMPINDEX}]",last]
    This results in the following key for discovered Aggregate items.
    Code:
    grpsum["GTM Host Group","gtmPoolMbrStatPreferred.a.[\"/Partition/GTMPool\".\"/Partition/GTMServer\".\"/Partition/VirtualServer\"]",last]
    The discovered items go into a Not supported status. It does not match any item keys because the inner quotes are not escaped and there are no unescaped outer quotes in the brackets.
    Code:
    gtmPoolMbrStatPreferred.a.["/Partition/GTMPool"."/Partition/GTMServer"."/Partition/VirtualServer"]" in group(s) "GTM Host Group"


    I then tried enclosing {#SNMPINDEX} in escaped double quotes in my Aggregate prototype item key. I had to escape them because I got syntax errors otherwise.
    Code:
    grpsum["GTM Host Group","gtmPoolMbrStatPreferred.a.[\"{#SNMPINDEX}\"]",last]
    This results in the following key for discovered Aggregate items.
    Code:
    grpsum["GTM Host Group","gtmPoolMbrStatPreferred.a.[\"\"/Partition/GTMPool\".\"/Partition/GTMServer\".\"/Partition/VirtualServer\"\"]",last]
    The discovered items go into a Not supported status. This now has the outer quotes in the brackets but the other quotes are not escaped.
    Code:
    gtmPoolMbrStatPreferred.a.[""/Partition/GTMPool"."/Partition/GTMServer"."/Partition/VirtualServer""]" in group(s) "GTM Host Group"
  • socrhombus00
    Junior Member
    • Dec 2019
    • 2

    #2
    Just for closure, I gave up on dealing with multiple levels of escaping and I did an overhaul on my item prototype keys so they did not include quotes.

    Comment

    Working...