Ìܼ¡

³µÍ×

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
  • snmptrapdµ¯Æ°
    systemctl start snmptrapd
  • ¼«Æ°µ¯Æ°ÀßÄê
    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 (2298d)