Java Code Examples for com.sun.jmx.snmp.SnmpParameters#setRdCommunity()

The following examples show how to use com.sun.jmx.snmp.SnmpParameters#setRdCommunity() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JVM_MANAGEMENT_MIB_IMPL.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void sendTrap(SnmpOid trap, SnmpVarBindList list) {
    final Iterator<NotificationTarget> iterator = notificationTargets.iterator();
    final SnmpAdaptorServer adaptor =
        (SnmpAdaptorServer) getSnmpAdaptor();

    if (adaptor == null) {
        log.error("sendTrap", "Cannot send trap: adaptor is null.");
        return;
    }

    if (!adaptor.isActive()) {
        log.config("sendTrap", "Adaptor is not active: trap not sent.");
        return;
    }

    while(iterator.hasNext()) {
        NotificationTarget target = null;
        try {
            target = iterator.next();
            SnmpPeer peer =
                new SnmpPeer(target.getAddress(), target.getPort());
            SnmpParameters p = new SnmpParameters();
            p.setRdCommunity(target.getCommunity());
            peer.setParams(p);
            log.debug("handleNotification", "Sending trap to " +
                      target.getAddress() + ":" + target.getPort());
            adaptor.snmpV2Trap(peer, trap, list, null);
        }catch(Exception e) {
            log.error("sendTrap",
                      "Exception occurred while sending trap to [" +
                      target + "]. Exception : " + e);
            log.debug("sendTrap",e);
        }
    }
}
 
Example 2
Source File: JVM_MANAGEMENT_MIB_IMPL.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void sendTrap(SnmpOid trap, SnmpVarBindList list) {
    final Iterator<NotificationTarget> iterator = notificationTargets.iterator();
    final SnmpAdaptorServer adaptor =
        (SnmpAdaptorServer) getSnmpAdaptor();

    if (adaptor == null) {
        log.error("sendTrap", "Cannot send trap: adaptor is null.");
        return;
    }

    if (!adaptor.isActive()) {
        log.config("sendTrap", "Adaptor is not active: trap not sent.");
        return;
    }

    while(iterator.hasNext()) {
        NotificationTarget target = null;
        try {
            target = iterator.next();
            SnmpPeer peer =
                new SnmpPeer(target.getAddress(), target.getPort());
            SnmpParameters p = new SnmpParameters();
            p.setRdCommunity(target.getCommunity());
            peer.setParams(p);
            log.debug("handleNotification", "Sending trap to " +
                      target.getAddress() + ":" + target.getPort());
            adaptor.snmpV2Trap(peer, trap, list, null);
        }catch(Exception e) {
            log.error("sendTrap",
                      "Exception occurred while sending trap to [" +
                      target + "]. Exception : " + e);
            log.debug("sendTrap",e);
        }
    }
}
 
Example 3
Source File: JVM_MANAGEMENT_MIB_IMPL.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void sendTrap(SnmpOid trap, SnmpVarBindList list) {
    final Iterator<NotificationTarget> iterator = notificationTargets.iterator();
    final SnmpAdaptorServer adaptor =
        (SnmpAdaptorServer) getSnmpAdaptor();

    if (adaptor == null) {
        log.error("sendTrap", "Cannot send trap: adaptor is null.");
        return;
    }

    if (!adaptor.isActive()) {
        log.config("sendTrap", "Adaptor is not active: trap not sent.");
        return;
    }

    while(iterator.hasNext()) {
        NotificationTarget target = null;
        try {
            target = iterator.next();
            SnmpPeer peer =
                new SnmpPeer(target.getAddress(), target.getPort());
            SnmpParameters p = new SnmpParameters();
            p.setRdCommunity(target.getCommunity());
            peer.setParams(p);
            log.debug("handleNotification", "Sending trap to " +
                      target.getAddress() + ":" + target.getPort());
            adaptor.snmpV2Trap(peer, trap, list, null);
        }catch(Exception e) {
            log.error("sendTrap",
                      "Exception occurred while sending trap to [" +
                      target + "]. Exception : " + e);
            log.debug("sendTrap",e);
        }
    }
}
 
Example 4
Source File: JVM_MANAGEMENT_MIB_IMPL.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void sendTrap(SnmpOid trap, SnmpVarBindList list) {
    final Iterator<NotificationTarget> iterator = notificationTargets.iterator();
    final SnmpAdaptorServer adaptor =
        (SnmpAdaptorServer) getSnmpAdaptor();

    if (adaptor == null) {
        log.error("sendTrap", "Cannot send trap: adaptor is null.");
        return;
    }

    if (!adaptor.isActive()) {
        log.config("sendTrap", "Adaptor is not active: trap not sent.");
        return;
    }

    while(iterator.hasNext()) {
        NotificationTarget target = null;
        try {
            target = iterator.next();
            SnmpPeer peer =
                new SnmpPeer(target.getAddress(), target.getPort());
            SnmpParameters p = new SnmpParameters();
            p.setRdCommunity(target.getCommunity());
            peer.setParams(p);
            log.debug("handleNotification", "Sending trap to " +
                      target.getAddress() + ":" + target.getPort());
            adaptor.snmpV2Trap(peer, trap, list, null);
        }catch(Exception e) {
            log.error("sendTrap",
                      "Exception occurred while sending trap to [" +
                      target + "]. Exception : " + e);
            log.debug("sendTrap",e);
        }
    }
}
 
Example 5
Source File: JVM_MANAGEMENT_MIB_IMPL.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void sendTrap(SnmpOid trap, SnmpVarBindList list) {
    final Iterator<NotificationTarget> iterator = notificationTargets.iterator();
    final SnmpAdaptorServer adaptor =
        (SnmpAdaptorServer) getSnmpAdaptor();

    if (adaptor == null) {
        log.error("sendTrap", "Cannot send trap: adaptor is null.");
        return;
    }

    if (!adaptor.isActive()) {
        log.config("sendTrap", "Adaptor is not active: trap not sent.");
        return;
    }

    while(iterator.hasNext()) {
        NotificationTarget target = null;
        try {
            target = iterator.next();
            SnmpPeer peer =
                new SnmpPeer(target.getAddress(), target.getPort());
            SnmpParameters p = new SnmpParameters();
            p.setRdCommunity(target.getCommunity());
            peer.setParams(p);
            log.debug("handleNotification", "Sending trap to " +
                      target.getAddress() + ":" + target.getPort());
            adaptor.snmpV2Trap(peer, trap, list, null);
        }catch(Exception e) {
            log.error("sendTrap",
                      "Exception occurred while sending trap to [" +
                      target + "]. Exception : " + e);
            log.debug("sendTrap",e);
        }
    }
}
 
Example 6
Source File: JVM_MANAGEMENT_MIB_IMPL.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void sendTrap(SnmpOid trap, SnmpVarBindList list) {
    final Iterator<NotificationTarget> iterator = notificationTargets.iterator();
    final SnmpAdaptorServer adaptor =
        (SnmpAdaptorServer) getSnmpAdaptor();

    if (adaptor == null) {
        log.error("sendTrap", "Cannot send trap: adaptor is null.");
        return;
    }

    if (!adaptor.isActive()) {
        log.config("sendTrap", "Adaptor is not active: trap not sent.");
        return;
    }

    while(iterator.hasNext()) {
        NotificationTarget target = null;
        try {
            target = iterator.next();
            SnmpPeer peer =
                new SnmpPeer(target.getAddress(), target.getPort());
            SnmpParameters p = new SnmpParameters();
            p.setRdCommunity(target.getCommunity());
            peer.setParams(p);
            log.debug("handleNotification", "Sending trap to " +
                      target.getAddress() + ":" + target.getPort());
            adaptor.snmpV2Trap(peer, trap, list, null);
        }catch(Exception e) {
            log.error("sendTrap",
                      "Exception occurred while sending trap to [" +
                      target + "]. Exception : " + e);
            log.debug("sendTrap",e);
        }
    }
}
 
Example 7
Source File: JVM_MANAGEMENT_MIB_IMPL.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void sendTrap(SnmpOid trap, SnmpVarBindList list) {
    final Iterator<NotificationTarget> iterator = notificationTargets.iterator();
    final SnmpAdaptorServer adaptor =
        (SnmpAdaptorServer) getSnmpAdaptor();

    if (adaptor == null) {
        log.error("sendTrap", "Cannot send trap: adaptor is null.");
        return;
    }

    if (!adaptor.isActive()) {
        log.config("sendTrap", "Adaptor is not active: trap not sent.");
        return;
    }

    while(iterator.hasNext()) {
        NotificationTarget target = null;
        try {
            target = iterator.next();
            SnmpPeer peer =
                new SnmpPeer(target.getAddress(), target.getPort());
            SnmpParameters p = new SnmpParameters();
            p.setRdCommunity(target.getCommunity());
            peer.setParams(p);
            log.debug("handleNotification", "Sending trap to " +
                      target.getAddress() + ":" + target.getPort());
            adaptor.snmpV2Trap(peer, trap, list, null);
        }catch(Exception e) {
            log.error("sendTrap",
                      "Exception occurred while sending trap to [" +
                      target + "]. Exception : " + e);
            log.debug("sendTrap",e);
        }
    }
}
 
Example 8
Source File: JVM_MANAGEMENT_MIB_IMPL.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void sendTrap(SnmpOid trap, SnmpVarBindList list) {
    final Iterator<NotificationTarget> iterator = notificationTargets.iterator();
    final SnmpAdaptorServer adaptor =
        (SnmpAdaptorServer) getSnmpAdaptor();

    if (adaptor == null) {
        log.error("sendTrap", "Cannot send trap: adaptor is null.");
        return;
    }

    if (!adaptor.isActive()) {
        log.config("sendTrap", "Adaptor is not active: trap not sent.");
        return;
    }

    while(iterator.hasNext()) {
        NotificationTarget target = null;
        try {
            target = iterator.next();
            SnmpPeer peer =
                new SnmpPeer(target.getAddress(), target.getPort());
            SnmpParameters p = new SnmpParameters();
            p.setRdCommunity(target.getCommunity());
            peer.setParams(p);
            log.debug("handleNotification", "Sending trap to " +
                      target.getAddress() + ":" + target.getPort());
            adaptor.snmpV2Trap(peer, trap, list, null);
        }catch(Exception e) {
            log.error("sendTrap",
                      "Exception occurred while sending trap to [" +
                      target + "]. Exception : " + e);
            log.debug("sendTrap",e);
        }
    }
}
 
Example 9
Source File: JVM_MANAGEMENT_MIB_IMPL.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void sendTrap(SnmpOid trap, SnmpVarBindList list) {
    final Iterator<NotificationTarget> iterator = notificationTargets.iterator();
    final SnmpAdaptorServer adaptor =
        (SnmpAdaptorServer) getSnmpAdaptor();

    if (adaptor == null) {
        log.error("sendTrap", "Cannot send trap: adaptor is null.");
        return;
    }

    if (!adaptor.isActive()) {
        log.config("sendTrap", "Adaptor is not active: trap not sent.");
        return;
    }

    while(iterator.hasNext()) {
        NotificationTarget target = null;
        try {
            target = iterator.next();
            SnmpPeer peer =
                new SnmpPeer(target.getAddress(), target.getPort());
            SnmpParameters p = new SnmpParameters();
            p.setRdCommunity(target.getCommunity());
            peer.setParams(p);
            log.debug("handleNotification", "Sending trap to " +
                      target.getAddress() + ":" + target.getPort());
            adaptor.snmpV2Trap(peer, trap, list, null);
        }catch(Exception e) {
            log.error("sendTrap",
                      "Exception occurred while sending trap to [" +
                      target + "]. Exception : " + e);
            log.debug("sendTrap",e);
        }
    }
}
 
Example 10
Source File: JVM_MANAGEMENT_MIB_IMPL.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void sendTrap(SnmpOid trap, SnmpVarBindList list) {
    final Iterator<NotificationTarget> iterator = notificationTargets.iterator();
    final SnmpAdaptorServer adaptor =
        (SnmpAdaptorServer) getSnmpAdaptor();

    if (adaptor == null) {
        log.error("sendTrap", "Cannot send trap: adaptor is null.");
        return;
    }

    if (!adaptor.isActive()) {
        log.config("sendTrap", "Adaptor is not active: trap not sent.");
        return;
    }

    while(iterator.hasNext()) {
        NotificationTarget target = null;
        try {
            target = iterator.next();
            SnmpPeer peer =
                new SnmpPeer(target.getAddress(), target.getPort());
            SnmpParameters p = new SnmpParameters();
            p.setRdCommunity(target.getCommunity());
            peer.setParams(p);
            log.debug("handleNotification", "Sending trap to " +
                      target.getAddress() + ":" + target.getPort());
            adaptor.snmpV2Trap(peer, trap, list, null);
        }catch(Exception e) {
            log.error("sendTrap",
                      "Exception occurred while sending trap to [" +
                      target + "]. Exception : " + e);
            log.debug("sendTrap",e);
        }
    }
}
 
Example 11
Source File: JVM_MANAGEMENT_MIB_IMPL.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void sendTrap(SnmpOid trap, SnmpVarBindList list) {
    final Iterator<NotificationTarget> iterator = notificationTargets.iterator();
    final SnmpAdaptorServer adaptor =
        (SnmpAdaptorServer) getSnmpAdaptor();

    if (adaptor == null) {
        log.error("sendTrap", "Cannot send trap: adaptor is null.");
        return;
    }

    if (!adaptor.isActive()) {
        log.config("sendTrap", "Adaptor is not active: trap not sent.");
        return;
    }

    while(iterator.hasNext()) {
        NotificationTarget target = null;
        try {
            target = iterator.next();
            SnmpPeer peer =
                new SnmpPeer(target.getAddress(), target.getPort());
            SnmpParameters p = new SnmpParameters();
            p.setRdCommunity(target.getCommunity());
            peer.setParams(p);
            log.debug("handleNotification", "Sending trap to " +
                      target.getAddress() + ":" + target.getPort());
            adaptor.snmpV2Trap(peer, trap, list, null);
        }catch(Exception e) {
            log.error("sendTrap",
                      "Exception occurred while sending trap to [" +
                      target + "]. Exception : " + e);
            log.debug("sendTrap",e);
        }
    }
}
 
Example 12
Source File: JVM_MANAGEMENT_MIB_IMPL.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private synchronized void sendTrap(SnmpOid trap, SnmpVarBindList list) {
    final Iterator<NotificationTarget> iterator = notificationTargets.iterator();
    final SnmpAdaptorServer adaptor =
        (SnmpAdaptorServer) getSnmpAdaptor();

    if (adaptor == null) {
        log.error("sendTrap", "Cannot send trap: adaptor is null.");
        return;
    }

    if (!adaptor.isActive()) {
        log.config("sendTrap", "Adaptor is not active: trap not sent.");
        return;
    }

    while(iterator.hasNext()) {
        NotificationTarget target = null;
        try {
            target = iterator.next();
            SnmpPeer peer =
                new SnmpPeer(target.getAddress(), target.getPort());
            SnmpParameters p = new SnmpParameters();
            p.setRdCommunity(target.getCommunity());
            peer.setParams(p);
            log.debug("handleNotification", "Sending trap to " +
                      target.getAddress() + ":" + target.getPort());
            adaptor.snmpV2Trap(peer, trap, list, null);
        }catch(Exception e) {
            log.error("sendTrap",
                      "Exception occurred while sending trap to [" +
                      target + "]. Exception : " + e);
            log.debug("sendTrap",e);
        }
    }
}