%global dash_version 1-5 Name: snmptt Version: 1.5 Release: 1%{?dist} Summary: An SNMP trap handler written in Perl License: GPLv2+ URL: http://www.snmptt.org/ Source0: https://github.com/snmptt/snmptt/releases/download/snmptt_%{dash_version}/%{name}_%{version}.tgz BuildArch: noarch BuildRequires: systemd-units Requires: net-snmp Requires: logrotate Requires: perl-Net-SNMP Requires: perl(Config::IniFiles) Requires: perl(File::Basename) Requires: perl(File::Copy) Requires: perl(File::Spec) Requires: perl(Getopt::Long) Requires: perl(POSIX) Requires: perl(Sys::Hostname) Requires: perl(Sys::Syslog) Requires: perl(Text::Balanced) Requires: perl(Text::ParseWords) Requires: perl(Time::HiRes) Recommends: perl(Digest::MD5) Recommends: perl(Net::IP) Recommends: perl(Socket) Recommends: perl(Thread::Semaphore) Suggests: perl(DBI) Suggests: perl(DBD::mysql) Suggests: perl(DBD::ODBC) Suggests: perl(DBD::Pg) Suggests: perl(DBD::PgPP) Suggests: perl(Log::Syslog::Constants) Suggests: perl(Log::Syslog::Fast) Suggests: perl(SNMP) Requires(pre): shadow-utils Requires(post): systemd-units Requires(preun): systemd-units Requires(postun): systemd-units %description SNMPTT (SNMP Trap Translator) is an SNMP trap handler written in Perl for use with the Net-SNMP / UCD-SNMP snmptrapd program. It can be used to translate trap output from snmptrapd to more descriptive and human friendly form, supports logging, invoking external programs, and has the ability to accept or reject traps based on a number of parameters. %prep %setup -qn %{name}_%{version} mv sample-*trap* examples/ mv examples/snmptt.conf.generic snmptt.conf # convert ChangeLog to UTF-8 iconv -f ISO-8859-1 -t UTF-8 ChangeLog > ChangeLog.utf8 && \ touch -r ChangeLog ChangeLog.utf8 && \ mv -f ChangeLog{.utf8,} # Run in foreground under systemd instead of self-daemonizing sed -i 's/^daemon_fork = 1/daemon_fork = 0/' snmptt.ini # Disable PID file — systemd tracks the process directly sed -i 's|^pid_file = /var/run/snmptt.pid|pid_file = |' snmptt.ini # Add snmptt.d drop-in directory to snmptt_conf_files sed -i '/^\/etc\/snmptt\/snmptt.conf$/a /etc/snmptt/snmptt.d/*.conf' snmptt.ini # Rewrite service file for modern systemd: foreground execution, no PID file cat > snmptt.service <<'EOF' [Unit] Description=SNMP Trap Translator (SNMPTT) After=syslog.target network.target snmptrapd.service [Service] Type=exec ExecStart=/usr/sbin/snmptt --daemon ExecReload=/bin/kill -HUP $MAINPID User=snmptt Group=snmptt [Install] WantedBy=multi-user.target EOF %build %install install -D -p -m 0755 snmptt %{buildroot}%{_sbindir}/snmptt install -D -p -m 0755 snmptthandler %{buildroot}%{_sbindir}/snmptthandler install -D -p -m 0644 snmptthandler-embedded %{buildroot}%{_datadir}/snmptt/snmptthandler-embedded install -D -p -m 0755 snmpttconvert %{buildroot}%{_bindir}/snmpttconvert install -D -p -m 0755 snmpttconvertmib %{buildroot}%{_bindir}/snmpttconvertmib install -D -p -m 0644 snmptt.conf %{buildroot}%{_sysconfdir}/snmptt/snmptt.conf install -D -p -m 0644 snmptt.ini %{buildroot}%{_sysconfdir}/snmptt/snmptt.ini install -D -p -m 0644 snmptt.service %{buildroot}%{_unitdir}/%{name}.service install -D -p -m 0644 snmptt.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/snmptt install -d -m 0755 %{buildroot}%{_sysconfdir}/snmptt/snmptt.d install -d -m 0755 %{buildroot}%{_localstatedir}/spool/snmptt install -d -m 0755 %{buildroot}%{_localstatedir}/log/snmptt %pre getent group snmptt >/dev/null || groupadd -r snmptt getent passwd snmptt >/dev/null || \ useradd -r -g snmptt -d /var/spool/snmptt -s /sbin/nologin \ -c "SNMP Trap Translator" snmptt exit 0 %post %systemd_post %{name}.service %preun %systemd_preun %{name}.service %postun %systemd_postun_with_restart %{name}.service %files %doc ChangeLog COPYING README %doc contrib/ docs/ examples/ %{_sbindir}/snmptt %{_sbindir}/snmptthandler %{_datadir}/snmptt/ %{_bindir}/snmpttconvert %{_bindir}/snmpttconvertmib %config(noreplace) %{_sysconfdir}/snmptt/snmptt.conf %config(noreplace) %{_sysconfdir}/snmptt/snmptt.ini %dir %{_sysconfdir}/snmptt/ %dir %{_sysconfdir}/snmptt/snmptt.d/ %config(noreplace) %{_sysconfdir}/logrotate.d/snmptt %{_unitdir}/snmptt.service %attr(0755,snmptt,snmptt) %dir %{_localstatedir}/spool/snmptt/ %attr(0755,snmptt,snmptt) %dir %{_localstatedir}/log/snmptt/ %changelog * Tue Mar 17 2026 Gary T. Giesen - 1.5-1 - New upstream release - Remove RHEL 6 / SysVinit support (EOL since 2020) - Modernize systemd unit: Type=exec, drop PIDFile, run as snmptt via User=/Group= - Set daemon_fork=0 and disable PID file for foreground execution under systemd - Use systemd RPM macros for scriptlets - Move configuration from /etc/snmp/ to /etc/snmptt/ to match upstream defaults - Add /etc/snmptt/snmptt.d/ drop-in directory for trap definition files - Remove deprecated Group and BuildRoot tags - Add explicit Perl module dependencies for Perl 5.40 compatibility - Add Recommends/Suggests for optional Perl modules (database, IPv6, alt-syslog) * Thu Jul 23 2020 Volker Fröhlich - 1.4.2-1 - New upstream release * Wed Jul 22 2020 Volker Fröhlich - 1.4.1-1 - New upstream release * Sat Jan 18 2014 Volker Fröhlich - 1.4-0.9.beta2 - Correct permissions for embedded handler * Sat Jan 18 2014 Volker Fröhlich - 1.4-0.8.beta2 - Add embedded trap handler (BZ 1038596) - Simplify if clauses for Fedora - Remove defattr, clean section and initial rm in install section * Fri Feb 15 2013 Fedora Release Engineering - 1.4-0.7.beta2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild * Tue Oct 30 2012 Andrew Colin Kissa - 1.4-0.6.beta2 - Require perl-Net-SNMP * Mon Oct 29 2012 Andrew Colin Kissa - 1.4-0.5.beta2 - Fixes requested by reviewer * Sun Oct 28 2012 Andrew Colin Kissa - 1.4-0.4.beta2 - Fix incorrect files * Sun Oct 28 2012 Andrew Colin Kissa - 1.4-0.3.beta2 - Added shadow-utils dependency * Sun Oct 28 2012 Andrew Colin Kissa - 1.4-0.2.beta2 - Fix issues raised by reviewer * Thu Oct 25 2012 Andrew Colin Kissa - 1.4-0.1.beta2 - New upstream release. - Fedora review changes implemented - Introduce systemd files * Mon Jul 27 2009 Gary T. Giesen 1.3-0.1.beta2 - New upstream release. Incorporates previous fixes from Ville Skysttä * Mon Jul 07 2009 Gary T. Giesen 1.2-3 - Incorporated various patches and suggestions from Ville Skysttä * Mon Jul 07 2009 Gary T. Giesen 1.2-2 - Spec file cleanup * Mon Jul 06 2009 Gary T. Giesen 1.2-1 - Initial spec file creation