Package com.santaba.agent.groovyapi.snmp
Class Session
- java.lang.Object
-
- com.logicmonitor.common.sse.utils.SSEResource
-
- com.santaba.agent.groovyapi.snmp.Session
-
public class Session extends com.logicmonitor.common.sse.utils.SSEResourceSnmp session, include function such as: open, walk
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSession.BuilderA helper class to help to build the Session for snmp
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close this sessionjava.lang.Stringget(java.lang.String oid)Get oid valuebooleanisReleased()Whether if this session is releasedstatic Sessionopen(java.lang.String host)Open snmp hoststatic Sessionopen(java.lang.String host, int timeoutMillis)Open snmp hoststatic Sessionopen(java.lang.String host, java.lang.String community, java.lang.String version)Open snmp hoststatic Sessionopen(java.lang.String host, java.lang.String community, java.lang.String version, int pduTimeoutInMills)Open snmp hoststatic Sessionopen(java.lang.String host, java.lang.String community, java.lang.String version, int pduTimeoutInMills, int port)Open snmp hoststatic SessionopenV3(java.lang.String host, java.lang.String securityName)Snmp v3 support on DEFAULT_TIMEOUTstatic SessionopenV3(java.lang.String host, java.lang.String securityName, int timeoutMillis)Snmp v3 supportstatic SessionopenV3(java.lang.String host, java.lang.String securityName, java.lang.String authProto, java.lang.String authPhrase)Snmp v3 support on DEFAULT_TIMEOUTstatic SessionopenV3(java.lang.String host, java.lang.String securityName, java.lang.String authProto, java.lang.String authPhrase, int timeoutMillis)Snmp v3 support on DEFAULT_TIMEOUTstatic SessionopenV3(java.lang.String host, java.lang.String securityName, java.lang.String authProto, java.lang.String authPhrase, java.lang.String privProto, java.lang.String privPhrase)Snmp v3 support on DEFAULT_TIMEOUTstatic SessionopenV3(java.lang.String host, java.lang.String securityName, java.lang.String authProto, java.lang.String authPhrase, java.lang.String privProto, java.lang.String privPhrase, int pduTimeoutInMills)Snmp v3 support on DEFAULT_SNMP_PORTstatic SessionopenV3(java.lang.String host, java.lang.String securityName, java.lang.String authProto, java.lang.String authPhrase, java.lang.String privProto, java.lang.String privPhrase, int pduTimeoutInMills, int port)Snmp v3 supportstatic SessionopenV3(java.lang.String host, java.lang.String securityName, java.lang.String authProto, java.lang.String authPhrase, java.lang.String privProto, java.lang.String privPhrase, int pduTimeoutInMills, int port, java.lang.String contextName, java.lang.String contextEngineId)voidrelease()Release this sessionjava.lang.StringtoString()java.util.ArrayList<java.lang.String>walk(java.lang.String oid)Get oid value list use walkjava.util.ArrayList<java.lang.String>walk(java.lang.String oid, long walkTimeoutInMills)Get oid value list use walkjava.util.Map<java.lang.String,java.lang.String>walkAsMap(java.lang.String oid)Get oid value map use walkjava.util.Map<java.lang.String,java.lang.String>walkAsMap(java.lang.String oid, long walkTimeoutInMills)Get oid value map use walk
-
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isReleased
public boolean isReleased()
Whether if this session is released- Specified by:
isReleasedin classcom.logicmonitor.common.sse.utils.SSEResource- Returns:
- Whether if this session is released
-
release
public void release()
Release this session- Specified by:
releasein classcom.logicmonitor.common.sse.utils.SSEResource
-
open
public static Session open(java.lang.String host) throws java.io.IOException
Open snmp host- Parameters:
host- The address of snmp host- Returns:
- Session of this snmp host
- Throws:
java.io.IOException- If some other I/O error occurs
-
open
public static Session open(java.lang.String host, int timeoutMillis) throws java.io.IOException
Open snmp host- Parameters:
host- The address of snmp hosttimeoutMillis- Timeout(millis)- Returns:
- Session of this snmp host
- Throws:
java.io.IOException- If some other I/O error occurs
-
open
public static Session open(java.lang.String host, java.lang.String community, java.lang.String version) throws java.io.IOException
Open snmp host- Parameters:
host- The address of snmp hostcommunity- Snmp community stringversion- Snmp version string- Returns:
- Session of this snmp host
- Throws:
java.io.IOException- If some other I/O error occurs
-
open
public static Session open(java.lang.String host, java.lang.String community, java.lang.String version, int pduTimeoutInMills) throws java.io.IOException
Open snmp host- Parameters:
host- The address of snmp hostcommunity- Snmp community stringpduTimeoutInMills- PDU timeout(mills)- Returns:
- Session of this snmp host
- Throws:
java.io.IOException- If some other I/O error occurs
-
open
public static Session open(java.lang.String host, java.lang.String community, java.lang.String version, int pduTimeoutInMills, int port) throws java.io.IOException
Open snmp host- Parameters:
host- The address of snmp hostcommunity- Snmp community stringpduTimeoutInMills- PDU timeout(mills)port- Snmp host port- Returns:
- Session of this snmp host
- Throws:
java.io.IOException- If some other I/O error occurs
-
openV3
public static Session openV3(java.lang.String host, java.lang.String securityName) throws java.io.IOException
Snmp v3 support on DEFAULT_TIMEOUT- Parameters:
host- Snmp host addresssecurityName- Snmp V3 security name- Returns:
- The session of snmp host conneceted
- Throws:
java.io.IOException- If some other I/O error occurs
-
openV3
public static Session openV3(java.lang.String host, java.lang.String securityName, int timeoutMillis) throws java.io.IOException
Snmp v3 support- Parameters:
host- Snmp host addresssecurityName- Snmp V3 security nametimeoutMillis- The timeout of connect snmp host(millis)- Returns:
- The session of snmp host conneceted
- Throws:
java.io.IOException- If some other I/O error occurs
-
openV3
public static Session openV3(java.lang.String host, java.lang.String securityName, java.lang.String authProto, java.lang.String authPhrase) throws java.io.IOException
Snmp v3 support on DEFAULT_TIMEOUT- Parameters:
host- Snmp host addresssecurityName- Snmp V3 security nameauthProto- Snmp V3 auth protoauthPhrase- Snmp V3 auth phrase- Returns:
- The session of snmp host conneceted
- Throws:
java.io.IOException- If some other I/O error occurs
-
openV3
public static Session openV3(java.lang.String host, java.lang.String securityName, java.lang.String authProto, java.lang.String authPhrase, int timeoutMillis) throws java.io.IOException
Snmp v3 support on DEFAULT_TIMEOUT- Parameters:
host- Snmp host addresssecurityName- Snmp V3 security nameauthProto- Snmp V3 auth protoauthPhrase- Snmp V3 auth phrase- Returns:
- The session of snmp host conneceted
- Throws:
java.io.IOException- If some other I/O error occurs
-
openV3
public static Session openV3(java.lang.String host, java.lang.String securityName, java.lang.String authProto, java.lang.String authPhrase, java.lang.String privProto, java.lang.String privPhrase) throws java.io.IOException
Snmp v3 support on DEFAULT_TIMEOUT- Parameters:
host- Snmp host addresssecurityName- Snmp V3 security nameauthProto- Snmp V3 auth protoauthPhrase- Snmp V3 auth phraseprivProto- Snmp V3 private protoprivPhrase- Snmp V3 privte phrase- Returns:
- The session of snmp host conneceted
- Throws:
java.io.IOException- If some other I/O error occurs
-
openV3
public static Session openV3(java.lang.String host, java.lang.String securityName, java.lang.String authProto, java.lang.String authPhrase, java.lang.String privProto, java.lang.String privPhrase, int pduTimeoutInMills) throws java.io.IOException
Snmp v3 support on DEFAULT_SNMP_PORT- Parameters:
host- Snmp host addresssecurityName- Snmp V3 security nameauthProto- Snmp V3 auth protoauthPhrase- Snmp V3 auth phraseprivProto- Snmp V3 private protoprivPhrase- Snmp V3 privte phrasepduTimeoutInMills- The timeout of pdu(mills)- Returns:
- The session of snmp host conneceted
- Throws:
java.io.IOException- If some other I/O error occurs
-
openV3
public static Session openV3(java.lang.String host, java.lang.String securityName, java.lang.String authProto, java.lang.String authPhrase, java.lang.String privProto, java.lang.String privPhrase, int pduTimeoutInMills, int port) throws java.io.IOException
Snmp v3 support- Parameters:
host- Snmp host addresssecurityName- Snmp V3 security nameauthProto- Snmp V3 auth protoauthPhrase- Snmp V3 auth phraseprivProto- Snmp V3 private protoprivPhrase- Snmp V3 privte phrasepduTimeoutInMills- The timeout of pdu(mills)port- Snmp host port- Returns:
- The session of snmp host conneceted
- Throws:
java.io.IOException- If some other I/O error occurs
-
openV3
public static Session openV3(java.lang.String host, java.lang.String securityName, java.lang.String authProto, java.lang.String authPhrase, java.lang.String privProto, java.lang.String privPhrase, int pduTimeoutInMills, int port, java.lang.String contextName, java.lang.String contextEngineId) throws java.io.IOException
- Throws:
java.io.IOException
-
close
public void close()
Close this session
-
get
public java.lang.String get(java.lang.String oid) throws java.io.IOExceptionGet oid value- Parameters:
oid- Snmp oid- Returns:
- OID value
- Throws:
java.io.IOException- If some other I/O error occurs
-
walk
public java.util.ArrayList<java.lang.String> walk(java.lang.String oid) throws java.io.IOExceptionGet oid value list use walk- Parameters:
oid- Snmmp oid- Returns:
- OID value list
- Throws:
java.io.IOException- If some other I/O error occurs
-
walk
public java.util.ArrayList<java.lang.String> walk(java.lang.String oid, long walkTimeoutInMills) throws java.io.IOExceptionGet oid value list use walk- Parameters:
oid- Snmp oidwalkTimeoutInMills- Timeout(mills)- Returns:
- OID value list
- Throws:
java.io.IOException- If some other I/O error occurs
-
walkAsMap
public java.util.Map<java.lang.String,java.lang.String> walkAsMap(java.lang.String oid) throws java.io.IOExceptionGet oid value map use walk- Parameters:
oid- Snmp oid- Returns:
- OID value map
- Throws:
java.io.IOException- If some other I/O error occurs
-
walkAsMap
public java.util.Map<java.lang.String,java.lang.String> walkAsMap(java.lang.String oid, long walkTimeoutInMills) throws java.io.IOExceptionGet oid value map use walk- Parameters:
oid- Snmp oidwalkTimeoutInMills- Timeout(mills)- Returns:
- OID value map
- Throws:
java.io.IOException- If some other I/O error occurs
-
-