|
|
@@ -0,0 +1,207 @@
|
|
|
+##
|
|
|
+## cacti.spec -- OpenPKG RPM Specification
|
|
|
+## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
|
|
|
+## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
|
|
|
+## Copyright (c) 2000-2003 Cable & Wireless <http://www.cw.com/>
|
|
|
+##
|
|
|
+## Permission to use, copy, modify, and distribute this software for
|
|
|
+## any purpose with or without fee is hereby granted, provided that
|
|
|
+## the above copyright notice and this permission notice appear in all
|
|
|
+## copies.
|
|
|
+##
|
|
|
+## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
|
|
+## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
+## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
+## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
|
|
|
+## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
+## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
+## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
|
|
+## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
+## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
+## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
|
+## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
+## SUCH DAMAGE.
|
|
|
+##
|
|
|
+
|
|
|
+# package information
|
|
|
+Name: cacti
|
|
|
+Summary: Network Monitoring and Graphing Frontend
|
|
|
+URL: http://www.raxnet.net/products/cacti/
|
|
|
+Vendor: raXnet
|
|
|
+Packager: The OpenPKG Project
|
|
|
+Distribution: OpenPKG [EVAL]
|
|
|
+Group: Database
|
|
|
+License: GPL
|
|
|
+Version: 0.8.2a
|
|
|
+Release: 20030819
|
|
|
+
|
|
|
+# list of sources
|
|
|
+Source0: http://www.raxnet.net/downloads/cacti-%{version}.tar.gz
|
|
|
+Source1: cacti-setup.sh
|
|
|
+Source2: cacti-cron.sh
|
|
|
+Source3: cacti-apache.conf
|
|
|
+Source4: rc.cacti
|
|
|
+
|
|
|
+# build information
|
|
|
+Prefix: %{l_prefix}
|
|
|
+BuildRoot: %{l_buildroot}
|
|
|
+BuildPreReq: OpenPKG, openpkg >= 20030103
|
|
|
+PreReq: OpenPKG, openpkg >= 20030103
|
|
|
+PreReq: rrdtool, mysql, snmp, perl, php, wget
|
|
|
+PreReq: apache
|
|
|
+PreReq: apache::with_mod_php = yes
|
|
|
+PreReq: apache::with_mod_php_mysql = yes
|
|
|
+AutoReq: no
|
|
|
+AutoReqProv: no
|
|
|
+
|
|
|
+%description
|
|
|
+ Cacti is a complete frontend to RRDTool, it stores all of the
|
|
|
+ necessary information to create graphs and populate them with data
|
|
|
+ in a MySQL database. The frontend is completely PHP driven. Along
|
|
|
+ with being able to maintain Graphs, Data Sources, and Round Robin
|
|
|
+ Archives in a database, Cacti handles the data gathering. There is
|
|
|
+ also SNMP support for those used to creating traffic graphs with
|
|
|
+ MRTG.
|
|
|
+
|
|
|
+%prep
|
|
|
+ %setup -q
|
|
|
+
|
|
|
+%build
|
|
|
+
|
|
|
+%install
|
|
|
+ rm -rf $RPM_BUILD_ROOT
|
|
|
+
|
|
|
+ # create installation hierarchy
|
|
|
+ %{l_shtool} mkdir -f -p -m 755 \
|
|
|
+ $RPM_BUILD_ROOT%{l_prefix}/sbin \
|
|
|
+ $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
|
|
|
+ $RPM_BUILD_ROOT%{l_prefix}/etc/cacti \
|
|
|
+ $RPM_BUILD_ROOT%{l_prefix}/share/cacti \
|
|
|
+ $RPM_BUILD_ROOT%{l_prefix}/var/cacti/run
|
|
|
+
|
|
|
+ # adjust configuration
|
|
|
+ %{l_shtool} subst \
|
|
|
+ -e 's;"cactiuser";"cacti";g' \
|
|
|
+ include/config.php
|
|
|
+ %{l_shtool} subst \
|
|
|
+ -e 's;perl <path_cacti>;%{l_prefix}/bin/perl %{l_prefix}/share/cacti;' \
|
|
|
+ -e 's;\(path_php_binary.*\)<DEFAULT>;\1%{l_prefix}/bin/php;' \
|
|
|
+ -e 's;\(path_snmpwalk.*\)<DEFAULT>;\1%{l_prefix}/bin/snmpwalk;' \
|
|
|
+ -e 's;\(path_snmpget.*\)<DEFAULT>;\1%{l_prefix}/bin/snmpget;' \
|
|
|
+ -e 's;\(path_rrdtool.*\)<DEFAULT>;\1%{l_prefix}/bin/rrdtool;' \
|
|
|
+ -e 's;\(path_webroot.*\)<DEFAULT>;\1%{l_prefix}/share/cacti;' \
|
|
|
+ -e 's;\(path_webcacti.*\)<DEFAULT>;\1/cacti/;' \
|
|
|
+ -e 's;\(smnp_version.*\)ucd-snmp;\1net-snmp;' \
|
|
|
+ cacti.sql
|
|
|
+ %{l_shtool} subst \
|
|
|
+ -e 's;docs/;../docs/;g' \
|
|
|
+ install/index.php
|
|
|
+
|
|
|
+ # install all files and strip down installation afterwards
|
|
|
+ cp -rp * $RPM_BUILD_ROOT%{l_prefix}/share/cacti/
|
|
|
+ ( cd $RPM_BUILD_ROOT%{l_prefix}/share/cacti
|
|
|
+ rm -f LICENSE README
|
|
|
+ rm -rf cactid
|
|
|
+ ( mv include/adodb/drivers/adodb-mysql* .
|
|
|
+ rm -rf include/adodb/drivers/*
|
|
|
+ mv adodb-mysql* include/adodb/drivers/
|
|
|
+ mv include/adodb/datadict/datadict-mssql* .
|
|
|
+ rm -rf include/adodb/datadict/*
|
|
|
+ mv datadict-mssql* include/adodb/datadict/
|
|
|
+ ) || exit $?
|
|
|
+ rm -f rra/.placeholder
|
|
|
+ rm -f log/rrd.log
|
|
|
+ ) || exit $?
|
|
|
+
|
|
|
+ # move variable data into separate locations
|
|
|
+ mv $RPM_BUILD_ROOT%{l_prefix}/share/cacti/log \
|
|
|
+ $RPM_BUILD_ROOT%{l_prefix}/var/cacti/log
|
|
|
+ %{l_shtool} mkln -s \
|
|
|
+ $RPM_BUILD_ROOT%{l_prefix}/var/cacti/log \
|
|
|
+ $RPM_BUILD_ROOT%{l_prefix}/share/cacti/log
|
|
|
+ mv $RPM_BUILD_ROOT%{l_prefix}/share/cacti/rra \
|
|
|
+ $RPM_BUILD_ROOT%{l_prefix}/var/cacti/rra
|
|
|
+ %{l_shtool} mkln -s \
|
|
|
+ $RPM_BUILD_ROOT%{l_prefix}/var/cacti/rra \
|
|
|
+ $RPM_BUILD_ROOT%{l_prefix}/share/cacti/rra
|
|
|
+
|
|
|
+ # internally Cacti appends the webroot to its directory
|
|
|
+ # but we don't want to do this, so use a self-ref link.
|
|
|
+ ( cd $RPM_BUILD_ROOT%{l_prefix}/share/cacti
|
|
|
+ ln -s . cacti
|
|
|
+ ) || exit $?
|
|
|
+
|
|
|
+ # install run-command script
|
|
|
+ %{l_shtool} install -c -m 644 %{l_value -s -a} \
|
|
|
+ %{SOURCE rc.cacti} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
|
|
|
+
|
|
|
+ # install MySQL database setup script
|
|
|
+ %{l_shtool} install -c -m 755 %{l_value -s -a} \
|
|
|
+ %{SOURCE cacti-setup.sh} \
|
|
|
+ $RPM_BUILD_ROOT%{l_prefix}/sbin/cacti-setup
|
|
|
+
|
|
|
+ # install Cron job script
|
|
|
+ %{l_shtool} install -c -m 755 %{l_value -s -a} \
|
|
|
+ %{SOURCE cacti-cron.sh} \
|
|
|
+ $RPM_BUILD_ROOT%{l_prefix}/sbin/cacti-cron
|
|
|
+
|
|
|
+ # install custom Apache configuration
|
|
|
+ l_hostname=`%{l_shtool} echo -e %h`
|
|
|
+ l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
|
|
|
+ %{l_shtool} install -c -m 644 %{l_value -s -a} \
|
|
|
+ -e "s;@l_hostname@;$l_hostname;g" \
|
|
|
+ -e "s;@l_domainname@;$l_domainname;g" \
|
|
|
+ %{SOURCE cacti-apache.conf} \
|
|
|
+ $RPM_BUILD_ROOT%{l_prefix}/etc/cacti/
|
|
|
+
|
|
|
+ # determine installation files
|
|
|
+ %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
|
|
|
+ %{l_files_std} \
|
|
|
+ '%config %{l_prefix}/etc/cacti/*' \
|
|
|
+ '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/cacti'
|
|
|
+
|
|
|
+%files -f files
|
|
|
+
|
|
|
+%clean
|
|
|
+ rm -rf $RPM_BUILD_ROOT
|
|
|
+
|
|
|
+%post
|
|
|
+ if [ $1 -eq 1 ]; then
|
|
|
+ # display final hints on initial installation
|
|
|
+ ( echo "1. To complete installation of the Cacti package please you have"
|
|
|
+ echo " start MySQL and setup the initial Cacti database. For this run"
|
|
|
+ echo " the following commands:"
|
|
|
+ echo " \$ $RPM_INSTALL_PREFIX/etc/rc mysql start"
|
|
|
+ echo " \$ $RPM_INSTALL_PREFIX/sbin/cacti-setup"
|
|
|
+ echo " \$ $RPM_INSTALL_PREFIX/etc/rc mysql stop"
|
|
|
+ echo ""
|
|
|
+ echo "2. Cacti by default is run by the OpenPKG cron jobs every 15"
|
|
|
+ echo " minutes only. Usually Cacti wants to run every 5 minutes for"
|
|
|
+ echo " more granular data gathering. For this set:"
|
|
|
+ echo " # $RPM_INSTALL_PREFIX/etc/rc.conf:"
|
|
|
+ echo " cacti_cron=\"no\""
|
|
|
+ echo " and setup a cronjob for user %{l_rusr}"
|
|
|
+ echo " # system crontab:"
|
|
|
+ echo " */5 * * * * %{l_rusr} $RPM_INSTALL_PREFIX/sbin/cacti-cron"
|
|
|
+ echo ""
|
|
|
+ echo "3. Cacti by default is running with an own Apache server on"
|
|
|
+ echo " IPv4 address 127.0.0.1, TCP port 8080. Please change this"
|
|
|
+ echo " by editing the \"Port 8080\" and \"Listen 127.0.0.1:8080\""
|
|
|
+ echo " directives in $RPM_INSTALL_PREFIX/etc/cacti/cacti-apache.conf"
|
|
|
+ echo ""
|
|
|
+ echo "4. After this post-installation steps, startup Cacti by running"
|
|
|
+ echo " \$ $RPM_INSTALL_PREFIX/etc/rc cacti start"
|
|
|
+ echo " and connecting with your browser to:"
|
|
|
+ echo " http://127.0.0.1:8080/"
|
|
|
+ echo " Then proceed Cacti's initial configuration dialog. Then login"
|
|
|
+ echo " as 'admin' (with initial password 'admin') and change the"
|
|
|
+ echo " password to a custom one."
|
|
|
+ ) | %{l_rpmtool} msg -b -t notice
|
|
|
+ fi
|
|
|
+
|
|
|
+%preun
|
|
|
+ if [ $1 -eq 0 ]; then
|
|
|
+ # remove generated logfiles
|
|
|
+ rm -f $RPM_INSTALL_PREFIX/var/cacti/log/*
|
|
|
+ fi
|
|
|
+
|