Class SnmpConfigRestService


  • @Component("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
     
    Since:
    1.8.1
    Version:
    $Id: $
    Author:
    Mathew Brozowski
    • Constructor Detail

      • SnmpConfigRestService

        public SnmpConfigRestService()
    • Method Detail

      • tearDown

        @PreDestroy
        protected void tearDown()
      • getSnmpInfo

        public SnmpInfo getSnmpInfo​(java.lang.String ipAddr,
                                    java.lang.String location)

        getSnmpInfo

        Parameters:
        ipAddr - a String object.
        Returns:
        a org.opennms.web.snmpinfo.SnmpInfo object.
      • setSnmpInfo

        public javax.ws.rs.core.Response setSnmpInfo​(java.lang.String ipAddress,
                                                     SnmpInfo snmpInfo)

        setSnmpInfo

        Parameters:
        ipAddress - a String object.
        snmpInfo - a org.opennms.web.snmpinfo.SnmpInfo object.
        Returns:
        a Response object.
      • updateInterface

        @Transactional
        public javax.ws.rs.core.Response updateInterface​(java.lang.String ipAddress,
                                                         MultivaluedMapImpl params)
        Updates a specific interface
        Parameters:
        ipAddress - a String object.
        params - a MultivaluedMapImpl object.
        Returns:
        a Response object.
      • getAddresses

        protected static java.lang.String[] getAddresses​(java.lang.String input)