Skip to content

Instantly share code, notes, and snippets.

@jpawlowski
Last active May 18, 2022 19:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save jpawlowski/152abb4951f39ce1cfa0b1c5220b8635 to your computer and use it in GitHub Desktop.
Save jpawlowski/152abb4951f39ce1cfa0b1c5220b8635 to your computer and use it in GitHub Desktop.
SNMPTT installation on CentOS 7 for Zabbix integration

SNMPTT installation on CentOS 7 for Zabbix integration

yum install wget make gcc net-snmp net-snmp-utils

cd /usr/local/src
wget http://downloads.sourceforge.net/project/snmptt/snmptt/snmptt_1.4/snmptt_1.4.tgz

tar xfz snmptt_*.tgz
snmp_*
cp -rv snmptt snmpttconvert snmpttconvertmib snmptthandler-embedded /usr/sbin/
chmod 755 /usr/sbin/snmptt*
cp -nv snmptt.ini /etc/snmp/snmptt.ini
cp -nv snmptt.logrotate /etc/logrotate.d/snmptt

useradd -N -r snmptt
mkdir -pv /var/log/snmptt
mkdir -pv /var/spool/snmptt
chown snmptt /var/log/snmptt /var/spool/snmptt

cp -vn /etc/snmp/snmptrapd.conf /etc/snmp/snmptrapd.conf.default
cat <<EOF >> /etc/snmp/snmptrapd.conf
authCommunity log,execute,net public
perl do "/usr/lib/snmptt/snmptthandler-embedded";
EOF

sed -i "s/OPTIONS='-Lsd/OPTIONS='-On -Lsd/" /etc/default/snmptrapd

sed -i 's;#date_format = %a %b %e %Y;date_format = %H:%M:%S %Y/%m/%d;' /etc/snmp/snmptt.ini
sed -i 's/syslog_enable = 1/syslog_enable = 0/' /etc/snmp/snmptt.ini
sed -i 's/net_snmp_perl_enable = 0/net_snmp_perl_enable = 1/' /etc/snmp/snmptt.ini
sed -i 's/net_snmp_perl_cache_enable = 0/net_snmp_perl_cache_enable = 1/' /etc/snmp/snmptt.ini

sed -i 's/^SNMPTrapperFile.*/SNMPTrapperFile = \/var\/log\/snmptt\/snmptt.log/' /etc/zabbix/zabbix_server.conf
echo "StartSNMPTrapper=1" >> /etc/zabbix/zabbix_server.conf
@mrRobit
Copy link

mrRobit commented Oct 27, 2016

At line 7, you are missing "cd" in front of snmp_*?

@kerneldoug
Copy link

kerneldoug commented Jul 7, 2017

And Centos 7.3, snmptrapd is at /etc/sysconfig/snmptrapd, not /etc/default/snmptrapd

sed -i "s/# OPTIONS=\"-Lsd/OPTIONS=\"-On -Lsd"/ /etc/sysconfig/snmptrapd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment