Resources API
Use the Resources API to list or delete resources at the node level and below. This service is especially useful in conjunction with the Measurements API.
GETs (Reading Data)
Resource | Description |
---|---|
|
Retrieve the full tree of resources in the system (expensive, use with care). |
|
Retrieve the tree of resources starting with the named resource ID. |
|
Retrieve the tree of resources for a node, given its database ID or |
DELETEs (Removing Data)
Resource | Description |
---|---|
|
Delete resource with the named resource ID, and all its child resources, if any. |
The following table shows all supported query string parameters and their default values.
Name | Default | Comment |
---|---|---|
depth |
varies |
GET only. Limits the tree depth for retrieved resources. Defaults to 1 when listing all resources, or to -1 (no limit) when listing a single resource. |
Use examples with cURL
1
, by resource IDcurl -u admin:admin "http://127.0.0.1:8980/opennms/rest/resources/node%5B1%5D"
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<resource id="node[1]"
label="anode"
name="1"
link="element/node.jsp?node=1"
typeLabel="Node">
<children count="11" totalCount="11">
<resource id="node[1].nodeSnmp[]"
label="Node-level Performance Data"
name=""
typeLabel="SNMP Node Data"
parentId="node[1]">
<children/>
<stringPropertyAttributes/>
<externalValueAttributes/>
<rrdGraphAttributes>
<entry>
<key>loadavg1</key>
<value name="loadavg1"
relativePath="snmp/1"
rrdFile="loadavg1.jrb"/>
</entry>
<key>tcpActiveOpens</key>
<value name="tcpActiveOpens"
relativePath="snmp/1"
rrdFile="tcpActiveOpens.jrb"/>
</entry>
<entry>
<key>memTotalFree</key>
<value name="memTotalFree"
relativePath="snmp/1"
rrdFile="memTotalFree.jrb"/>
</entry>
...
</rrdGraphAttributes>
</resource>
<resource id="node[1].interfaceSnmp[lo]"
label="lo (10 Mbps)"
name="lo"
link="element/snmpinterface.jsp?node=1&ifindex=1"
typeLabel="SNMP Interface Data"
parentId="node[1]">
<children/>
<stringPropertyAttributes>
<entry>
<key>ifName</key>
<value>lo</value>
</entry>
...
</stringPropertyAttributes>
<externalValueAttributes>
<entry>
<key>ifSpeed</key>
<value>10000000</value>
</entry>
<entry>
<key>ifSpeedFriendly</key>
<value>10 Mbps</value>
</entry>
</externalValueAttributes>
<rrdGraphAttributes>
...
<entry>
<key>ifHCInOctets</key>
<value name="ifHCInOctets"
relativePath="snmp/1/lo"
rrdFile="ifHCInOctets.jrb"/>
</entry>
<entry>
<key>ifHCOutOctets</key>
<value name="ifHCOutOctets"
relativePath="snmp/1/lo"
rrdFile="ifHCOutOctets.jrb"/>
</entry>
...
</rrdGraphAttributes>
</resource>
...
</children>
<stringPropertyAttributes/>
<externalValueAttributes/>
<rrdGraphAttributes/>
</resource>
1
, without having to construct a resource IDcurl -u admin:admin "http://127.0.0.1:8980/opennms/rest/resources/fornode/1"
node42
in requisition Servers
, by resource IDcurl -u admin:admin "http://127.0.0.1:8980/opennms/rest/resources/nodeSource%5BServers:node42%5D"
node42
in requisition Servers
, without having to construct a resource IDcurl -u admin:admin "http://127.0.0.1:8980/opennms/rest/resources/fornode/Servers:node42"