当前位置: 首页>>代码示例>>Java>>正文


Java SnmpParameters类代码示例

本文整理汇总了Java中com.sun.jmx.snmp.SnmpParameters的典型用法代码示例。如果您正苦于以下问题:Java SnmpParameters类的具体用法?Java SnmpParameters怎么用?Java SnmpParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SnmpParameters类属于com.sun.jmx.snmp包,在下文中一共展示了SnmpParameters类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: snmpV1Trap

import com.sun.jmx.snmp.SnmpParameters; //导入依赖的package包/类
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
@Override
public void snmpV1Trap(SnmpPeer peer,
                       SnmpIpAddress agentAddr,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV1Trap(peer.getDestAddr(),
               peer.getDestPort(),
               agentAddr,
               p.getRdCommunity(),
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:43,代码来源:SnmpAdaptorServer.java

示例2: sendTrap

import com.sun.jmx.snmp.SnmpParameters; //导入依赖的package包/类
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);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:JVM_MANAGEMENT_MIB_IMPL.java

示例3: sendTrap

import com.sun.jmx.snmp.SnmpParameters; //导入依赖的package包/类
private synchronized void sendTrap(SnmpOid trap, SnmpVarBindList list) {
    final Iterator 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 = (NotificationTarget) 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 occured while sending trap to [" +
                      target + "]. Exception : " + e);
            log.debug("sendTrap",e);
        }
    }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:36,代码来源:JVM_MANAGEMENT_MIB_IMPL.java

示例4: snmpV2Trap

import com.sun.jmx.snmp.SnmpParameters; //导入依赖的package包/类
/**
 * Sends a trap using SNMP V2 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * <BR>The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 * <BR>The variable list included in the outgoing trap is composed of
 * the following items:
 * <UL>
 * <LI><CODE>sysUpTime.0</CODE> with the value specified by
 *     <CODE>time</CODE></LI>
 * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by
 *     <CODE>trapOid</CODE></LI>
 * <LI><CODE>all the (oid,values)</CODE> from the specified
 *     <CODE>varBindList</CODE></LI>
 * </UL>
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param trapOid The OID identifying the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
@Override
public void snmpV2Trap(SnmpPeer peer,
                       SnmpOid trapOid,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {

    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV2Trap(peer.getDestAddr(),
               peer.getDestPort(),
               p.getRdCommunity(),
               trapOid,
               varBindList,
               time);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:44,代码来源:SnmpAdaptorServer.java

示例5: snmpInformRequest

import com.sun.jmx.snmp.SnmpParameters; //导入依赖的package包/类
/**
 * Sends an inform using SNMP V2 inform request format.
 * <BR>The inform is sent to the specified <CODE>SnmpPeer</CODE>
 *     destination.
 * <BR>The community string used is the one located in the
 *     <CODE>SnmpPeer</CODE> parameters
 *     (<CODE>SnmpParameters.getInformCommunity() </CODE>).
 * <BR>The variable list included in the outgoing inform is composed
 *     of the following items:
 * <UL>
 * <LI><CODE>sysUpTime.0</CODE> with its current value</LI>
 * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by
 *     <CODE>trapOid</CODE></LI>
 * <LI><CODE>all the (oid,values)</CODE> from the specified
 *     <CODE>varBindList</CODE></LI>
 * </UL>
 * To send an inform request, the SNMP adaptor server must be active.
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination for this inform
 *             request.
 * @param cb The callback that is invoked when a request is complete.
 * @param trapOid The OID identifying the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 *
 * @return The inform request object.
 *
 * @exception IllegalStateException  This method has been invoked while
 *            the SNMP adaptor server was not active.
 * @exception IOException An I/O error occurred while sending the
 *            inform request.
 * @exception SnmpStatusException If the inform request exceeds the
 *            limit defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
@Override
public SnmpInformRequest snmpInformRequest(SnmpPeer peer,
                                           SnmpInformHandler cb,
                                           SnmpOid trapOid,
                                           SnmpVarBindList varBindList)
    throws IllegalStateException, IOException, SnmpStatusException {

    SnmpParameters p = (SnmpParameters) peer.getParams();
    return snmpInformRequest(peer.getDestAddr(),
                             peer.getDestPort(),
                             p.getInformCommunity(),
                             cb,
                             trapOid,
                             varBindList);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:51,代码来源:SnmpAdaptorServer.java

示例6: snmpV1Trap

import com.sun.jmx.snmp.SnmpParameters; //导入依赖的package包/类
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param agentAddr The agent address to be used for the trap.
 * @param enterpOid The enterprise OID to be used for the trap.
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
public void snmpV1Trap(SnmpPeer peer,
                       SnmpIpAddress agentAddr,
                       SnmpOid enterpOid,
                       int generic,
                       int specific,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {
    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV1Trap(peer.getDestAddr(),
               peer.getDestPort(),
               agentAddr,
               p.getRdCommunity(),
               enterpOid,
               generic,
               specific,
               varBindList,
               time);
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:41,代码来源:SnmpAdaptorServer.java

示例7: snmpV2Trap

import com.sun.jmx.snmp.SnmpParameters; //导入依赖的package包/类
/**
 * Sends a trap using SNMP V2 trap format.
 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination.
 * <BR>The community string used is the one located in the
 * <CODE>SnmpPeer</CODE> parameters
 * (<CODE>SnmpParameters.getRdCommunity() </CODE>).
 * <BR>The variable list included in the outgoing trap is composed of
 * the following items:
 * <UL>
 * <LI><CODE>sysUpTime.0</CODE> with the value specified by
 *     <CODE>time</CODE></LI>
 * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by
 *     <CODE>trapOid</CODE></LI>
 * <LI><CODE>all the (oid,values)</CODE> from the specified
 *     <CODE>varBindList</CODE></LI>
 * </UL>
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap.
 * @param trapOid The OID identifying the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 * @param time The time stamp (overwrite the current time).
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit
 * defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
public void snmpV2Trap(SnmpPeer peer,
                       SnmpOid trapOid,
                       SnmpVarBindList varBindList,
                       SnmpTimeticks time)
    throws IOException, SnmpStatusException {
    SnmpParameters p = (SnmpParameters) peer.getParams();
    snmpV2Trap(peer.getDestAddr(),
               peer.getDestPort(),
               p.getRdCommunity(),
               trapOid,
               varBindList,
               time);
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:42,代码来源:SnmpAdaptorServer.java

示例8: snmpInformRequest

import com.sun.jmx.snmp.SnmpParameters; //导入依赖的package包/类
/**
 * Sends an inform using SNMP V2 inform request format.
 * <BR>The inform is sent to the specified <CODE>SnmpPeer</CODE>
 *     destination.
 * <BR>The community string used is the one located in the
 *     <CODE>SnmpPeer</CODE> parameters
 *     (<CODE>SnmpParameters.getInformCommunity() </CODE>).
 * <BR>The variable list included in the outgoing inform is composed
 *     of the following items:
 * <UL>
 * <LI><CODE>sysUpTime.0</CODE> with its current value</LI>
 * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by
 *     <CODE>trapOid</CODE></LI>
 * <LI><CODE>all the (oid,values)</CODE> from the specified
 *     <CODE>varBindList</CODE></LI>
 * </UL>
 * To send an inform request, the SNMP adaptor server must be active.
 *
 * @param peer The <CODE>SnmpPeer</CODE> destination for this inform
 *             request.
 * @param cb The callback that is invoked when a request is complete.
 * @param trapOid The OID identifying the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 *
 * @return The inform request object.
 *
 * @exception IllegalStateException  This method has been invoked while
 *            the SNMP adaptor server was not active.
 * @exception IOException An I/O error occurred while sending the
 *            inform request.
 * @exception SnmpStatusException If the inform request exceeds the
 *            limit defined by <CODE>bufferSize</CODE>.
 *
 * @since 1.5
 */
public SnmpInformRequest snmpInformRequest(SnmpPeer peer,
                                           SnmpInformHandler cb,
                                           SnmpOid trapOid,
                                           SnmpVarBindList varBindList)
    throws IllegalStateException, IOException, SnmpStatusException {
    SnmpParameters p = (SnmpParameters) peer.getParams();
    return snmpInformRequest(peer.getDestAddr(),
                             peer.getDestPort(),
                             p.getInformCommunity(),
                             cb,
                             trapOid,
                             varBindList);
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:49,代码来源:SnmpAdaptorServer.java


注:本文中的com.sun.jmx.snmp.SnmpParameters类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。