Esempio n. 1
0
  public void setEventResult(Property eP, Object notifEvent) {
    // System.out.println(" notifResult="+notifEvent);
    // System.out.println(" ********* SNMP TRAP ************");
    SnmpEvent sp = (SnmpEvent) notifEvent;

    // System.out.println(" Event Vals ="+sp.getProperties()) ;
    // System.out.println(" *******************************");

    MSSnmpTestPanel.setMSTextArea("SNMP Event Values=" + sp.getProperties());
  }
Esempio n. 2
0
  public void doSnmpNmsTest() {

    // Instantiating Management Server.
    String a[] = {"", "com.adventnet.nms.client.ms.MSClientTransporter", "", ""};
    mc = ManagementClient.getInstance(a);

    // Instantiating SnmpProperty.
    SnmpProperty sp = new SnmpProperty();

    // Setting SNMP properties.
    sp.setTargetHost(host);
    sp.setObjectID(oid);
    sp.setOperationType(com.adventnet.management.Property.OP_READ);

    ManagementServerResultEvent re = null;

    try {
      re = mc.syncSend(sp);
    } catch (Exception e) {
      System.out.println("Exception at syncSend " + e);
    }
    if (re.getErrString() != null) {
      // System.err.println("Error="+re.getErrString() );
      MSSnmpTestPanel.setMSTextArea(re.getErrString());
      return;
    }

    if (re != null) {
      String result = re.getStringResult();
      if (re.getResult() instanceof Object[]) {
        Object[] objarr = (Object[]) re.getResult();

        for (int i = 0; i < objarr.length; i++) {
          // System.out.println("Result "+i+"==" + objarr[i]);
          MSSnmpTestPanel.setMSTextArea(objarr[i].toString());
        }
      }
    } else {
      System.err.println("Could not able to get the reply");
    }
  }