SnmpGetBulk.java.txt
上传用户:aonuowh
上传日期:2021-05-23
资源大小:35390k
文件大小:1k
- /*$Id: SnmpGetBulk.java,v 1.1 2002/06/15 14:41:18 ram Exp $*/
- /*
- * @(#)SnmpGetBulk.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 atTable entries
- * in the localhost's RFC1213-MIB using
- * com.adventnet.snmp.beans package of AdventNetSNMP API.
- *
- */
- import com.adventnet.snmp.beans.*;
- public class SnmpGetBulk {
- 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.3.1")
- // perform a GETBULK request
- String result = target.snmpGetBulkList();
- 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);
- }
- }