# $Id: mailscanner-mrtg.spec,v 1.33 2005/07/07 21:24:02 kevinspicer Exp $ %define version 0.11.00 %define name mailscanner-mrtg Name: %{name} Version: %{version} Release: 1 Summary: mrtg monitor for MailScanner Email virus scanner and spam detector Group: Applications/Internet Copyright: GPL Vendor: Kevin Spicer Packager: Kevin Spicer URL: http://mailscannermrtg.sourceforge.net/ Requires: mailscanner >= 4.0, mrtg >= 2.9 perl >= 5.005, webserver BuildRequires: perl >= 5.005 Source: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-root BuildArchitectures: noarch %description mailscanner-mrtg provides configuration files, web pages, and related perl scripts for mrtg to monitor many aspects of your MailScanner machine. With it you will be able to monitor things like: Mail Relayed Files in incoming queue Spam Identified Files in outgoing queue Viruses Caught Memory (Ram) Used & Free Copies of Sendmail Running Load Average Copies of MailScanner Running CPU Utilization Disk Space Used in /var/spool Disk Space Used in / And more! Many items can be configured in mailscanner-mrtg by editing the /etc/MailScanner/mailscanner-mrtg.conf file. For most RedHat machines no configuration should be necesary. Merely install mailscanner-mrtg and point your browser to http://yourserver/mailscanner-mrtg/ Some of the graphs require the UCD or NET SNMP package to be installed, however this has not been made a dependency as the remainder of the package will function fine without it. You can also configure alarms at various thresholds, see /etc/MailScanner/mailscanner-mrtg.thresholds for details %prep %setup %build pod2man mailscanner-mrtg | gzip > mailscanner-mrtg.8.gz %install mkdir -p ${RPM_BUILD_ROOT} mkdir -p ${RPM_BUILD_ROOT}/etc/MailScanner/ mkdir -p ${RPM_BUILD_ROOT}/etc/mrtg/ mkdir -p ${RPM_BUILD_ROOT}/etc/cron.d/ mkdir -p ${RPM_BUILD_ROOT}/usr/sbin/ mkdir -p ${RPM_BUILD_ROOT}/usr/share/man/man8/ mkdir -p ${RPM_BUILD_ROOT}/etc/httpd/conf/ mkdir -p ${RPM_BUILD_ROOT}/usr/lib/MailScanner-MRTG/MSMRTG/ for i in cpu inqueue iptrafficnew loadavg mail mailbytes \ mailscanner memory outqueue rootusage sendmail spam \ spoolusage tmpfsusage virus quarantine spamratio virusratio \ batchsize speed do mkdir -p ${RPM_BUILD_ROOT}/var/www/html/mailscanner-mrtg/$i done install mailscanner-mrtg.conf ${RPM_BUILD_ROOT}/etc/MailScanner/ install mailscanner-mrtg.thresholds ${RPM_BUILD_ROOT}/etc/MailScanner/ install mailscanner-mrtg.cfg ${RPM_BUILD_ROOT}/etc/mrtg/ install mailscanner-mrtg.crond ${RPM_BUILD_ROOT}/etc/cron.d/ install mailscanner-mrtg ${RPM_BUILD_ROOT}/usr/sbin/ install mailscanner-mrtg.include ${RPM_BUILD_ROOT}/etc/httpd/conf/ install mailscanner-mrtg.8.gz ${RPM_BUILD_ROOT}/usr/share/man/man8/ install web/mailscanner-mrtg.jpg ${RPM_BUILD_ROOT}/var/www/html/mailscanner-mrtg/ install web/index.html ${RPM_BUILD_ROOT}/var/www/html/mailscanner-mrtg/ install web/htaccess ${RPM_BUILD_ROOT}/var/www/html/mailscanner-mrtg/.htaccess install lib/MSMRTG/* ${RPM_BUILD_ROOT}/usr/lib/MailScanner-MRTG/MSMRTG/ %clean rm -rf ${RPM_BUILD_ROOT} %pre %post # In the first RPM's I just put a line /etc/crontab # Let's take that out and make a file in /etc/cron.d # Thanks to Richard Keech for this idea! perl -p -i -e "s/0-59.+mailscanner-mrtg.cfg\n//" /etc/crontab echo "" echo "Running MRTG to get your initial graphs (Could be slow)" /usr/sbin/mailscanner-mrtg --notimeout cpu >/dev/null 2> /dev/null /usr/bin/mrtg /etc/mrtg/mailscanner-mrtg.cfg > /dev/null 2> /dev/null /usr/bin/mrtg /etc/mrtg/mailscanner-mrtg.cfg > /dev/null 2> /dev/null /usr/bin/mrtg /etc/mrtg/mailscanner-mrtg.cfg > /dev/null 2> /dev/null if [ "$1" = "1" ]; then #Fresh Install cat >> /etc/httpd/conf/httpd.conf << EOF Include /etc/httpd/conf/mailscanner-mrtg.include EOF /etc/init.d/httpd restart fi %preun %postun if [ "$1" = "0" ]; then # Oh Crap... We are being deleted! perl -p -i -e "s/Include.+mailscanner-mrtg.include\n//" /etc/httpd/conf/httpd.conf rm -f /etc/mrtg/mailscanner-mrtg* fi exit 0 %files %defattr(-,root,root) %attr(755,root,root) /usr/sbin/mailscanner-mrtg %attr(755,root,root) /usr/lib/MailScanner-MRTG/MSMRTG/Data.pm %attr(755,root,root) /usr/lib/MailScanner-MRTG/MSMRTG/Log.pm %attr(755,root,root) /usr/lib/MailScanner-MRTG/MSMRTG/State.pm %attr(755,root,root) /usr/lib/MailScanner-MRTG/MSMRTG/Scale.pm %attr(755,root,root) /usr/lib/MailScanner-MRTG/MSMRTG/Config.pm %attr(755,root,root) /usr/lib/MailScanner-MRTG/MSMRTG/Debug.pm %attr(755,root,root) /usr/lib/MailScanner-MRTG/MSMRTG/Alarm.pm %attr(644,root,root) /etc/httpd/conf/mailscanner-mrtg.include %attr(644,root,root) /usr/share/man/man8/mailscanner-mrtg.8.gz #%attr(644,root,root) /var/www/html/mailscanner-mrtg/index.html %config %attr(755,root,root) /var/www/html/mailscanner-mrtg/ %config(noreplace) %attr(600,root,root)/etc/MailScanner/mailscanner-mrtg.conf %config(noreplace) %attr(600,root,root)/etc/MailScanner/mailscanner-mrtg.thresholds %config(noreplace) %attr(644,root,root)/etc/mrtg/mailscanner-mrtg.cfg %config(noreplace) %attr(644,root,root)/etc/cron.d/mailscanner-mrtg.crond %doc docs/BUGS %doc docs/COPYING %doc docs/README %doc docs/README.SNMP %doc docs/CHANGELOG %doc docs/TODO %changelog * Thu Jul 7 2005 Kevin Spicer - Up to version 0.11.00 * Wed Oct 6 2004 Kevin Spicer - Up to version 0.10.00 * Wed Sep 22 2004 Kevin Spicer - Up to version 0.09.03 * Wed Sep 15 2004 Kevin Spicer - Up to version 0.09.02 - Make spec file install Log.pm (doh) * Wed Sep 15 2004 Kevin Spicer - Up to version 0.09.01 * Fri Sep 10 2004 Kevin Spicer - Use /etc/init.d/httpd rather than service, to support systems without a - service command. * Fri May 14 2004 Kevin Spicer - First run with --notimeout option * Thu May 13 2004 Kevin Spicer - Made all config files noreplace * Mon May 10 2004 Kevin Spicer - Added directories for batchsize and speed * Fri May 7 2004 Kevin Spicer - To v0.09.00 * Thu Feb 5 2004 Kevin Spicer - To v0.08.01 * Thu Feb 5 2004 Kevin Spicer - man page isn't a config file * Thu Feb 5 2004 Kevin Spicer - Numerous fixes up to v0.08.00 * Thu Jan 29 2004 Kevin Spicer - few minor fixes, 0.07.04 * Wed Jan 28 2004 Kevin Spicer - Rollup of fixes and requested tweaks to 0.07 - Added README.SNMP to docs * Mon Jan 26 2004 Kevin Spicer - New release to fix another net-snmp bug * Mon Jan 26 2004 Kevin Spicer - New release to fix important net-snmp bug * Mon Jan 26 2004 Kevin Spicer - corrected minor type preventing build * Sat Jan 24 2004 Kevin Spicer - Updated for 0.07 - (Addition of spamratio and virusratio, module installation) * Fri Jan 16 2004 Kevin Spicer - Added quarantine to list of directories to create * Wed Jan 14 2004 Kevin Spicer - Tighten permissions on conf file to protect snmp community string. - Added man page * Mon Nov 3 2003 Kevin Spicer - Version 0.06-4 (release version) - Fix some incorrect file ownership * Fri Oct 31 2003 Kevin Spicer - Version 0.06-3 (release version) - Ooops forgot to sign 0.06-2 * Fri Oct 31 2003 Kevin Spicer - Version 0.06-2 (release version) - Few small fixes (see CHANGELOG file) * Fri Oct 24 2003 Kevin Spicer - Version 0.06 (test build) - Updated Packager Details - Added tmpfsusage directory * Sun Dec 8 2002 Dale Lovelace - Up to 0.03 - Change the way we add the crontab entry - Only add Apache include on fresh install - Add iptraffic and mailbytes graphs - Add mailscanner-mrtg.crond file to /etc/cron.d * Sun Dec 8 2002 Dale Lovelace - Up to 0.02 - Add docs/CHANGELOG and docs/TODO - Modify description - works with Red Hat 7.2 - Add mailscanner-mrtg.include file for Apache - Modify httpd.conf file to Include /etc/httpd/conf/mailscanner-mrtg.include - Remove the Include line from httpd.conf on uninstall * Sat Dec 7 2002 Dale Lovelace - First crack at an RPM