ܼ

ZABBIXΥɤ°zabbix_trap_receiver.plλˡ
ZABBIX 2.0ʹߤSNMPTTλѤ侩Ƥ٤ȱѻλȤΰΩäƤ
ZABBIX 3.xΥɤˤsnmptrapdƤӽФzabbix_trap_receiver.plޤޤƤꡢѤˡ򵭺ܤ롣

Ƴ

ѥåƳ

  • Ϣѥå
    yum install net-snmp net-snmp-libs net-snmp-utils net-snmp-devel net-snmp-perl
    yum install bzip2 gzip tar unzip make curl lynx wget ftp gpg patch gcc 
    yum install perl perl-CPAN perl-YAML perl-Module-Build perl-Time-HiRes 
  • Perl饤֥Ƴ
    cpan
    
    <>
    
    install Config::IniFiles
    bye

zabbix_trap_receiver.pl

  • ŸƳ
    tar xfvz zabbix-3*.tar.gz
    cp ./zabbix-3*/misc/snmptrap/zabbix_trap_receiver.pl /usr/local/bin/
    chmod 755 /usr/local/bin/zabbix_trap_receiver.pl 
  • # vi /usr/local/bin/zabbix_trap_receiver.pl
    
    ѹ$SNMPTrapperFile = '/tmp/zabbix_traps.tmp';
    ѹ$SNMPTrapperFile = '/var/log/zabbix/snmptrap.log';

SNMPTrap

  • /etc/sysconfig/snmptrapd
    snmptrapdεưѥ᡼Ԥ
    MIBɤ߹ߤȥեƥlocal 6ѹ롣
    # vi /etc/sysconfig/snmptrapd
    
    OPTIONS="-m +ALL -Ls6 -On -p /var/run/snmptrapd.pid"
  • /etc/snmp/snmptrapd.conf
    snmptrapdưԤ
    # vi /etc/snmp/snmptrapd.conf
    
    authCommunity log,execute,net private
    authCommunity log,execute,net public
    
    perl do "/usr/local/bin/zabbix_trap_receiver.pl"

rsyslog

  • /etc/rsyslog.conf
    local 6Ǽνեꤹ롣
    # vi /etc/rsyslog.conf
    
    # SNMPTrap
    local6.*     /var/log/snmpd/snmptrap.log
  • ǥ쥯ȥ
    mkdir /var/log/snmpd

ZABBIX

  • /etc/zabbix/zabbix_server.conf
  • /etc/zabbix/zabbix_proxy.conf
    ƥݥեΥѥȥץεưꤹ롣
    SNMPTrapperFile=/var/log/zabbix/snmptrap.log
    StartSNMPTrapper=1

    SNMPTrapperFileꤷե뤬¸ߤʤ̤ʥ顼Ϥ뤿ᡢե롣
    touch /var/log/zabbix/snmptrap.log
    chown zabbix.zabbix /var/log/zabbix/snmptrap.log

ƻ

ӥ

  • rsyslogƵư
    systemctl restart rsyslog.service
  • ưư
    systemctl enable snmptrapd

SNMPTrapưԤ

  • SNMP Trap
    snmptrap -v 2c -c public 127.0.0.1 8640000 .1.3.6.1.6.3.1.1.5.3
  • /var/log/snmpd/snmptrap.log
    Dec 10 23:59:39 zp00 snmptrapd[6685]: 2016-12-10 23:59:39 localhost [UDP: [127.0.0.1]:50558->[127.0.0.1]:162]:#012.1.3.6.1.2.1.1.3.0 = Timeticks: (8640000) 1 day, 0:00:00.00#011.1.3.6.1.6.3.1.1.4.1.0 = OID: .1.3.6.1.6.3.1.1.5.3
    Dec 10 23:59:39 zp00 snmptrapd[6685]: perl callback function 0x7f60c4ccd0d8 returns 1
  • /var/log/zabbix/snmptrap.log
    01:02:12 2016/12/19 ZBXTRAP 127.0.0.1
    PDU INFO:
      notificationtype               TRAP
      version                        1
      receivedfrom                   UDP: [127.0.0.1]:51964->[127.0.0.1]:162
      errorstatus                    0
      messageid                      0
      community                      public
      transactionid                  1
      errorindex                     0
      requestid                      1426809208
    VARBINDS:
      .1.3.6.1.2.1.1.3.0             type=67 value=Timeticks: (8640000) 1 day, 0:00:00.00
      .1.3.6.1.6.3.1.1.4.1.0         type=6  value=OID: .1.3.6.1.6.3.1.1.5.3

https://www.zabbix.com/documentation/2.2/manual/config/items/itemtypes/snmptrap

http://nsb.homeip.net/wp/?p=421


ȥå   Խ ʬ ʎގ̎ ź ʣ ̾ѹ   ǽ   إ   ǽRSS
Last-modified: 2018-08-21 () 18:35:54 (29d)