%define uname SysUsage %define vname Sar %define wname sysusage %define webdir %{_localstatedir}/www/%{wname} Name: %{wname} Epoch: 0 Version: 2.9 Release: 1%{?dist} Summary: System monitoring based on perl, rrdtool, and sysstat Group: System Environment/Daemons License: GPL+ or Artistic URL: http://www.samse.fr/GPL/%{wname} Source0: http://www.samse.fr/GPL/%{wname}/%{uname}-%{vname}-%{version}.tar.gz Source1: %{wname}-%{version}.cfg BuildArch: noarch BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) Requires: rrdtool Requires: sysstat Requires: httpd Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) %description SysUsage is a tool used to continuously monitor a system and generate a daily/weekly/monthly/yearly graphical report using rrdtool and sar. %prep %setup -q -n %{uname}-%{vname}-%{version} # create default crontab entry echo "#*/1 * * * * root %{_bindir}/%{wname} > /dev/null 2>&1" > %{wname}.cron echo "#*/5 * * * * root %{_bindir}/%{wname}graph > /dev/null 2>&1" >> %{wname}.cron # create default httpd configuration cat > %{wname}.conf << _EOF_ # # By default %{wname} statistics are only accessible from the local host. # Alias /%{wname} %{webdir} Order deny,allow Deny from all Allow from 127.0.0.1 Allow from ::1 # Allow from .example.com _EOF_ # create README.Fedora cat > README.Fedora << _EOF_ 1. Setup a cronjob to run %{wname}. Uncomment the entries in %{_sysconfdir}/cron.d/%{wname} or create a custom cronjob. 2. Ensure that httpd is running. 3. Browse to http://localhost/%{wname} to ensure that things are working properly. 4. If necessary, give additional hosts access to %{wname} by adding them to %{_sysconfdir}/httpd/conf.d/%{wname}.conf. _EOF_ # remove the hardcoded /usr/local/sysusage path %{__sed} -i -e 's,/usr/local/sysusage,,g' bin/%{wname} %{__sed} -i -e 's,/usr/local/sysusage,,g' bin/%{wname}graph %build # nope, gotta love perl %install %{__rm} -rf %{buildroot} # set up path structure %{__install} -d -m 0755 %{buildroot}/%{_bindir} %{__install} -d -m 0755 %{buildroot}/%{_sysconfdir} %{__install} -d -m 0755 %{buildroot}/%{_localstatedir}/lib/%{wname} %{__install} -d -m 0755 %{buildroot}/%{perl_vendorlib}/%{uname} %{__install} -d -m 0755 %{buildroot}/%{webdir} # install files %{__install} -m 0644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/%{wname}.cfg %{__install} -m 0644 %{vname}.pm %{buildroot}/%{perl_vendorlib}/%{uname} %{__install} -m 0755 bin/%{wname} %{buildroot}/%{_bindir} %{__install} -m 0755 bin/%{wname}graph %{buildroot}/%{_bindir} %{__install} -m 0755 bin/%{wname}warn %{buildroot}/%{_bindir} %{__install} -D -m 0644 %{wname}.cron %{buildroot}/%{_sysconfdir}/cron.d/%{wname} %{__install} -D -m 0644 %{wname}.conf %{buildroot}/%{_sysconfdir}/httpd/conf.d/%{wname}.conf %clean %{__rm} -rf %{buildroot} %files %defattr(0644,root,root,0755) %doc Changes INSTALL README TODO README.Fedora %attr(0755,root,root) %{_bindir}/%{wname} %attr(0755,root,root) %{_bindir}/%{wname}graph %attr(0755,root,root) %{_bindir}/%{wname}warn %config(noreplace) %{_sysconfdir}/%{wname}.cfg %config(noreplace) %{_sysconfdir}/cron.d/%{wname} %config(noreplace) %{_sysconfdir}/httpd/conf.d/%{wname}.conf %{perl_vendorlib}/%{uname} %dir %{_localstatedir}/lib/%{wname} %dir %{webdir} %changelog * Wed Oct 15 2008 Rob Myers 0:2.9-1 - update to 2.9 - move webdir /var/www/sysusage (resolves #465652) * Wed Jul 2 2008 Rob Myers 0:2.6-4 - include missing versioned MODULE_COMPAT Requires (#453586) * Thu Nov 15 2007 Rob Myers 0:2.6-3 - fix minor license issue - add a default crontab entry - add a default httpd configuration - add README.Fedora * Fri Nov 9 2007 Rob Myers 0:2.6-2 - seds really belong in prep * Thu Nov 8 2007 Rob Myers 0:2.6-1 - move seds to build section - remove perl requires - update to 2.6 * Mon Jul 16 2007 Rob Myers 0:2.5-3 - define vname and wname in case this package should be renamed to perl-%%{uname}-%%{vname} * Fri Jul 13 2007 Rob Myers 0:2.5-2 - change /var/db/sysusage to /var/lib/sysusage - change perl_vendorarch to perl_vendorlib to build noarch - update license - add dist tag - misc spec changes and/or cleanups * Fri Jul 6 2007 Jason Corley 0:2.5-1 - first packaging attempt