Ad Widget

Collapse

duplicate key in discovery

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cn_shawn_cao
    Junior Member
    • Aug 2014
    • 2

    #1

    duplicate key in discovery

    hi,

    i am writing a module for my servers which run ipvs service, but i have some problems

    the module return values like :
    {
    "data":[
    {
    "{#IPVSPTL}":"TCP",
    "{#IPVSVIP}":"172.16.20.72",
    "{#IPVSVPORT}":"80",
    "{#IPVSRS}":"10.20.187.48",
    "{#IPVSRSPORT}":"80",
    "{#IPVSRS}":"10.20.187.47",
    "{#IPVSRSPORT}":"80"},
    {
    "{#IPVSPTL}":"TCP",
    "{#IPVSVIP}":"172.16.20.73",
    "{#IPVSVPORT}":"80",
    "{#IPVSRS}":"10.20.135.197",
    "{#IPVSRSPORT}":"80",
    "{#IPVSRS}":"10.20.187.47",
    "{#IPVSRSPORT}":"80"}]}


    but, in Latest data, i only see the first {#IPVSRS} and {#IPVSRSPORT}

    anyone know how to deal with? let zabbix_server handle all the key and value({#IPVSRS} and {#IPVSRSPORT}).

    sorry for my bad english. thanks
  • steveboyson
    Senior Member
    • Jul 2013
    • 582

    #2
    You should not have duplicate keys in your JSON output.
    Check it here: http://jsonlint.com/

    Comment

    • filipp.sudanov
      Senior Member
      Zabbix Certified Specialist
      • May 2014
      • 137

      #3
      What is your item prototype, how are {#IPVSRS} and {#IPVSRSPORT} used?

      Comment

      • cn_shawn_cao
        Junior Member
        • Aug 2014
        • 2

        #4
        In my Discovery->Item prototypes:

        IPVS active connect {#IPVSPTL} {#IPVSVIP}:{#IPVSVPORT}->{#IPVSRS}:{#IPVSRSPORT} ipvs.activeconns[{#IPVSPTL},{#IPVSVIP},{#IPVSVPORT},{#IPVSRS},{#IPV SRSPORT}]

        IPVS inactive connect {#IPVSPTL} {#IPVSVIP}:{#IPVSVPORT}->{#IPVSRS}:{#IPVSRSPORT} ipvs.inactconns[{#IPVSPTL},{#IPVSVIP},{#IPVSVPORT},{#IPVSRS},{#IPV SRSPORT}]

        Comment

        • steveboyson
          Senior Member
          • Jul 2013
          • 582

          #5
          As mentioned before, you have two {#IPVSRS} keys with different values. Quite sure that is bogus.

          Comment

          Working...