Uploaded image for project: 'OpenNMS'
  1. OpenNMS
  2. NMS-8404

storeByForeignSource breaks node[N] style resource IDs

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 17.1.1
    • Fix Version/s: Meridian-2016.1.0, 18.0.1
    • Component/s: Architecture
    • Security Level: Default (Default Security Scheme)
    • Labels:
    • Environment:
      Any system with {{storeByForeignSource=true}} set

      Description

      Steps to reproduce (note that this problem has additional repercussions outside the use case described below):

      1. Install and minimally configure an SNMP agent on the server
      2. Set storeByForeignSource=true and restart OpenNMS
      3. Add a node for the server via a requisition
        provision.pl node add TestOne 1234 hognose
        provision.pl interface add TestOne 1234 127.0.0.1
        provision.pl interface set TestOne 1234 127.0.0.1 snmp-primary P
        provision.pl interface set TestOne 1234 127.0.0.1 status 1
        provision.pl requisition import TestOne
        
      4. Get a coffee to give SNMP data collection a moment
      5. Request some data from the Measurements ReST API for the node, identified by its foreign-source name and foreign-ID:
        curl -u admin:admin "http://127.0.0.1:8980/opennms/rest/measurements/nodeSource%5BTestOne:1234%5D.nodeSnmp%5B%5D/CpuRawUser?start=-7200000&maxrows=30&aggregation=AVERAGE"
        
      6. Request the same data for the node identified by its database ID:
        curl -u admin:admin "http://127.0.0.1:8980/opennms/rest/measurements/node%5B1%5D.nodeSnmp%5B%5D/CpuRawUser?start=-7200000&maxrows=30&aggregation=AVERAGE"
        

      Expected result:
      Both styles of node identification result in retrieval of data

      Actual result:
      Only the nodeSource style works. When using node, we get back an error message:

      Resource or attribute not found for QueryRequest{Step=300000, Start=1462470034362, End=1462477234362, Max Rows=30, Interval=null, Heartbeat=null, Sources=[Source{Label=CpuRawUser, Resource ID=node[1].nodeSnmp[], Attribute=CpuRawUser, Datasource=CpuRawUser, Transient=false}], Expressions=[], Filters=[]}
      

      This situation results in API calls potentially breaking if the setting of storeByForeignSource changes to true. The choice of which style to use in a given situation should be a matter of convenience, not driven by the value of a configuration setting that a typical front-end developer cannot be expected to take into consideration.

        Attachments

          Activity

            People

            • Assignee:
              j-white Jesse White
              Reporter:
              jeffg Jeff Gehlbach
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: