@Component(value="snmpConfigRestService") @Transactional public class SnmpConfigRestService extends OnmsRestService
REST service to the OpenNMS SNMP configuration snmp-config.xml
This current implementation setting and getting all parameters which are in
snmp-config.xml
Be aware that setting the SNMP configuration for a rage of IPs is
currently not supported by this REST service!
The implementation only supports a PUT request because it is an implied
"Update" of the configuration since it requires an IP address and all IPs
have a default configuration. This request is is passed to the factory for
optimization of the configuration store:snmp-config.xml
.
Example 1: Change SNMP configuration.
curl -v -X PUT -H "Content-Type: application/xml" \ -H "Accept: application/xml" \ -d "<snmp-info> <community>yRuSonoZ</community> <port>161</port> <retries>1</retries> <timeout>2000</timeout> <version>v2c</version> </snmp-info>" \ -u admin:admin http://localhost:8980/opennms/rest/snmpConfig/10.1.1.1
Example 2: Query SNMP community string.
curl -v -X GET -u admin:admin http://localhost:8980/opennms/rest/snmpConfig/10.1.1.1
OnmsRestService.ComparisonOperation
DEFAULT_LIMIT
Constructor and Description |
---|
SnmpConfigRestService() |
Modifier and Type | Method and Description |
---|---|
protected static String[] |
getAddresses(String input) |
SnmpInfo |
getSnmpInfo(String ipAddr,
String location)
getSnmpInfo
|
javax.ws.rs.core.Response |
setSnmpInfo(String ipAddress,
SnmpInfo snmpInfo)
setSnmpInfo
|
protected void |
tearDown() |
javax.ws.rs.core.Response |
updateInterface(String ipAddress,
MultivaluedMapImpl params)
Updates a specific interface
|
applyQueryFilters, applyQueryFilters, getBadRequestResponse, getBeanWrapperForClass, getException, getException, getNumericValue, getRedirectUri, readLock, readUnlock, removeParameter, removeParameter, setProperties, writeLock, writeUnlock
@PreDestroy protected void tearDown()
public SnmpInfo getSnmpInfo(String ipAddr, String location)
getSnmpInfo
ipAddr
- a String
object.org.opennms.web.snmpinfo.SnmpInfo
object.public javax.ws.rs.core.Response setSnmpInfo(String ipAddress, SnmpInfo snmpInfo)
setSnmpInfo
ipAddress
- a String
object.snmpInfo
- a org.opennms.web.snmpinfo.SnmpInfo
object.Response
object.@Transactional public javax.ws.rs.core.Response updateInterface(String ipAddress, MultivaluedMapImpl params)
ipAddress
- a String
object.params
- a MultivaluedMapImpl
object.Response
object.Copyright © 2021. All rights reserved.