Summary: Cricket data collection system Name: cricket Version: 1.0.5 Release: 3 Group: Applications/Internet License: GPL Source: http://prdownloads.sf.net/cricket/cricket-%{version}.tar.gz Patch1: cricket-1.0.5-livehead3-x86.patch BuildArch: noarch BuildRequires: perl BuildRoot: /var/tmp/%{name}-root # Cricket has a lot of internal perl modules (some of which are # conditional on platform) and that gets a bunch of extra provides and # requires, so do it manually AutoReqProv: no PreReq: /usr/sbin/useradd PreReq: httpd Requires: perl /usr/bin/perl Requires: perl(CGI) Requires: perl(DB_File) Requires: perl(Date::Parse) Requires: perl(Digest::MD5) Requires: perl(LWP) Requires: perl(Time::HiRes) Requires: perl(BER) Requires: perl(SNMP_Session) Requires: perl(SNMP_util) Requires: perl(RRDs) %description Cricket is a high performance, extremely flexible system for monitoring trends in time-series data. Cricket was expressly developed to help network managers visualize and understand the traffic on their networks, but it can be used all kinds of other jobs, as well. Cricket uses the SNMP_Session perl module for data gathering and the RRD Tool library for data storage. %prep %setup -q %patch1 -p1 %build # Enable "FUNC" support for collector perl -pi -e 's/^#\s*(use func;)/$1/' collector # but turn off extra FUNC warning perl -pi -e 's/(\s*)(warn\s*")/$1#$2/' lib/func.pm # Set up paths: # - compiler, collector, perl libraries, and utils go in # %{_datadir}/cricket (typically /usr/share) # - configuration and data trees, image cache, collector logs, and misc # config files go under %{_var}/cricket (/var/cricket), which will be # the home directory for the "cricket" user # - Web interface (grapher, images) goes under %{_datadir}/cricket/html ./util/relocate-perl %define chome %{_var}/cricket find . -type f |\ xargs fgrep -l /usr/local/etc |\ xargs perl -pi -e 's!/usr/local/etc!%{chome}/etc!' cp cricket-conf.pl.sample cricket-conf.pl perl -pi -e ' s!^#*\s*(\$gCricketHome\s*=\s*).*!$1"%{chome}";!; s!^#*\s*(\$gInstallRoot\s*=\s*).*!$1"%{_datadir}/cricket";!; s!^#*\s*(\$gConfigRoot\s*=\s*).*!$1"%{chome}/config";!; s!^#*\s*(\$gCacheDir\s*=\s*).*!$1"%{chome}/cache";!; ' cricket-conf.pl perl -pi -e ' s!^(\s*my\s+\$gCF\s*=\s*).*!$1"%{chome}/etc/subtree-sets";!; ' collect-subtrees perl -pi -e ' s!^(base:\s*).*!$1%{chome}/config!; s!^(logdir:\s*).*!$1%{chome}/log!; ' subtree-sets perl -pi -e ' s!/cricket-data/!/data/!; s!/usr/bin/mailx!/bin/mail!; ' sample-config/Defaults find sample-config -type f |\ xargs fgrep -l '%%auto-base%%/../cricket/util' |\ xargs perl -pi -e ' s!%%auto-base%%/../cricket/util!%{_datadir}/cricket/util!; ' perl -pi -e ' s!(images/failed\.gif)!\$Common::global::gInstallRoot/html/$1!; ' grapher.cgi perl -pi -e ' s!/grapher.cgi!/html/grapher.cgi!; ' mini-graph.cgi %install rm -rf %{buildroot} # Put the collector files under /usr/share/cricket mkdir -p %{buildroot}%{_datadir}/cricket cp -pr collect* compile lib util %{buildroot}%{_datadir}/cricket # Make a symlink to the commands that may be called from the command line mkdir -p %{buildroot}%{_bindir} ln -s %{_datadir}/cricket/compile %{buildroot}%{_bindir}/cricket-compile ln -s %{_datadir}/cricket/collector %{buildroot}%{_bindir}/cricket-collector # Put the web interface files under /usr/share/cricket/html mkdir %{buildroot}%{_datadir}/cricket/html cp -pr grapher.cgi images mini-graph.cgi %{buildroot}%{_datadir}/cricket/html # Put the config tree, collected data, image cache, and collector logs # in ~cricket (/var/cricket) mkdir -p %{buildroot}%{chome} mkdir %{buildroot}%{chome}/config mkdir %{buildroot}%{chome}/data mkdir %{buildroot}%{chome}/cache mkdir %{buildroot}%{chome}/log # Put the system configuration files under ~cricket/etc mkdir %{buildroot}%{chome}/etc cp cricket-conf.pl subtree-sets %{buildroot}%{chome}/etc # Set up a default cron job (commented out) mkdir -p %{buildroot}/etc/cron.d cat > %{buildroot}/etc/cron.d/cricket < %{buildroot}/etc/httpd/conf.d/cricket.conf < Allow from all Options Indexes ExecCGI FollowSymLinks AllowOverride none # Send everything to grapher.cgi by default RewriteEngine on RewriteRule ^$ %{REQUEST_URI}grapher.cgi [R=permanent,L] RewriteRule ^(\?.*)$ %{REQUEST_URI}grapher.cgi\$1 [R=permanent,L,NE] # Uncomment to use ModPerl::Registry for the CGIs #SetHandler perl-script #PerlResponseHandler ModPerl::Registry # Otherwise run as a regular CGI AddHandler cgi-script .cgi Alias /cricket %{_datadir}/cricket/html EOF # List the core and library files/directories %define filelist rpmfilelist find %{buildroot}%{_datadir}/cricket -type d -print |\ perl -pe 's!%{buildroot}!%%dir !g' > %{filelist} find %{buildroot}%{_datadir}/cricket -type f -print |\ perl -pe 's!%{buildroot}!!g' >> %{filelist} %pre /usr/sbin/useradd -c "Cricket monitoring" -u 95 -g users \ -s /bin/bash -m -n -r -d /var/cricket cricket 2> /dev/null || : %clean rm -rf %{buildroot} %files -f %{filelist} %defattr (-, root, root) %doc README COPYING THANKS CHANGES DEV-INFO TODO doc %doc cricket-conf.pl.sample sample-config %{_bindir}/cricket-compile %{_bindir}/cricket-collector %attr (-, cricket, users) %dir %{chome} %attr (0750, cricket, apache) %dir %{chome}/data %attr (0750, cricket, apache) %dir %{chome}/config %attr (0770, cricket, apache) %dir %{chome}/cache %attr (0750, cricket, wheel) %dir %{chome}/log %attr (-, cricket, root) %dir %{chome}/etc %attr (-, cricket, root) %config %{chome}/etc/cricket-conf.pl %attr (-, cricket, root) %config %{chome}/etc/subtree-sets %attr (-, cricket, root) %config /etc/cron.d/cricket %config /etc/httpd/conf.d/cricket.conf %changelog * Tue May 4 2004 Chris Adams 1.0.5-3 - add support for newer format RRD file on x86 * Tue May 4 2004 Chris Adams 1.0.5-2 - fix failed.gif path in grapher.cgi * Sun May 2 2004 Chris Adams 1.0.5-1 - initial RPM build