Ad Widget

Collapse

Custom LLD issue

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sean35
    Junior Member
    • Jan 2015
    • 19

    #1

    Custom LLD issue

    Hi all,

    I'm building a template for monitoring a Pure Storage Array and I'm having some issues.

    I've built a number of similar templates using LLD successfully, so I really have tried hard to get this working.

    The script I'm using is view-able here: http://pastebin.com/u5jTBgdM

    It would be executed as follows to discover temperature metrics:
    Code:
    PureStorageMonitoring.py [IP_ADDRESS] [API_TOKEN] discoverytemp
    I know the script works as I've tested it manually, also confirmed the JSON on http://jsonlint.com/:

    Code:
    {"data": [{"NAME": "CT0.TMP0", "ID": "CT0.TMP0"}, {"NAME": "CT0.TMP1", "ID": "CT0.TMP1"}, {"NAME": "CT0.TMP12", "ID": "CT0.TMP12"}, {"NAME": "CT0.TMP14", "ID": "CT0.TMP14"},.........{"NAME": "CT1.TMP8", "ID": "CT1.TMP8"}]}
    The Discovery item is as follows:
    Code:
    PureStorageMonitoring.py[{HOST.CONN},{$APITOKEN},"discoverytemp"]
    {$APITOKEN} is a macro within the host.

    I have one Item prototype called:
    Code:
    Temperature for {#NAME}
    With a key of:
    Code:
    PureStorageMonitoring.py[{HOST.CONN},{$APITOKEN},"temperature",{#ID}]
    If I manually add a regular item with an ID which I know exists, for example:
    Code:
    PureStorageMonitoring.py[{HOST.CONN},{$APITOKEN},"temperature",CT1.TMP8]
    This item works correctly proving the API token etc.

    But for some reason discovery is failing and items are not created:
    Code:
    Cannot create item: item with the same key "PureStorageMonitoring.py[{HOST.CONN},{$APITOKEN},"temperature",{#ID}]" already exists.
    Cannot create item: item with the same key "PureStorageMonitoring.py[{HOST.CONN},{$APITOKEN},"temperature",{#ID}]" already exists.
    Cannot create item: item with the same key "PureStorageMonitoring.py[{HOST.CONN},{$APITOKEN},"temperature",{#ID}]" already exists.
    I've increased Discovery debug to 5 but there is nothing relating to this item which shows up.

    Any advice on where to look next (unless it's obvious what I'm doing wrong!)?

    Thanks in advance,
    Sean
  • glebs.ivanovskis
    Senior Member
    • Jul 2015
    • 237

    #2
    Your JSON needs to contain whole macro names. Like
    Code:
    "{#FOO}": "bar"
    instead of just
    Code:
    "FOO": "bar"
    Fix your script and everything should be fine.

    Comment

    • Sean35
      Junior Member
      • Jan 2015
      • 19

      #3
      Glebs,

      You're completely right, thank you so much.

      All working now.

      Comment

      Working...