GetRow.java.txt
上传用户:aonuowh
上传日期:2021-05-23
资源大小:35390k
文件大小:1k
源码类别:

SNMP编程

开发平台:

C/C++

  1. /* $Id: GetRow.java,v 1.1 2002/06/15 14:41:18 ram Exp $ */
  2.  *
  3. /* GetRow.java * Copyright (c) 1996-2003 AdventNet, Inc. All Rights Reserved.
  4.  * Please read the associated COPYRIGHTS file for more details.
  5.  */
  6.  *
  7.  *
  8. import com.adventnet.snmp.beans.*;
  9. public class GetRow {
  10. public static void main(String args[]) {
  11. if (args.length < 1)
  12. {
  13. System.out.println ("Usage : java getrow tableoid");
  14. System.exit (0);
  15. }
  16. String tableoid = args[0];
  17. SnmpTable table = new SnmpTable();
  18. table.setTargetHost("localhost);
  19. try 
  20. {
  21. table.loadMibs("RFC1213-MIB");
  22. table.setTableOID(tableoid);
  23. }
  24. catch (Exception ex) 
  25. {
  26. System.err.println("Error: "+ex);
  27. }
  28. String sb = table.getRow(2);
  29. System.out.println("Getting 2nd row: " + sb);
  30. System.exit(0);
  31. }
  32. }