SnmpGetNext.java.txt
上传用户:aonuowh
上传日期:2021-05-23
资源大小:35390k
文件大小:1k
- /*$Id: SnmpGetNext.java,v 1.1 2002/06/15 14:41:18 ram Exp $*/
- /*
- * @(#)SnmpGetNext.java
- * Copyright (c) 1996-2001 AdventNet, Inc. All Rights Reserved.
- * Please read the associated COPYRIGHTS file for more details.
- */
- /**
- * This is an example program to explain how to write an application
- * to retrieve information about the oid next to
- * sysDescr in the localhost's RFC1213-MIB using
- * com.adventnet.snmp.beans package of AdventNetSNMP API.
- *
- */
- import com.adventnet.snmp.beans.*;
- public class SnmpGetNext {
- public static void main(String args[]) {
- // instantiate SNMP target bean
- SnmpTarget target = new SnmpTarget();
- // set the host in which the SNMP agent is running
- target.setTargetHost("localhost");
-
- // set the OID
- target.setObjectID(".1.3.6.1.2.1.1.1")
- // perform a GETNEXT request
- String result = target.snmpGetNext();
- if (result == null)
- {
- System.err.println("Request failed or timed out. n"+
- target.getErrorString());
- }
- else
- {
- // print the values
- System.out.println("Response received. Value:" + result);
- }
- System.exit(0);
- }
- }