Class NotificationOriginatorImpl

  • All Implemented Interfaces:
    NotificationOriginator

    public class NotificationOriginatorImpl
    extends Object
    implements NotificationOriginator
    The NotificationOriginatorImpl class implements a notification originator application for SNMP4J.

    See also RFC 3411 for a description of notification originators.

    Version:
    3.0.0
    Author:
    Frank Fock
    • Constructor Detail

      • NotificationOriginatorImpl

        public NotificationOriginatorImpl​(org.snmp4j.Session session,
                                          VACM vacm,
                                          SysUpTime sysUpTime,
                                          SnmpTargetMIB targetMIB,
                                          SnmpNotificationMIB notificationMIB)
        Creates a notification originator.
        Parameters:
        session - the SNMP Session instance to be used to send the notifications/informs.
        vacm - the VACM to be used to check access for notifications.
        sysUpTime - the sysUpTime instance to be used to determine sysUpTime.0 when sending notifications without specifically specified sysUpTime.
        targetMIB - the SnmpTargetMIB containing notification target information.
        notificationMIB - SnmpNotificationMIB
      • NotificationOriginatorImpl

        public NotificationOriginatorImpl​(org.snmp4j.Session session,
                                          VACM vacm,
                                          SysUpTime sysUpTime,
                                          SnmpTargetMIB targetMIB,
                                          SnmpNotificationMIB notificationMIB,
                                          SnmpCommunityMIB communityMIB)
        Creates a notification originator.
        Parameters:
        session - the Snmp instance to be used to send the notifications/informs.
        vacm - the VACM to be used to check access for notifications.
        sysUpTime - the sysUpTime instance to be used to determine sysUpTime.0 when sending notifications without specifically specified sysUpTime.
        targetMIB - the SnmpTargetMIB containing notification target information.
        notificationMIB - the SnmpNotificationMIB containing notification filtering information.
        communityMIB - the community MIB for coexistence information.
    • Method Detail

      • notify

        public Object notify​(org.snmp4j.smi.OctetString context,
                             org.snmp4j.smi.OID notificationID,
                             org.snmp4j.smi.VariableBinding[] vbs)
        Sends notifications (traps) to all appropriate notification targets.
        Specified by:
        notify in interface NotificationOriginator
        Parameters:
        context - the context name of the context on whose behalf this notification has been generated.
        notificationID - the object ID that uniquely identifies this notification. For SNMPv1 traps, the notification ID has to be build using the rules provided by RFC 2576.
        vbs - an array of VariableBinding instances representing the payload of the notification.
        Returns:
        an array of ResponseEvent instances. Since the NotificationOriginator determines on behalf of the SNMP-NOTIFICTON-MIB contents whether a notification is sent as trap/notification or as inform request, the returned array contains an element for each addressed target, but only a response PDU for inform targets.
      • setContextEngineID

        protected void setContextEngineID​(org.snmp4j.ScopedPDU scopedPDU,
                                          org.snmp4j.smi.OctetString context,
                                          org.snmp4j.smi.OID notificationID)
        Sets the context engine ID of the scoped PDU to the local engine ID provided by the targetMIB member.
        Parameters:
        scopedPDU - the scopedPDU to modify.
        context - the context associated with the notification/inform PDU.
        notificationID - the notification ID of the notification/inform PDU.
        Since:
        1.2.1
      • notify

        public Object notify​(org.snmp4j.smi.OctetString context,
                             org.snmp4j.smi.OID notificationID,
                             org.snmp4j.smi.TimeTicks sysUpTime,
                             org.snmp4j.smi.VariableBinding[] vbs)
        Description copied from interface: NotificationOriginator
        Sends notifications (traps) to all appropriate notification targets. The targets to notify are determined through the SNMP-TARGET-MIB and the SNMP-NOTIFICATION-MIB.
        Specified by:
        notify in interface NotificationOriginator
        Parameters:
        context - the context name of the context on whose behalf this notification has been generated.
        notificationID - the object ID that uniquely identifies this notification. For SNMPv1 traps, the notification ID has to be build using the rules provided by RFC 2576.
        sysUpTime - the value of the sysUpTime for the context context. This value will be included in the generated notification as sysUpTime.0.
        vbs - an array of VariableBinding instances representing the payload of the notification.
        Returns:
        an array of ResponseEvent instances. Since the NotificationOriginator determines on behalf of the SNMP-NOTIFICATON-MIB contents whether a notification is sent as trap/notification or as inform request, the returned array contains an element for each addressed target, but only a response PDU for inform targets.
      • setSession

        public void setSession​(org.snmp4j.Session snmpSession)
        Sets the SNMP session to used by this notification originator for sending notifications.
        Parameters:
        snmpSession - the Snmp instance to be used to send the notifications/informs.
        Since:
        1.9.1
      • fireNotificationLogEvent

        protected void fireNotificationLogEvent​(NotificationLogEvent<?> event)