Installation 0.8.7g on debian

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
nationals
Cacti User
Posts: 76
Joined: Wed Aug 27, 2008 5:21 am
Location: China
Contact:

Installation 0.8.7g on debian

Post by nationals »

Updated!
Last edited by nationals on Sat Jun 25, 2011 3:09 am, edited 5 times in total.
nationals
Cacti User
Posts: 76
Joined: Wed Aug 27, 2008 5:21 am
Location: China
Contact:

compile spine 0.8.7g on debian

Post by nationals »

Code: Select all

#compile spine 0.8.7g on debian linux
# Make by Patrick.Ru @ China
# E-Mail : patrick.ru@hotmail.com
# Date : 28-Aug-2010

#prepare the tool for compile the spine
apt-get update -y
apt-get upgrade -y
apt-get install gcc g++ autoconf automake make patch -y
aptitude install libtool -y
apt-get install mysql-server -y
apt-get install libmysqlclient15-dev -y
apt-get install libssl-dev -y
apt-get install libsnmp-dev -y
apt-get install build-essential -y

cd /tmp
wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.7g.tar.gz
wget http://www.cacti.net/downloads/spine/patches/0.8.7g/unified_issues.patch
tar zxvf cacti-spine-0.8.7g.tar.gz
cd cacti-spine-0.8.7g
patch -p1 -N < ../unified_issues.patch

#compiling
aclocal 
libtoolize --force 
autoconf 
autoheader 
automake 
./configure
make
make install

cp /usr/local/spine/etc/spine.conf.dist  /usr/local/spine/etc/spine.conf
Attachments
spine-path.JPG
spine-path.JPG (9.09 KiB) Viewed 8701 times
spine-poller.JPG
spine-poller.JPG (5.73 KiB) Viewed 8701 times
Last edited by nationals on Sat Jun 25, 2011 3:18 am, edited 1 time in total.
nationals
Cacti User
Posts: 76
Joined: Wed Aug 27, 2008 5:21 am
Location: China
Contact:

install plugin settings

Post by nationals »

Code: Select all

cd /tmp
wget http://docs.cacti.net/_media/plugin:settings-v0.7-1.tgz -O setting.tgz
tar zxvf settings.tgz -C /var/www/plugins
chown -R www-data:www-data /var/www/plugins/
Last edited by nationals on Sat Aug 28, 2010 5:28 pm, edited 2 times in total.
nationals
Cacti User
Posts: 76
Joined: Wed Aug 27, 2008 5:21 am
Location: China
Contact:

install plugin clog

Post by nationals »

Code: Select all

cd /tmp
wget http://docs.cacti.net/_media/plugin:clog-v1.5-1.tgz -O clog.tgz 
tar zxvf clog.tgz -C /var/www/plugins 
chown -R www-data:www-data /var/www/plugins/
Last edited by nationals on Sat Aug 28, 2010 5:29 pm, edited 1 time in total.
nationals
Cacti User
Posts: 76
Joined: Wed Aug 27, 2008 5:21 am
Location: China
Contact:

html_output.patch

Post by nationals »

html_output.patch for if install the pa first.

Code: Select all

# install cacti 0.8.7g on debian linux 
# Make by Patrick.Ru @ China 
# E-Mail : patrick.ru@hotmail.com 
# Date : 28-Aug-2010 

apt-get update -y 
apt-get upgrade -y 
apt-get install ssh patch -y 
apt-get install mysql-server -y 
apt-get install apache2 -y 
apt-get install php5 php5-gd php5-cli php5-mysql php5-snmp -y 
apt-get install rrdtool -y 
apt-get install snmp -y 
apt-get install php5-ldap -y 
cd /tmp
wget http://www.cacti.net/downloads/cacti-0.8.7g.tar.gz
wget http://www.cacti.net/downloads/pia/cacti-plugin-0.8.7g-PA-v2.8.tar.gz
wget http://www.cacti.net/downloads/patches/0.8.7g/data_source_deactivate.patch
wget http://www.cacti.net/downloads/patches/0.8.7g/graph_list_view.patch
wget http://www.cacti.net/downloads/patches/0.8.7g/ldap_group_authenication.patch
wget http://www.cacti.net/downloads/patches/0.8.7g/script_server_command_line_parse.patch
wget http://forums.cacti.net/download.php?id=21602 -O html_output.patch
tar zxvf cacti-0.8.7g.tar.gz 
tar zxvf cacti-plugin-0.8.7g-PA-v2.8.tar.gz 
mv cacti-0.8.7g/* /var/www/ 
cd /var/www/ 
patch -p1 -N < /tmp/cacti-plugin-arch/cacti-plugin-0.8.7g-PA-v2.8.diff 
patch -p1 -N < /tmp/data_source_deactivate.patch 
patch -p1 -N < /tmp/graph_list_view.patch 
patch -p1 -N < /tmp/html_output.patch 
patch -p1 -N < /tmp/ldap_group_authenication.patch 
patch -p1 -N < /tmp/script_server_command_line_parse.patch 
mysql -u root -pdbadmin -e 'CREATE DATABASE `cacti` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;' 
mysql -u root -pdbadmin -e "CREATE USER 'cactiuser'@'localhost' IDENTIFIED BY 'cactiuser';" 
mysql -u root -pdbadmin -e 'GRANT ALL PRIVILEGES ON `cacti` . * TO 'cactiuser'@'localhost';' 
mysql -u cactiuser -pcactiuser cacti < /var/www/cacti.sql 
mysql -u cactiuser -pcactiuser cacti < /tmp/cacti-plugin-arch/pa.sql 
chown -R www-data:www-data /var/www 
mv /var/www/index.html /var/www/index.bak 
/etc/init.d/apache2 restart 
touch /etc/cron.d/cacti 
echo "*/5 * * * * www-data php /var/www/poller.php >/dev/null 2>&1" > /etc/cron.d/cacti
Attachments
html_output.txt
(7.22 KiB) Downloaded 245 times
nationals
Cacti User
Posts: 76
Joined: Wed Aug 27, 2008 5:21 am
Location: China
Contact:

image file fault with pa diff

Post by nationals »

after modify the cacti-plugin-0.8.7g-PA-v2.8.diff, the image will be with err.

testing.

pls don't use the file cacti-plugin-0.8.7g-PA-v2.8.txt

log:

modify the cacti-plugin-0.8.7g-PA-v2.8.diff in window with ultraEdit32, the image file will be corrupt.

modify the cacti-plugin-0.8.7g-PA-v2.8.diff in linux with vi, the image will be ok, but can not pach the file data_sources.php.

why?

Fixed! and update 1 floor.

:)
Attachments
data_sources.php.rej.txt
(1.52 KiB) Downloaded 183 times
nationals
Cacti User
Posts: 76
Joined: Wed Aug 27, 2008 5:21 am
Location: China
Contact:

install plugins

Post by nationals »

It is in testing!

Code: Select all

#install plugins for 0.8.7g on debian linux
# Make by Patrick.Ru @ China
# E-Mail : patrick.ru@hotmail.com
# Date : 29-Aug-2010
cd /tmp
# install settings
wget http://docs.cacti.net/_media/plugin:settings-v0.7-1.tgz -O settings.tgz
tar zxvf settings*.tgz -C /var/www/plugins
# install clog
wget http://docs.cacti.net/_media/plugin:clog-v1.5-1.tgz -O clog.tgz 
tar zxvf clog*.tgz -C /var/www/plugins 
# install monitor
wget http://docs.cacti.net/_media/plugin:monitor-v1.2-1.tgz -O monitor.tgz
tar zxvf monitor*.tgz -C /var/www/plugins 
# install realtime
wget http://docs.cacti.net/_media/plugin:realtime-v0.42-1.tgz -O realtime.tgz
tar zxvf realtime*.tgz -C /var/www/plugins
mkdir /var/www/plugins/realtime/cache
# install thold
wget http://docs.cacti.net/_media/plugin:thold-latest.tgz -O thold.tgz 
tar zxvf thold*.tgz -C /var/www/plugins 
mv -f /var/www/plugins/thold* /var/www/plugins/thold
# install ntop
wget http://docs.cacti.net/_media/plugin:ntop-v0.2-1.tgz -O ntop.tgz 
tar zxvf ntop*.tgz -C /var/www/plugins
# install boost
wget http://docs.cacti.net/_media/plugin:boost-v4.2-1.tgz -O boost.tgz
tar zxvf boost*.tgz -C /var/www/plugins
# install discovery
wget http://docs.cacti.net/_media/plugin:discovery-v1.1-1.tgz -O discovery.tgz
tar zxvf discovery*.tgz -C /var/www/plugins
# install weathermap
wget http://www.network-weathermap.com/files/php-weathermap-0.97a.zip
unzip php-weathermap-0.97a.zip -d /var/www/plugins/
# install flowview
wget http://docs.cacti.net/_media/plugin:flowview-latest.tgz -O flowview.tgz
tar zxvf flowview*.tgz -C /var/www/plugins
mv -f /var/www/plugins/flowview* /var/www/plugins/flowview
# install mactrack
wget http://docs.cacti.net/_media/plugin:mactrack-v2.9-1.tgz -O mactrack.tgz
tar zxvf mactrack*.tgz -C /var/www/plugins 
# install routerconfigs
wget http://docs.cacti.net/_media/plugin:routerconfigs-v0.3-1.tgz -O routerconfigs.tgz 
tar zxvf routerconfigs*.tgz -C /var/www/plugins 
# install syslog
wget http://docs.cacti.net/_media/plugin:syslog-v1.05-1.tgz -O syslog.tgz
tar zxvf syslog*.tgz -C /var/www/plugins
# install aggregate
wget http://docs.cacti.net/_media/plugin:aggregate-070b2.tgz -O aggregate.tgz
tar zxvf aggregate*.tgz -C /var/www/plugins
mv -f /var/www/plugins/aggregate* /var/www/plugins/aggregate
# install loginmod
wget http://docs.cacti.net/_media/plugin:loginmod-latest.tgz -O loginmod.tgz
tar zxvf loginmod*.tgz -C /var/www/plugins
mv -f /var/www/plugins/loginmod* /var/www/plugins/loginmod
# install docs
wget http://docs.cacti.net/_media/plugin:docs_v0.2.tar.gz -O docs.tar.gz
tar zxvf docs*.tar.gz -C /var/www/plugins 
mv -f /var/www/plugins/docs* /var/www/plugins/docs
# install ReportIt
wget http://downloads.sourceforge.net/project/cacti-reportit/cacti-reportit/reportit_v072/reportit_0.7.2.tar.gz
tar zxvf reportit*.tar.gz -C /var/www/plugins 
# install mobile
wget http://docs.cacti.net/_media/plugin:mobile-latest.tgz -O mobile.tgz
tar zxvf mobile*.tgz -C /var/www/plugins 
mv -f /var/www/plugins/mobile* /var/www/plugins/mobile
# install rrdclean
wget http://docs.cacti.net/_media/plugin:rrdclean-v0.40.tgz -O rrdclean.tgz 
tar zxvf rrdclean*.tgz -C /var/www/plugins
# install tools
wget http://cactiusers.org/downloads/tools.tar.gz 
tar zxvf tools*.tar.gz -C /var/www/plugins
# install ssl
wget http://cactiusers.org/downloads/ssl.tar.gz
tar zxvf ssl*.tar.gz -C /var/www/plugins
# setting the plugins files's permission
chown -R www-data:www-data /var/www/plugins/
Last edited by nationals on Sat Aug 28, 2010 11:12 pm, edited 1 time in total.
nationals
Cacti User
Posts: 76
Joined: Wed Aug 27, 2008 5:21 am
Location: China
Contact:

patch for thold

Post by nationals »

Code: Select all

wget http://forums.cacti.net/download.php?id=21611 -O /tmp/html_utility.php.diff
patch -p1 -N --dry-run < /tmp/html_utility.php.diff

Code: Select all

patch -p1 -N < /tmp/html_utility.php.diff
html_utility.php.diff

Code: Select all

diff -Naur cacti-0.8.7g-old/lib/html_utility.php cacti-0.8.7g/lib/html_utility.php
--- cacti-0.8.7g-old/lib/html_utility.php	2010-07-10 06:33:46.000000000 +0800
+++ cacti-0.8.7g/lib/html_utility.php	2010-08-29 10:07:58.000000000 +0800
@@ -307,7 +307,11 @@
 function get_page_list($current_page, $pages_per_screen, $rows_per_page, $total_rows, $url, $page_var = "page") {
 	$url_page_select = "";
 
-	$total_pages = ceil($total_rows / $rows_per_page);
+  if ($total_rows < 1) {
+    $total_pages = 1;
+  }else{
+    $total_pages = ceil($total_rows / $rows_per_page);
+  }
 
 	$start_page = max(1, ($current_page - floor(($pages_per_screen - 1) / 2)));
 	$end_page = min($total_pages, ($current_page + floor(($pages_per_screen - 1) / 2)));
[/code]
Attachments
html_utility.php.diff.txt
(738 Bytes) Downloaded 316 times
Last edited by nationals on Sat Aug 28, 2010 11:15 pm, edited 2 times in total.
nationals
Cacti User
Posts: 76
Joined: Wed Aug 27, 2008 5:21 am
Location: China
Contact:

hdd used percent for thold

Post by nationals »

Code: Select all

wget http://forums.cacti.net/download.php?id=21610 -O /tmp/global_arrays.php.diff
patch -p1 -N < /tmp/global_arrays.php.diff

Code: Select all

Item #1  Special Data Source: CURRENT_DATA_SOURCE       
Item #2  Custom String: 100       
Item #3  Operator: *       
Item #4  Special Data Source: VALUE_OF_HDD_TOTAL       
Item #5  Operator: /  
Attachments
global_arrays.php.diff.txt
(803 Bytes) Downloaded 425 times
danslarge
Posts: 2
Joined: Thu Dec 09, 2010 7:06 pm

Re: Installation 0.8.7g on debian

Post by danslarge »

This line in the script isn't working for me; getting 404 Not Found error. Something I'm missing?

wget http://forums.cacti.net/download.php?id=21605 -O cacti-plugin-0.8.7g-PA-v2.8.diff
nationals
Cacti User
Posts: 76
Joined: Wed Aug 27, 2008 5:21 am
Location: China
Contact:

Re: Installation 0.8.7g on debian

Post by nationals »

Code: Select all

#!/bin/sh

# install cacti 0.8.7g on debian linux
# Make by Patrick.Ru @ China
# E-Mail : patrick.ru@hotmail.com
# Date : 25-Jun-2011

# Update system
apt-get update -y
if [ $? = 0 ]; then 
	echo $(date) --\> Updated System. >> /var/log/cacti_install.log
else
	echo $(date) --\> Update System fault. >> /var/log/cacti_install.log
	exit
fi
apt-get upgrade -y
if [ $? = 0 ]; then 
	echo $(date) --\> Upgraded System. >> /var/log/cacti_install.log
else
	echo $(date) --\> Upgrade System fault. >> /var/log/cacti_install.log
	exit
fi
apt-get install ssh patch -y
if [ $? = 0 ]; then 
	echo $(date) --\> Installed ssh and patch. >> /var/log/cacti_install.log
else
	echo $(date) --\> Install ssh and patch fault. >> /var/log/cacti_install.log
	exit
fi

# install mysql-server
echo "mysql-server mysql-server/root_password select dbadmin" | debconf-set-selections
echo "mysql-server mysql-server/root_password_again select dbadmin" | debconf-set-selections
apt-get install mysql-server -y
if [ $? = 0 ]; then 
	echo $(date) --\> Installed mysql-server. >> /var/log/cacti_install.log
else
	echo $(date) --\> Install mysql-server fault. >> /var/log/cacti_install.log
	exit
fi

# install apache2
apt-get install apache2 -y
if [ $? = 0 ]; then 
	echo $(date) --\> Installed apachec2. >> /var/log/cacti_install.log
else
	echo $(date) --\> Install apachec2 fault. >> /var/log/cacti_install.log
	exit
fi

# install php5
apt-get install php5 php5-gd php5-cli php5-mysql php5-snmp php5-ldap -y
if [ $? = 0 ]; then 
	echo $(date) --\> Installed php5. >> /var/log/cacti_install.log
else
	echo $(date) --\> Install php5 fault. >> /var/log/cacti_install.log
	exit
fi

# install rrdtool
apt-get install rrdtool -y
if [ $? = 0 ]; then 
	echo $(date) --\> Installed rrdtool. >> /var/log/cacti_install.log
else
	echo $(date) --\> Install rrdtool fault. >> /var/log/cacti_install.log
	exit
fi

# install snmp
apt-get install snmp -y
if [ $? = 0 ]; then 
	echo $(date) --\> Installed snmp. >> /var/log/cacti_install.log
else
	echo $(date) --\> Install snmp fault. >> /var/log/cacti_install.log
	exit
fi

# download cacit 0.8.7g and patch
if [ -d  /usr/src/cacti ]; then 
	echo $(date) --\> Folder: /usr/src/cacti is exist. >> /var/log/cacti_install.log
else
	mkdir /usr/src/cacti
	echo $(date) --\> Create folder: /usr/src/cacti. >> /var/log/cacti_install.log
fi

cd /usr/src/cacti
if [ ! -f ./cacti-0.8.7g.tar.gz ];  then
	wget http://www.cacti.net/downloads/cacti-0.8.7g.tar.gz
	if [ $? = 0 ]; then 
		echo $(date) --\> Downloaded cacti-0.8.7g.tar.gz! >> /var/log/cacti_install.log
	else
		rm -f cacti-0.8.7g.tar.gz
		echo $(date) --\> Download cacti-0.8.7g.tar.gz fault! >> /var/log/cacti_install.log
		exit
	fi
else 
  echo $(date) --\> cacti-0.8.7g.tar.gz is exist! >> /var/log/cacti_install.log
fi
if [ ! -f ./cacti-plugin-0.8.7g-PA-v2.9.tar.gz ];  then
	wget http://www.cacti.net/downloads/pia/cacti-plugin-0.8.7g-PA-v2.9.tar.gz
	if [ $? = 0 ]; then
		echo $(date) --\> Downloaded cacti-plugin-0.8.7g-PA-v2.9.tar.gz! >> /var/log/cacti_install.log
	else
		rm -f cacti-plugin-0.8.7g-PA-v2.9.tar.gz
		echo $(date) --\> Download cacti-plugin-0.8.7g-PA-v2.9.tar.gz fault! >> /var/log/cacti_install.log
		exit
	fi
else 
	echo $(date) --\> cacti-plugin-0.8.7g-PA-v2.9.tar.gz is exist! >> /var/log/cacti_install.log
fi
if [ ! -f ./data_source_deactivate.patch ];  then
	wget http://www.cacti.net/downloads/patches/0.8.7g/data_source_deactivate.patch
	if [ $? = 0 ]; then
		echo $(date) --\> Downloaded data_source_deactivate.patch! >> /var/log/cacti_install.log
	else
		rm -f data_source_deactivate.patch
		echo $(date) --\> Download data_source_deactivate.patch fault! >> /var/log/cacti_install.log
		exit
	fi
else 
	echo $(date) --\> data_source_deactivate.patch is exist! >> /var/log/cacti_install.log
fi
if [ ! -f ./graph_list_view.patch ];  then
	wget http://www.cacti.net/downloads/patches/0.8.7g/graph_list_view.patch
	if [ $? = 0 ]; then
		echo $(date) --\> Downloaded graph_list_view.patch! >> /var/log/cacti_install.log
	else
		rm -f graph_list_view.patch
		echo $(date) --\> Download graph_list_view.patch fault! >> /var/log/cacti_install.log
		exit
	fi
else
	echo $(date) --\> graph_list_view.patch is exist! >> /var/log/cacti_install.log
fi
if [ ! -f ./html_output.patch ];  then  
	wget http://www.cacti.net/downloads/patches/0.8.7g/html_output.patch
	if [ $? = 0 ]; then
		echo $(date) --\> Downloaded html_output.patch! >> /var/log/cacti_install.log
	else
		rm -f html_output.patch
		echo $(date) --\> Download html_output.patch fault! >> /var/log/cacti_install.log
		exit
	fi
else
	echo $(date) --\> html_output.patch is exist! >> /var/log/cacti_install.log
fi
if [ ! -f ./ldap_group_authenication.patch ];  then  
	wget http://www.cacti.net/downloads/patches/0.8.7g/ldap_group_authenication.patch
	if [ $? = 0 ]; then
		echo $(date) --\> Downloaded ldap_group_authenication.patch! >> /var/log/cacti_install.log
	else
		rm -f ldap_group_authenication.patch
		echo $(date) --\> Download ldap_group_authenication.patch fault! >> /var/log/cacti_install.log
		exit
	fi
else
	echo $(date) --\> ldap_group_authenication.patch is exist! >> /var/log/cacti_install.log
fi
if [ ! -f ./script_server_command_line_parse.patch ];  then
	wget http://www.cacti.net/downloads/patches/0.8.7g/script_server_command_line_parse.patch
	if [ $? = 0 ]; then
		echo $(date) --\> Downloaded script_server_command_line_parse.patch! >> /var/log/cacti_install.log
	else
		rm -f script_server_command_line_parse.patch
		echo $(date) --\> Download script_server_command_line_parse.patch fault! >> /var/log/cacti_install.log
		exit
	fi
else
	echo $(date) --\> script_server_command_line_parse.patch is exist! >> /var/log/cacti_install.log
fi
if [ ! -f ./ping.patch ];  then
	wget -N http://www.cacti.net/downloads/patches/0.8.7g/ping.patch
	if [ $? = 0 ]; then
		echo $(date) --\> Downloaded ping.patch! >> /var/log/cacti_install.log
	else
		rm -f ping.patch
		echo $(date) --\> Download ping.patch fault! >> /var/log/cacti_install.log
		exit
	fi
else
	echo $(date) --\> ping.patch is exist! >> /var/log/cacti_install.log
fi
if [ ! -f ./poller_interval.patch ];  then
	wget -N http://www.cacti.net/downloads/patches/0.8.7g/poller_interval.patch
	if [ $? = 0 ]; then
		echo $(date) --\> Downloaded poller_interval.patch! >> /var/log/cacti_install.log
	else
		rm -f poller_interval.patch
		echo $(date) --\> Download poller_interval.patch fault! >> /var/log/cacti_install.log
		exit
	fi
else
	echo $(date) --\> poller_interval.patch is exist! >> /var/log/cacti_install.log
fi

# Extract and patch cacti-0.8.7g
tar zxvf cacti-0.8.7g.tar.gz
if [ $? = 0 ]; then
	echo $(date) --\> Extracted cacti-0.8.7g.tar.gz! >> /var/log/cacti_install.log
else
	rm -rf cacti-0.8.7g
	echo $(date) --\> Extract cacti-0.8.7g.tar.gz fault! >> /var/log/cacti_install.log
	exit
fi	
tar zxvf cacti-plugin-0.8.7g-PA-v2.9.tar.gz
if [ $? = 0 ]; then
	echo $(date) --\> Extracted cacti-plugin-0.8.7g-PA-v2.9.tar.gz! >> /var/log/cacti_install.log
else
	rm -rf cacti-plugin-arch
	echo $(date) --\> Extract cacti-plugin-0.8.7g-PA-v2.9.tar.gz fault! >> /var/log/cacti_install.log
	exit
fi

mv cacti-0.8.7g/* /var/www/
rm -rf cacti-0.8.7g
cd /var/www/

patch -p1 -N < /usr/src/cacti/data_source_deactivate.patch
if [ $? = 0 ]; then
	echo $(date) --\> patched file data_source_deactivate.patch! >> /var/log/cacti_install.log
else
	echo $(date) --\> patch file data_source_deactivate.patch fault! >> /var/log/cacti_install.log
	exit
fi
patch -p1 -N < /usr/src/cacti/graph_list_view.patch
if [ $? = 0 ]; then
	echo $(date) --\> patched file graph_list_view.patch! >> /var/log/cacti_install.log
else
	echo $(date) --\> patch file graph_list_view.patch fault! >> /var/log/cacti_install.log
	exit
fi
patch -p1 -N < /usr/src/cacti/html_output.patch
if [ $? = 0 ]; then
	echo $(date) --\> patched file html_output.patch! >> /var/log/cacti_install.log
else
	echo $(date) --\> patch file html_output.patch fault! >> /var/log/cacti_install.log
	exit
fi
patch -p1 -N < /usr/src/cacti/ldap_group_authenication.patch
if [ $? = 0 ]; then
	echo $(date) --\> patched file ldap_group_authenication.patch! >> /var/log/cacti_install.log
else
	echo $(date) --\> patch file ldap_group_authenication.patch fault! >> /var/log/cacti_install.log
	exit
fi
patch -p1 -N < /usr/src/cacti/script_server_command_line_parse.patch
if [ $? = 0 ]; then
	echo $(date) --\> patched file script_server_command_line_parse.patch! >> /var/log/cacti_install.log
else
	echo $(date) --\> patch file script_server_command_line_parse.patch fault! >> /var/log/cacti_install.log
	exit
fi
patch -p1 -N < /usr/src/cacti/ping.patch
if [ $? = 0 ]; then
	echo $(date) --\> patched file ping.patch! >> /var/log/cacti_install.log
else
	echo $(date) --\> patch file ping.patch fault! >> /var/log/cacti_install.log
	exit
fi
patch -p1 -N < /usr/src/cacti/poller_interval.patch
if [ $? = 0 ]; then
	echo $(date) --\> patched file poller_interval.patch! >> /var/log/cacti_install.log
else
	echo $(date) --\> patch file poller_interval.patch fault! >> /var/log/cacti_install.log
	exit
fi

# Patch PA v.29 for cacti-0.8.7g
patch -p1 -N --dry-run < /usr/src/cacti/cacti-plugin-arch/cacti-plugin-0.8.7g-PA-v2.9.diff
if [ $? = 0 ]; then
	patch -p1 -N < /usr/src/cacti/cacti-plugin-arch/cacti-plugin-0.8.7g-PA-v2.9.diff
	if [ $? = 0 ]; then
		echo $(date) --\> patched file cacti-plugin-0.8.7g-PA-v2.9.diff! >> /var/log/cacti_install.log
	else
		echo $(date) --\> patch file cacti-plugin-0.8.7g-PA-v2.9.diff fault! >> /var/log/cacti_install.log
		exit
	fi
else
	echo $(date) --\> pre-patch file cacti-plugin-0.8.7g-PA-v2.9.diff fault! >> /var/log/cacti_install.log
	exit
fi

# Create database for cacti
mysql -u root -pdbadmin -e 'CREATE DATABASE `cacti` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;'
if [ $? = 0 ]; then
	echo $(date) --\> Created database cacti! >> /var/log/cacti_install.log
else
	echo $(date) --\> Create database cacti fault! >> /var/log/cacti_install.log
	exit
fi
mysql -u root -pdbadmin -e "CREATE USER 'cactiuser'@'localhost' IDENTIFIED BY 'cactiuser';"
if [ $? = 0 ]; then
	echo $(date) --\> Created database user cactiuser! >> /var/log/cacti_install.log
else
	echo $(date) --\> Create database user cactiuser fault! >> /var/log/cacti_install.log
	exit
fi
mysql -u root -pdbadmin -e 'GRANT ALL PRIVILEGES ON `cacti` . * TO 'cactiuser'@'localhost';'
if [ $? = 0 ]; then
	echo $(date) --\> Granted database permission! >> /var/log/cacti_install.log
else
	echo $(date) --\> Grant database permission fault! >> /var/log/cacti_install.log
	exit
fi

# import cacti database
mysql -u cactiuser -pcactiuser cacti < /var/www/cacti.sql
if [ $? = 0 ]; then
	echo $(date) --\> Imported cacti.sql! >> /var/log/cacti_install.log
else
	echo $(date) --\> Import cacti.sql fault! >> /var/log/cacti_install.log
	exit
fi

# import PLA database
mysql -u cactiuser -pcactiuser cacti < /usr/src/cacti/cacti-plugin-arch/pa.sql
if [ $? = 0 ]; then
	echo $(date) --\> Imported pa.sql! >> /var/log/cacti_install.log
else
	echo $(date) --\> Import pa.sql fault! >> /var/log/cacti_install.log
	exit
fi

# Setting permission
chown -R www-data:www-data /var/www
mv /var/www/index.html /var/www/index.bak
/etc/init.d/apache2 restart

# Create crond job for cacti
if [ ! -f /etc/cron.d/cacti ]; then
	touch /etc/cron.d/cacti
	echo "*/5 * * * * www-data php /var/www/poller.php >/dev/null 2>&1" > /etc/cron.d/cacti
	echo $(date) --\> Create cron for cacti! >> /var/log/cacti_install.log
else
	echo $(date) --\> /etc/cron.d/cacti is exist! no update! >> /var/log/cacti_install.log
fi
	
# install compile tools for compiling spine
apt-get install gcc g++ autoconf automake make patch -y
aptitude install libtool -y
apt-get install mysql-server -y
apt-get install libmysqlclient15-dev -y
apt-get install libssl-dev -y
apt-get install libsnmp-dev -y
apt-get install build-essential -y
echo $(date) --\> Installed build-essential tools! >> /var/log/cacti_install.log

# download spine and patch
cd /usr/src/cacti
if [ ! -f ./cacti-spine-0.8.7g.tar.gz ];  then
	wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.7g.tar.gz
	if [ $? = 0 ]; then
		echo $(date) --\> Downloaded cacti-spine-0.8.7g.tar.gz! >> /var/log/cacti_install.log
	else
		rm -f cacti-spine-0.8.7g.tar.gz
		echo $(date) --\> Download cacti-spine-0.8.7g.tar.gz fault! >> /var/log/cacti_install.log
		exit
	fi
else
	echo $(date) --\> cacti-spine-0.8.7g.tar.gz is exist! >> /var/log/cacti_install.log
fi
if [ ! -f ./unified_issues.patch ];  then
  wget http://www.cacti.net/downloads/spine/patches/0.8.7g/unified_issues.patch
	if [ $? = 0 ]; then
		echo $(date) --\> Downloaded unified_issues.patch! >> /var/log/cacti_install.log
	else
		rm -f unified_issues.patch
		echo $(date) --\> Download unified_issues.patch fault! >> /var/log/cacti_install.log
		exit
	fi
else
	echo $(date) --\> unified_issues.patch is exist! >> /var/log/cacti_install.log
fi
tar zxvf cacti-spine-0.8.7g.tar.gz
if [ $? = 0 ]; then
	echo $(date) --\> Extracted cacti-spine-0.8.7g.tar.gz! >> /var/log/cacti_install.log
else
	rm -rf cacti-spine-0.8.7g
	echo $(date) --\> Extract cacti-spine-0.8.7g.tar.gz fault! >> /var/log/cacti_install.log
	exit
fi	

# Extract and patch spine-0.8.7g 
cd cacti-spine-0.8.7g
patch -p1 -N < /usr/src/cacti/unified_issues.patch
if [ $? = 0 ]; then
	echo $(date) --\> patched file unified_issues.patch! >> /var/log/cacti_install.log
else
	echo $(date) --\> patch file unified_issues.patch fault! >> /var/log/cacti_install.log
	exit
fi

# compiling and install 
aclocal 
libtoolize --force 
autoconf 
autoheader 
automake 
./configure
if [ $? = 0 ]; then
	echo $(date) --\> Configured spine! >> /var/log/cacti_install.log
else
	echo $(date) --\> Configure spine fault! >> /var/log/cacti_install.log
	exit
fi
make
if [ $? = 0 ]; then
	echo $(date) --\> Maked spine! >> /var/log/cacti_install.log
else
	echo $(date) --\> Make spine fault! >> /var/log/cacti_install.log
	exit
fi
make install
if [ $? = 0 ]; then
	echo $(date) --\> Installed spine! >> /var/log/cacti_install.log
else
	echo $(date) --\> Install spine fault! >> /var/log/cacti_install.log
	exit
fi
cp /usr/local/spine/etc/spine.conf.dist  /usr/local/spine/etc/spine.conf
echo $(date) --\> Created spine.conf! >> /var/log/cacti_install.log

# install plugins for cacti 0.8.7g
cd /tmp
# install settings v0.7-1
wget http://docs.cacti.net/_media/plugin:settings-v0.7-1.tgz -O settings.tgz
tar zxvf settings*.tgz -C /var/www/plugins
# install clog v1.6-1
wget http://docs.cacti.net/_media/plugin:clog-v1.6-1.tgz -O clog.tgz 
tar zxvf clog*.tgz -C /var/www/plugins 
# install monitor v1.2-1
wget http://docs.cacti.net/_media/plugin:monitor-v1.2-1.tgz -O monitor.tgz
tar zxvf monitor*.tgz -C /var/www/plugins 
# install realtime v0.43-1
wget http://docs.cacti.net/_media/plugin:realtime-v0.43-1.tgz -O realtime.tgz
tar zxvf realtime*.tgz -C /var/www/plugins
mkdir /var/www/plugins/realtime/cache
# install cycle v1.2-1
wget http://docs.cacti.net/_media/plugin:cycle-v1.2-1.tgz -O cycle.tgz
tar zxvf cycle*.tgz -C /var/www/plugins
# install thold v0.43
wget http://cactiusers.org/downloads/thold.tar.gz 
tar zxvf thold*.tar.gz -C /var/www/plugins 
mv -f /var/www/plugins/thold* /var/www/plugins/thold
# install ntop v0.2-1
apt-get install ntop -y
if [ $? = 0 ]; then
	ntop --set-admin-password=ntopadmin
	/etc/init.d/ntop start
	wget http://docs.cacti.net/_media/plugin:ntop-v0.2-1.tgz -O ntop.tgz 
	tar zxvf ntop*.tgz -C /var/www/plugins
fi
# install boost v4.3-1
wget http://docs.cacti.net/_media/plugin:boost-v4.3-1.tgz -O boost.tgz
tar zxvf boost*.tgz -C /var/www/plugins
# install discovery v1.1-1
wget http://docs.cacti.net/_media/plugin:discovery-v1.1-1.tgz -O discovery.tgz
tar zxvf discovery*.tgz -C /var/www/plugins
# install weathermap v0.97a
apt-get install -y unzip
wget http://www.network-weathermap.com/files/php-weathermap-0.97a.zip
unzip php-weathermap-0.97a.zip -d /var/www/plugins/
# install flowview v0.6
wget http://docs.cacti.net/_media/plugin:flowview-latest.tgz -O flowview.tgz
tar zxvf flowview*.tgz -C /var/www/plugins
mv -f /var/www/plugins/flowview* /var/www/plugins/flowview
# install mactrack v2.9-1
wget http://docs.cacti.net/_media/plugin:mactrack-v2.9-1.tgz -O mactrack.tgz
tar zxvf mactrack*.tgz -C /var/www/plugins 
# install routerconfigs v0.3-1
wget http://docs.cacti.net/_media/plugin:routerconfigs-v0.3-1.tgz -O routerconfigs.tgz 
tar zxvf routerconfigs*.tgz -C /var/www/plugins 
mkdir /var/www/plugins/routerconfigs/backups
# install syslog v1.21-1
wget http://docs.cacti.net/_media/plugin:syslog-v1.21-1.tgz -O syslog.tgz
tar zxvf syslog*.tgz -C /var/www/plugins
# install aggregate v0.75
wget http://docs.cacti.net/_media/plugin:aggregate-v0.75.tgz -O aggregate.tgz
tar zxvf aggregate*.tgz -C /var/www/plugins
mv -f /var/www/plugins/aggregate* /var/www/plugins/aggregate
# install loginmod v1.0
wget http://docs.cacti.net/_media/plugin:loginmod-latest.tgz -O loginmod.tgz
tar zxvf loginmod*.tgz -C /var/www/plugins
mv -f /var/www/plugins/loginmod* /var/www/plugins/loginmod
# install docs v0.2
wget http://docs.cacti.net/_media/plugin:docs_v0.2.tar.gz -O docs.tar.gz
tar zxvf docs*.tar.gz -C /var/www/plugins 
mv -f /var/www/plugins/docs* /var/www/plugins/docs
# install ReportIt v0.73
wget http://nchc.dl.sourceforge.net/project/cacti-reportit/cacti-reportit/reportit_v073/reportit_v073.tar.gz -O reportit.tar.gz
tar zxvf reportit*.tar.gz -C /var/www/plugins 
# install mobile v0.1
wget http://docs.cacti.net/_media/plugin:mobile-latest.tgz -O mobile.tgz
tar zxvf mobile*.tgz -C /var/www/plugins 
mv -f /var/www/plugins/mobile* /var/www/plugins/mobile
# install rrdclean v0.41
wget http://docs.cacti.net/_media/plugin:rrdclean-v0.41.tgz -O rrdclean.tgz 
tar zxvf rrdclean*.tgz -C /var/www/plugins
mkdir -p /var/www/rra/backup
mkdir -p /var/www/rra/archive
# install tools v0.3
wget http://cactiusers.org/downloads/tools.tar.gz 
tar zxvf tools*.tar.gz -C /var/www/plugins
# install ssl v0.1
wget http://cactiusers.org/downloads/ssl.tar.gz
tar zxvf ssl*.tar.gz -C /var/www/plugins
# install domains v0.1-1
wget http://docs.cacti.net/_media/plugin:domains-v0.1-1.tgz -O domains.tgz
tar zxvf domains*.tgz -C /var/www/plugins
# setting the plugins files's permission
chown -R www-data:www-data /var/www/plugins/

echo $(date) --\> All install finised! >> /var/log/cacti_install.log
Attachments
cacti-pa-spine@debian.sh
(17.56 KiB) Downloaded 206 times
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests