The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Transform::Alert::Input::SNMPTrapd - Transform alerts from an internal SNMP Trap daemon

SYNOPSIS

    # In your configuration
    <Input test>
       Type      SNMPTrapd
       Interval  5  # you should set this to be very short
 
       # See Net::SNMPTrapd->new
       <ConnOpts>
          LocalAddr  192.168.1.1
          LocalPort  514  # default
          # Timeout - don't bother
       </ConnOpts>
       # <Template> tags...
    </Input>

DESCRIPTION

This input type will spawn a SNMP trap listener and process each trap through the input template engine. If it finds a match, the results of the match are sent to one or more outputs, depending on the group configuration.

See Net::SNMPTrapd for a list of the ConnOpts section parameters. The Timeout parameter is basically ignored, since get_trap calls will use a timeout of 0 (ie: instant). This is so that the main daemon doesn't bother waiting for messages during each heartbeat. As such, the Interval setting should be set very low. (But, not zero; that would be unwise...)

OUTPUTS

Text

    $addr:$port - $datagram

Preparsed Hash

    {
       remoteaddr => $str,
       remoteport => $int,
 
       version   => $int,  # 1 = SNMPv1, 2 = SNMPv2c
       community => $str,
       pdu_type  => $str,  # text version
       varbinds  => [
          [{ $OID => $value }],
          [{ $OID => $value }],
          # ...
       ],
 
       # SNMPv1 only
       ent_OID       => $str,
       agentaddr     => $str,
       generic_trap  => $str,  # text version
       specific_trap => $str,
       timeticks     => $int,
 
       # SNMPv2 only
       request_ID    => $str,
       error_status  => $str,
       error_index   => $int,
    }

CAVAETS

Admittedly, the datagram of a SNMP trap isn't all that useful, so the text version is somewhat useless...

AVAILABILITY

The project homepage is https://github.com/SineSwiper/Transform-Alert/wiki.

The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit http://www.perl.com/CPAN/ to find a CPAN site near you, or see https://metacpan.org/module/Transform::Alert/.

AUTHOR

Brendan Byrd <BBYRD@CPAN.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2013 by Brendan Byrd.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)