Instalação do Cacti v0.8.7g + Plugins

Publicado por Alan Cleber Pereira Martines (última atualização em 21/02/2014)

[ Hits: 9.363 ]

Download install_cacti_v0.8.7g.sh

Download 1392942798.install_cacti_v0.8.7g.sh (versão 2)




Fonte: http://forums.cacti.net/viewtopic.php?t=38633

Itens:

- Cacti 0.8.7g + latest patches
- Spine0.8.7g + unified patch
- PA
- Settings plugin
- Cycle plugin
- Realtime plugin
- LoginMod plugin
- Monitor plugin
- Nectar plugin
- SpikeKill plugin
- Thold plugin
- NetworkWeathermap plugin
- Clog plugin

Obs.: meus conhecimentos em shell script são bem básicos, se alguém puder aperfeiçoar o código agradeço.

  



Versões atualizadas deste script

Versão 2 - Enviado por Alan Cleber Pereira Martines em 20/02/2014

Changelog: #!/bin/bash
#
## Fonte
## http://infog.casoft.info/2011/05/shell-script-parte-2-controle-de-fluxo/
#
PROGRAMA1=$(dpkg --get-selections | grep apache2 | wc -l)
PROGRAMA2=$(dpkg --get-selections | grep php5 | wc -l)
PROGRAMA3=$(dpkg --get-selections | grep mysql-server | wc -l)

if [ $PROGRAMA1 -ne 0 ] && [ $PROGRAMA2 -ne 0 ] && [ $PROGRAMA3 -ne 0 ]
then
echo ""
#
PROGRAMA=$(dpkg --get-selections | grep dialog | wc -l)
#PROGRAMA=$(which acroread | wc -l)
if [ $PROGRAMA -eq 0 ]
then
sudo apt-get -y --force-yes -f install dialog
else
echo ""
echo "DIALOG - Ja esta instalado!"
echo ""
fi
#
rm -fr /var/www/cacti
#
################################################################################
#
CactiVersion="0.8.7g" # Cacti version to be installed
PAVersion="2.9" # Plugin architecture version to be installed
SpineVersion="0.8.7g" # Spine version to be installed
SpinePatchVersion="0.8.7g" # Spine Patch version to be installed
SettingsVersion="0.71-1" # Settings plugin version to be installed
CycleVersion="2.3-1" # Cycle plugin version to be installed
RealTimeVersion="0.5-2" # RealTime plugin version to be installed
LoginModVersion="1.0" # LoginMod plugin version to be installed
MonitorVersion="1.3-1" # Monitor plugin version to be installed
NectarVersion="0.35a" # Nectar plugin version to be installed
SpikeKillVersion="1.3-2" # SpikeKill plugin version to be installed
TholdVersion="0.4.9-3" # Thold (Threshold) plugin version to be installed
WeatherMapVersion="0.97a" # PHP Network WeatherMap Plugin to be installed
ClogVersion="1.7-1" # Clog plugin version to be installed
lmSensorsVersion="0.9" # lmSensors/Net-SNMP Sensor Readings
CactilmSensorsVersion="0.8.7" # lmSensors Sensor Readings
#
################################################################################
#
MeuIP=$(LANG=C; ifconfig eth0|grep "inet addr"|cut -f2 -d:|cut -f1 -d" ")
#
MySQLCactiUser=$( dialog --stdout --inputbox 'MySQL - Usuario do banco de dados para o cacti:' 0 0 ) # MYSQL user for cacti database

MySQLCactiPwd=$( dialog --stdout --passwordbox 'MySQL - Senha do banco de dados para o cacti:' 0 0 ) # Password for the MYSQL user defined above

MySQLRootPwd=$( dialog --stdout --passwordbox 'MySQL - Senha para o usuario "root":' 0 0 ) # Password for MYSQL user "root"

SystemCactiUser=$( dialog --stdout --inputbox 'LINUX - Usuario executando cacti:' 0 0 ) # Linux user running cacti
#
clear
#
################################################################################
#
sudo apt-get -y --force-yes -f install lm-sensors
sudo apt-get -y --force-yes -f install hddtemp
sudo apt-get -y --force-yes -f install build-essential
sudo apt-get -y --force-yes -f install rcconf
sudo apt-get -y --force-yes -f install libncurses5-dev
sudo apt-get -y --force-yes -f install libgd2-xpm
sudo apt-get -y --force-yes -f install libxpm-dev
sudo apt-get -y --force-yes -f install libpng12-dev
sudo apt-get -y --force-yes -f install libgdbm-dev
sudo apt-get -y --force-yes -f install patch
sudo apt-get -y --force-yes -f install rrdtool
sudo apt-get -y --force-yes -f install snmp
sudo apt-get -y --force-yes -f install snmpd
sudo apt-get -y --force-yes -f install snmp-mibs-downloader
sudo apt-get -y --force-yes -f install libnet-snmp-perl libsnmp-base
sudo apt-get -y --force-yes -f install libgd2-xpm-dev libsnmp-perl libssl-dev openssl
sudo apt-get -y --force-yes -f install unzip
sudo apt-get -y --force-yes -f install unrar
#
################################################################################
#
## Cacti installation
#
#
sudo apt-get -y --force-yes -f install rrdtool snmp snmpd php5-snmp
cd /usr/src/
wget http://www.cacti.net/downloads/cacti-$CactiVersion.tar.gz
tar zxvf cacti-$CactiVersion.tar.gz
mv ./cacti-$CactiVersion/ /var/www/cacti/
yes | mysqladmin -u root -p$MySQLRootPwd drop cacti
mysqladmin -u root -p$MySQLRootPwd create cacti

sed -i 's/TYPE=MyISAM//' /var/www/cacti/cacti.sql

mysql -u $MySQLCactiUser -p$MySQLCactiPwd cacti < /var/www/cacti/cacti.sql

cd /var/www/cacti/include/
sed -i -e 's/username = "cactiuser"/username = "'$MySQLCactiUser'"/' config.php
sed -i -e 's/password = "cactiuser"/password = "'$MySQLCactiPwd'"/' config.php

sed -i -e 's/username = "cactiuser"/username = "'$MySQLCactiUser'"/' global.php
sed -i -e 's/password = "cactiuser"/password = "'$MySQLCactiPwd'"/' global.php

touch /etc/cron.d/cacti
echo "*/5 * * * * $SystemCactiUser php /var/www/cacti/poller.php >/dev/null 2>&1" >> /etc/cron.d/cacti
echo "*/5 * * * * $SystemCactiUser chmod -R 777 /var/www/cacti/" >> /etc/cron.d/cacti
rm -f /usr/src/cacti-$CactiVersion.tar.gz
cd
#
################################################################################
#
## Patching Cacti
#
#
sudo apt-get -y --force-yes -f install patch
cd /usr/src/
wget http://www.cacti.net/downloads/patches/$CactiVersion/data_source_deactivate.patch
wget http://www.cacti.net/downloads/patches/$CactiVersion/graph_list_view.patch
wget http://www.cacti.net/downloads/patches/$CactiVersion/html_output.patch
wget http://www.cacti.net/downloads/patches/$CactiVersion/ldap_group_authenication.patch
wget http://www.cacti.net/downloads/patches/$CactiVersion/script_server_command_line_parse.patch
wget http://www.cacti.net/downloads/patches/$CactiVersion/ping.patch
wget http://www.cacti.net/downloads/patches/$CactiVersion/poller_interval.patch
cd /var/www/cacti/
patch -b -p1 -N < /usr/src/data_source_deactivate.patch
patch -b -p1 -N < /usr/src/graph_list_view.patch
patch -b -p1 -N < /usr/src/html_output.patch
patch -b -p1 -N < /usr/src/ldap_group_authenication.patch
patch -b -p1 -N < /usr/src/script_server_command_line_parse.patch
patch -b -p1 -N < /usr/src/ping.patch
patch -b -p1 -N < /usr/src/poller_interval.patch
rm -f /usr/src/*.patch
cd
#
################################################################################
#
## Configure Snmpd in order to access the public MIB on localhost
#
Local=$( dialog --stdout --inputbox 'Snmpd Local Info:' 0 0 )
#
Email=$( dialog --stdout --inputbox 'Snmpd E-Mail Info:' 0 0 )
#
clear
#
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bkp
touch /etc/snmp/snmpd.conf

echo '
###############################################################################
#
# AGENT BEHAVIOUR
#
agentAddress udp:161,udp6:[::1]:161

###############################################################################
#
# ACCESS CONTROL
#

view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1

proxy -v 1 -c public localhost:3401 .1.3.6.1.4.1.3495.1
view system included .1.3.6.1.4.1.3495.1

rocommunity public localhost
rocommunity public '$MeuIP'

rocommunity public default -V systemonly
rocommunity public default

rouser authOnlyUser

#com2sec paranoid
com2sec readonly

###############################################################################
#
# SYSTEM INFORMATION
#

sysLocation '$Local'
sysContact '$Email'

sysServices 72

proc mountd

proc ntalkd 4

proc sendmail 10 1

disk / 10000
disk /var 5%
includeAllDisks 10%

load 12 10 5

###############################################################################
#
# ACTIVE MONITORING
#

trapsink localhost public
trapsink '$MeuIP' public

trap2sink localhost public
trap2sink '$MeuIP' public

iquerySecName internalUser
rouser internalUser

defaultMonitors yes

linkUpDownNotifications yes

###############################################################################
#
# EXTENDING THE AGENT
#

extend test1 /bin/echo Hello, world!
extend-sh test2 echo Hello, world! ; echo Hi there ; exit 35

###############################################################################
#
# EXTENDING THE AGENT SENSORS
#

extend sensortemps /etc/snmp/sensors-temps
extend sensorfans /etc/snmp/sensors-fans
extend sensorvoltages /etc/snmp/sensors-voltages

#
###############################################################################

master agentx
' >> /etc/snmp/snmpd.conf

/etc/init.d/snmpd restart
cd
#
################################################################################
#
## Cacti-Spine installation & patching
#
#
apt-get install -y libsnmp-dev libmysqlclient15-dev libssl-dev make
apt-get install -y patch
cd /usr/src/
wget http://www.cacti.net/downloads/spine/cacti-spine-$SpineVersion.tar.gz
wget http://www.cacti.net/downloads/spine/patches/$SpinePatchVersion/unified_issues.patch
tar zxvf cacti-spine-$SpineVersion.tar.gz
cd cacti-spine-$SpineVersion/
patch -p1 -N < /usr/src/unified_issues.patch
./configure
make
mkdir /usr/local/spine
mv ./spine /usr/local/spine/
mv ./spine.h /usr/local/spine/spine
mv ./spine.conf.dist /usr/local/spine/spine.conf
cd /usr/local/spine/
sed -i -e 's/DB_User cactiuser/DB_User '$MySQLCactiUser'/' spine.conf
sed -i -e 's/DB_Pass cactiuser/DB_Pass '$MySQLCactiPwd'/' spine.conf
rm -f /usr/src/cacti-spine-$SpineVersion.tar.gz
rm -rf /usr/src/cacti-spine-$SpineVersion/
rm -f /usr/src/unified_issues.patch
cd
#
################################################################################
#
## Plugin Architecture Installation
#
#
apt-get install -y patch
cd /usr/src/
wget http://www.cacti.net/downloads/pia/cacti-plugin-$CactiVersion-PA-v$PAVersion.tar.gz
tar zxvf cacti-plugin-$CactiVersion-PA-v$PAVersion.tar.gz
cd /var/www/cacti/
patch -b -p1 -N < /usr/src/cacti-plugin-arch/cacti-plugin-$CactiVersion-PA-v$PAVersion.diff

sed -i 's/TYPE=MyISAM//' /usr/src/cacti-plugin-arch/pa.sql

mysql -u $MySQLCactiUser -p$MySQLCactiPwd cacti < /usr/src/cacti-plugin-arch/pa.sql
cd /var/www/cacti/include/
sed -i -e 's/"\/"/"\/cacti\/"/' config.php
rm -f /usr/src/cacti-plugin-$CactiVersion-PA-v$PAVersion.tar.gz
rm -rf /usr/src/cacti-plugin-arch/
cd
#
################################################################################
#
## Settings plugin installation
#
#
cd /usr/src/
wget http://docs.cacti.net/_media/plugin:settings-v$SettingsVersion.tgz
mv plugin\:settings-v$SettingsVersion.tgz settings-v$SettingsVersion.tgz
tar zxvf ./settings-v$SettingsVersion.tgz
mv /usr/src/settings/ /var/www/cacti/plugins/
rm -f /usr/src/settings-v$SettingsVersion.tgz
cd
#
################################################################################
#
## Cycle plugin installation
#
#
cd /usr/src/
wget http://docs.cacti.net/_media/plugin:cycle-v$CycleVersion.tgz
mv plugin\:cycle-v$CycleVersion.tgz cycle-v$CycleVersion.tgz
tar zxvf ./cycle-v$CycleVersion.tgz
mv /usr/src/cycle /var/www/cacti/plugins/cycle/
rm -f /usr/src/cycle-v$CycleVersion.tgz
cd
#
################################################################################
#
## Realtime plugin installation
#
#
cd /usr/src/
wget http://docs.cacti.net/_media/plugin:realtime-v$RealTimeVersion.tgz
mv plugin:realtime-v$RealTimeVersion.tgz realtime-v$RealTimeVersion.tgz
tar zxvf ./realtime-v$RealTimeVersion.tgz
mv /usr/src/realtime/ /var/www/cacti/plugins/
mkdir /var/www/cacti/plugins/rt_cache/
mkdir /var/www/cacti/rcache
rm -f /usr/src/realtime-v$RealTimeVersion.tgz
cd
#
cd
touch rcache.sql
echo '
USE cacti;
insert into settings (name,value) values ('realtime_cache_path','/var/www/cacti/rcache');
insert into settings (name,value) values ('realtime_interval','5');
' >> rcache.sql
mysql -u root -p$MySQLRootPwd cacti < rcache.sql
rm -fr rcache.sql

mysql -u root -p$MySQLRootPwd cacti -s -e "insert into settings (name,value) values ('realtime_cache_path','/var/www/cacti/rcache');"
mysql -u root -p$MySQLRootPwd cacti -s -e "insert into settings (name,value) values ('realtime_interval','5');"

cd
#
###############################################################################
#
## LoginMod plugin installation
#
#
cd /usr/src/
wget http://docs.cacti.net/_media/plugin:loginmod-latest.tgz
mv plugin:loginmod-latest.tgz loginmod-latest.tgz
tar zxvf ./loginmod-latest.tgz
mv /usr/src/loginmod-$LoginModVersion /var/www/cacti/plugins/loginmod/
rm -f /usr/src/loginmod-latest.tgz
cd
#
################################################################################
#
## Monitor plugin installation
#
#
cd /usr/src/
wget http://docs.cacti.net/_media/plugin:monitor-v$MonitorVersion.tgz
mv plugin:monitor-v$MonitorVersion.tgz monitor-v$MonitorVersion.tgz
tar zxvf ./monitor-v$MonitorVersion.tgz
mv /usr/src/monitor /var/www/cacti/plugins/
rm -f /usr/src/monitor-v$MonitorVersion.tgz
cd
#
################################################################################
#
## Nectar plugin installation
#
#
cd /usr/src/
wget http://docs.cacti.net/_media/plugin:nectar-v$NectarVersion.tgz
mv plugin:nectar-v$NectarVersion.tgz nectar-v$NectarVersion.tgz
tar zxvf ./nectar-v$NectarVersion.tgz
mv /usr/src/nectar /var/www/cacti/plugins/
rm -f /usr/src/nectar-v$NectarVersion.tgz
cd
#
################################################################################
#
## SpikeKill plugin installation
#
#
cd /usr/src/
wget http://docs.cacti.net/_media/plugin:spikekill-v$SpikeKillVersion.tgz
mv plugin:spikekill-v$SpikeKillVersion.tgz spikekill-v$SpikeKillVersion.tgz
tar zxvf ./spikekill-v$SpikeKillVersion.tgz
mv /usr/src/spikekill /var/www/cacti/plugins/
rm -f /usr/src/spikekill-v$SpikeKillVersion.tgz
cd
#
################################################################################
#
## Thold plugin installation
#
#
cd /usr/src/
wget http://cactiusers.org/downloads/thold.gzip -O thold.tar.gz
tar zxvf ./thold.tar.gz
mv /usr/src/thold /var/www/cacti/plugins/
rm -f /usr/src/thold.tar.gz
# For some reason restarting apache and MySQL make the Mysql Thold related errors in cacti logs vanish, so...
/etc/init.d/apache2 restart
/etc/init.d/mysql restart
cd
#
#
################################################################################
#
## PHP NetworkWeatherMap plugin installation
#
#
cd /usr/src/
apt-get install -y unzip php-pear
wget http://www.network-weathermap.com/files/php-weathermap-$WeatherMapVersion.zip
unzip ./php-weathermap-$WeatherMapVersion.zip
mv /usr/src/weathermap /var/www/cacti/plugins/weathermap/
rm -f /usr/src/php-weathermap-$WeatherMapVersion.zip
# Adding a "strict" security policy to the WeatherMap editor
echo '### Some security on the phpweathermap editor ##


Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from '$MeuIP'

' >> /etc/apache2/httpd.conf
sed -i -e 's/$ENABLED=false;/$ENABLED=true;/' /var/www/cacti/plugins/weathermap/editor.php
/etc/init.d/apache2 restart
cd
#
################################################################################
#
## Clog plugin installation
#
#
cd /usr/src/
wget http://docs.cacti.net/_media/plugin:clog-v$ClogVersion.tgz
mv plugin:clog-v$ClogVersion.tgz clog-v$ClogVersion.tgz
tar zxvf ./clog-v$ClogVersion.tgz
mv /usr/src/clog /var/www/cacti/plugins/
rm -f /usr/src/clog-v$ClogVersion.tgz
cd
#
################################################################################
#
## lmSensors/Net-SNMP Sensor Readings
#
#
cd
wget http://www.eric-a-hall.com/software/cacti-netsnmp-lmsensors/cacti-netsnmp-lmsensors.$lmSensorsVersio...
tar -xvzf cacti-netsnmp-lmsensors.$lmSensorsVersion.tar.gz
rm -fr cacti-netsnmp-lmsensors.$lmSensorsVersion.tar.gz
cp cacti-netsnmp-lmsensors/templates/netsnmp_lmsensors_* /root/
cp cacti-netsnmp-lmsensors/scripts/ss_netsnmp_lmsensors.php /var/www/cacti/scripts/
cp cacti-netsnmp-lmsensors/resource/$CactilmSensorsVersion/netsnmp_lmsensors_* /var/www/cacti/resource/script_server/
rm -fr cacti-netsnmp-lmsensors
cd
#
################################################################################
#
## LM Sensors stats on Cacti (via SNMP)
#
#
cd
cd /etc/snmp
wget http://www.pitt-pladdy.com/blog/_20091031-160232_0000_LM_Sensors_stats_on_Cacti_via_SNMP_/sensors-fa...
wget http://www.pitt-pladdy.com/blog/_20091031-160232_0000_LM_Sensors_stats_on_Cacti_via_SNMP_/sensors-te...
wget http://www.pitt-pladdy.com/blog/_20091031-160232_0000_LM_Sensors_stats_on_Cacti_via_SNMP_/sensors-vo...
chmod +x sensors-*
cd
wget http://www.pitt-pladdy.com/blog/_20091031-160232_0000_LM_Sensors_stats_on_Cacti_via_SNMP_/cacti_host...
/etc/init.d/snmpd restart
#
################################################################################
#
## HDD Temperature
#
#
cd
wget http://www.pawelko.net/xmedia/cacti/cacti-linux-hddtemp-1.0.tar.gz
tar zxvf ./cacti-linux-hddtemp-1.0.tar.gz
mv cacti-linux-hddtemp-1.0/hddtemp.xml /var/www/cacti/resource/script_queries/
mv cacti-linux-hddtemp-1.0/hddtemp.php /var/www/cacti/scripts/
mv cacti-linux-hddtemp-1.0/cacti_template_linux_hddtemp_disk_temperature.xml ./
rm -fr cacti-linux-hddtemp-1.0.tar.gz
rm -fr cacti-linux-hddtemp-1.0/
cd
#
################################################################################
#
################################################################################
#
## Some Apache and PHP Tweaking to make it quiet
#
#
#Silencing Apache
cd
sed -i -e 's/ServerTokens Full/ServerTokens Prod/' /etc/apache2/conf.d/security
sed -i -e 's/ServerSignature On/ServerSignature Off/' /etc/apache2/conf.d/security
sed -i -e 's/TraceEnable On/TraceEnable Off/' /etc/apache2/conf.d/security
#Removing Apache unused mod
a2dismod autoindex
#Silencing PHP
sed -i -e 's/expose_php = On/expose_php = Off/' /etc/php5/apache2/php.ini
sed -i -e 's/display_errors = On/display_errors = Off/' /etc/php5/apache2/php.ini
#Removing unused PHP options
sed -i -e 's/allow_url_fopen = On/allow_url_fopen = Off/' /etc/php5/apache2/php.ini
sed -i -e 's/allow_url_include = On/allow_url_include = Off/' /etc/php5/apache2/php.ini
sed -i -e 's/register_argc_argv = On/register_argc_argv = Off/' /etc/php5/apache2/php.ini
sed -i -e 's/file_uploads = On/file_uploads = Off/' /etc/php5/apache2/php.ini
cd
#
################################################################################
#
## SQUID TEMPLATE
#
# http://tutorial.jaringankantor.com/2010/08/use-cacti-for-server-squid-monitoring.html
# http://www.gentoo-wiki.info/Cacti/Squid_Setup
# http://docs.cacti.net/templates?datasrt=&dataflt=templates%3Asquid
#
cd
wget https://sites.google.com/site/tutorialjaringankantor/download/cacti_graph_template_squid_cache_objec...
wget https://sites.google.com/site/tutorialjaringankantor/download/cacti_graph_template_squid_http_data.x...
wget https://sites.google.com/site/tutorialjaringankantor/download/cacti_graph_template_squid_http_reques...
#
wget http://docs.cacti.net/_media/usertemplate:graph:squid:cacti_graph_template_squid_-_http_service_time...
wget http://docs.cacti.net/_media/usertemplate:graph:host_resources_mib:cacti_graph_template_squid_-_hit_...
wget http://docs.cacti.net/_media/usertemplate:graph:host_resources_mib:cacti_graph_template_squid_-_requ...
wget http://docs.cacti.net/_media/usertemplate:graph:squid:cacti_graph_template_squid_-_http_requests.xml...
#
mv usertemplate:graph:squid:cacti_graph_template_squid_-_http_service_time.xml.zip cacti_graph_template_squid_-_http_service_time.xml.zip
mv usertemplate:graph:host_resources_mib:cacti_graph_template_squid_-_hit_ratio.xml.zip cacti_graph_template_squid_-_hit_ratio.xml.zip
mv usertemplate:graph:host_resources_mib:cacti_graph_template_squid_-_request_rate.xml.zip cacti_graph_template_squid_-_request_rate.xml.zip
mv usertemplate:graph:squid:cacti_graph_template_squid_-_http_requests.xml.zip cacti_graph_template_squid_-_http_requests.xml.zip
#
unzip cacti_graph_template_squid_-_hit_ratio.xml.zip
unzip cacti_graph_template_squid_-_http_requests.xml.zip
unzip cacti_graph_template_squid_-_http_service_time.xml.zip
unzip cacti_graph_template_squid_-_request_rate.xml.zip
#
rm -fr cacti_graph_template_squid_-_hit_ratio.xml.zip
rm -fr cacti_graph_template_squid_-_http_requests.xml.zip
rm -fr cacti_graph_template_squid_-_http_service_time.xml.zip
rm -fr cacti_graph_template_squid_-_request_rate.xml.zip
rm -fr __MACOSX
#
################################################################################
#
# Apache restarts
/etc/init.d/apache2 restart
#
################################################################################
#
## Dando permiãos
#
chmod -R 777 /var/www/cacti/
#
echo ###########################################################################
echo Aponte seu navegador para : http://$MeuIP/cacti/
echo ###########################################################################
#
echo ""
else
echo ""
echo "Instale o(s) seguinte(s) programa(s):"
echo ""
fi

if [ $PROGRAMA1 -eq 0 ]
then
echo "Instale o Apache2!"
echo ""
fi

if [ $PROGRAMA2 -eq 0 ]
then
echo "Instale o Php5!"
echo ""
fi

if [ $PROGRAMA3 -eq 0 ]
then
echo "Instale o Mysql Server!"
echo ""
fi

Download 1392942798.install_cacti_v0.8.7g.sh


Esconder código-fonte

#!/bin/bash 
#
## Fonte
## http://infog.casoft.info/2011/05/shell-script-parte-2-controle-de-fluxo/
#
PROGRAMA1=$(dpkg --get-selections | grep apache2 | wc -l)
PROGRAMA2=$(dpkg --get-selections | grep php5 | wc -l)
PROGRAMA3=$(dpkg --get-selections | grep mysql-server | wc -l)

if [ $PROGRAMA1 -ne 0 ] && [ $PROGRAMA2 -ne 0 ] && [ $PROGRAMA3 -ne 0 ]
then
echo ""
#
PROGRAMA=$(dpkg --get-selections | grep dialog | wc -l)
#PROGRAMA=$(which acroread | wc -l)
if [ $PROGRAMA -eq 0 ]
then
sudo apt-get -y --force-yes -f install dialog
else
echo ""
echo "DIALOG - Ja esta instalado!"
echo ""
fi
#
##############################################################################################################
#
CactiVersion="0.8.7g"                   # Cacti version to be installed
PAVersion="2.9"                         # Plugin architecture version to be installed
SpineVersion="0.8.7g"                   # Spine version to be installed
SpinePatchVersion="0.8.7g"            # Spine Patch version to be installed
SettingsVersion="0.71-1"                # Settings plugin version to be installed
CycleVersion="2.3-1"                    # Cycle plugin version to be installed
RealTimeVersion="0.5-2"                 # RealTime plugin version to be installed
LoginModVersion="1.0"                   # LoginMod plugin version to be installed
MonitorVersion="1.3-1"                  # Monitor plugin version to be installed
NectarVersion="0.35a"                   # Nectar plugin version to be installed
SpikeKillVersion="1.3-2"                # SpikeKill plugin version to be installed
TholdVersion="0.4.9-3"                  # Thold (Threshold) plugin version to be installed
WeatherMapVersion="0.97a"               # PHP Network WeatherMap Plugin to be installed
ClogVersion="1.7-1"                     # Clog plugin version to be installed
lmSensorsVersion="0.9"                  # lmSensors/Net-SNMP Sensor Readings
CactilmSensorsVersion="0.8.7"         # lmSensors Sensor Readings
#
##############################################################################################################
#
MeuIP=$(LANG=C; ifconfig eth0|grep "inet addr"|cut -f2 -d:|cut -f1 -d" ")
#
MySQLCactiUser=$( dialog --stdout --inputbox 'MySQL - Usuario do banco de dados para o cacti:' 0 0 ) # MYSQL user for cacti database

MySQLCactiPwd=$( dialog --stdout --passwordbox 'MySQL - Senha do banco de dados para o cacti:' 0 0 ) # Password for the MYSQL user defined above

MySQLRootPwd=$( dialog --stdout --passwordbox 'MySQL - Senha para o usuario "root":' 0 0 ) # Password for MYSQL user "root"

SystemCactiUser=$( dialog --stdout --inputbox 'LINUX - Usuario executando cacti:' 0 0 ) # Linux user running cacti
#
clear
#
##############################################################################################################
#
sudo apt-get -y --force-yes -f install lm-sensors
sudo apt-get -y --force-yes -f install hddtemp
sudo apt-get -y --force-yes -f install build-essential
sudo apt-get -y --force-yes -f install rcconf
sudo apt-get -y --force-yes -f install libncurses5-dev
sudo apt-get -y --force-yes -f install libgd2-xpm
sudo apt-get -y --force-yes -f install libxpm-dev
sudo apt-get -y --force-yes -f install libpng12-dev
sudo apt-get -y --force-yes -f install libgdbm-dev
sudo apt-get -y --force-yes -f install patch
sudo apt-get -y --force-yes -f install rrdtool
sudo apt-get -y --force-yes -f install snmp
sudo apt-get -y --force-yes -f install snmpd
sudo apt-get -y --force-yes -f install snmp-mibs-downloader
sudo apt-get -y --force-yes -f install libnet-snmp-perl libsnmp-base
sudo apt-get -y --force-yes -f install libgd2-xpm-dev libsnmp-perl libssl-dev openssl
sudo apt-get -y --force-yes -f install unzip
sudo apt-get -y --force-yes -f install unrar
#
##############################################################################################################
#
## Cacti installation
#
#
sudo apt-get -y --force-yes -f install rrdtool snmp snmpd php5-snmp
cd /usr/src/
wget http://www.cacti.net/downloads/cacti-$CactiVersion.tar.gz
tar zxvf cacti-$CactiVersion.tar.gz
mv ./cacti-$CactiVersion/ /var/www/cacti/
mysqladmin -u root -p$MySQLRootPwd drop cacti
mysqladmin -u root -p$MySQLRootPwd create cacti

sed -i 's/TYPE=MyISAM//' /var/www/cacti/cacti.sql

mysql -u $MySQLCactiUser -p$MySQLCactiPwd cacti < /var/www/cacti/cacti.sql

cd /var/www/cacti/include/
sed -i -e 's/username = "cactiuser"/username = "'$MySQLCactiUser'"/' config.php
sed -i -e 's/password = "cactiuser"/password = "'$MySQLCactiPwd'"/' config.php

sed -i -e 's/username = "cactiuser"/username = "'$MySQLCactiUser'"/' global.php
sed -i -e 's/password = "cactiuser"/password = "'$MySQLCactiPwd'"/' global.php

touch /etc/cron.d/cacti
echo "*/5 * * * * $SystemCactiUser php /var/www/cacti/poller.php >/dev/null 2>&1" >> /etc/cron.d/cacti
echo "*/5 * * * * $SystemCactiUser chmod -R 777 /var/www/cacti/" >> /etc/cron.d/cacti
rm -f /usr/src/cacti-$CactiVersion.tar.gz
cd
#
##############################################################################################################
#
## Patching Cacti
#
#
sudo apt-get -y --force-yes -f install patch
cd /usr/src/
wget http://www.cacti.net/downloads/patches/$CactiVersion/data_source_deactivate.patch
wget http://www.cacti.net/downloads/patches/$CactiVersion/graph_list_view.patch
wget http://www.cacti.net/downloads/patches/$CactiVersion/html_output.patch
wget http://www.cacti.net/downloads/patches/$CactiVersion/ldap_group_authenication.patch
wget http://www.cacti.net/downloads/patches/$CactiVersion/script_server_command_line_parse.patch
wget http://www.cacti.net/downloads/patches/$CactiVersion/ping.patch
wget http://www.cacti.net/downloads/patches/$CactiVersion/poller_interval.patch
cd /var/www/cacti/
patch -b -p1 -N < /usr/src/data_source_deactivate.patch
patch -b -p1 -N < /usr/src/graph_list_view.patch
patch -b -p1 -N < /usr/src/html_output.patch
patch -b -p1 -N < /usr/src/ldap_group_authenication.patch
patch -b -p1 -N < /usr/src/script_server_command_line_parse.patch
patch -b -p1 -N < /usr/src/ping.patch
patch -b -p1 -N < /usr/src/poller_interval.patch
rm -f /usr/src/*.patch
cd
#
##############################################################################################################
#
## Configure Snmpd in order to access the public MIB on localhost
#
Local=$( dialog --stdout --inputbox 'Local:' 0 0 )
#
Email=$( dialog --stdout --inputbox 'E-Mail:' 0 0 )
#
clear
#
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bkp
touch /etc/snmp/snmpd.conf

echo '
###############################################################################
#
#  AGENT BEHAVIOUR
#
agentAddress udp:161,udp6:[::1]:161

###############################################################################
#
#  ACCESS CONTROL
#

view   systemonly  included   .1.3.6.1.2.1.1
view   systemonly  included   .1.3.6.1.2.1.25.1

proxy -v 1 -c public localhost:3401 .1.3.6.1.4.1.3495.1
view system included .1.3.6.1.4.1.3495.1

rocommunity public  localhost
rocommunity public  '$MeuIP'

rocommunity public  default    -V systemonly
rocommunity public  default

rouser   authOnlyUser

#com2sec paranoid
com2sec readonly

###############################################################################
#
#  SYSTEM INFORMATION
#

sysLocation    '$Local'
sysContact     '$Email'

sysServices    72

proc  mountd

proc  ntalkd    4

proc  sendmail 10 1

disk       /     10000
disk       /var  5%
includeAllDisks  10%

load   12 10 5

###############################################################################
#
#  ACTIVE MONITORING
#

trapsink     localhost public
trapsink     '$MeuIP' public

trap2sink    localhost public
trap2sink    '$MeuIP' public

iquerySecName   internalUser       
rouser          internalUser

defaultMonitors          yes

linkUpDownNotifications  yes

###############################################################################
#
#  EXTENDING THE AGENT
#

extend    test1   /bin/echo  Hello, world!
extend-sh test2   echo Hello, world! ; echo Hi there ; exit 35

###############################################################################
#
#  EXTENDING THE AGENT SENSORS
#

extend sensortemps /etc/snmp/sensors-temps
extend sensorfans /etc/snmp/sensors-fans
extend sensorvoltages /etc/snmp/sensors-voltages

#
###############################################################################

###############################################################################
#
#  EXTENDING THE AGENT AMD
#

extend  gputemp         /etc/snmp/gpu_snmp.pl temp
extend  gpuload         /etc/snmp/gpu_snmp.pl load
extend  gpuclock        /etc/snmp/gpu_snmp.pl clock
extend  gpumemory       /etc/snmp/gpu_snmp.pl memory
extend  gpuvcore        /etc/snmp/gpu_snmp.pl vcore
extend  gpufan          /etc/snmp/gpu_snmp.pl fan
extend  gpuid           /etc/snmp/gpu_snmp.pl id
extend  gpuaddress      /etc/snmp/gpu_snmp.pl address
extend  gpudescription  /etc/snmp/gpu_snmp.pl description

#
###############################################################################

master          agentx
' >> /etc/snmp/snmpd.conf

/etc/init.d/snmpd restart
cd
#
##############################################################################################################
#
## Cacti-Spine installation & patching
#
#
apt-get install -y libsnmp-dev libmysqlclient15-dev libssl-dev make
apt-get install -y patch
cd /usr/src/
wget http://www.cacti.net/downloads/spine/cacti-spine-$SpineVersion.tar.gz
wget http://www.cacti.net/downloads/spine/patches/$SpinePatchVersion/unified_issues.patch
tar zxvf cacti-spine-$SpineVersion.tar.gz
cd cacti-spine-$SpineVersion/
patch -p1 -N < /usr/src/unified_issues.patch
./configure
make
mkdir /usr/local/spine
mv ./spine /usr/local/spine/
mv ./spine.h /usr/local/spine/spine
mv ./spine.conf.dist /usr/local/spine/spine.conf
cd /usr/local/spine/
sed -i -e 's/DB_User         cactiuser/DB_User         '$MySQLCactiUser'/' spine.conf
sed -i -e 's/DB_Pass         cactiuser/DB_Pass         '$MySQLCactiPwd'/' spine.conf
rm -f /usr/src/cacti-spine-$SpineVersion.tar.gz
rm -rf /usr/src/cacti-spine-$SpineVersion/
rm -f /usr/src/unified_issues.patch
cd
#
##############################################################################################################
#
## Plugin Architecture Installation
#
#
apt-get install -y patch
cd /usr/src/
wget http://www.cacti.net/downloads/pia/cacti-plugin-$CactiVersion-PA-v$PAVersion.tar.gz
tar zxvf cacti-plugin-$CactiVersion-PA-v$PAVersion.tar.gz
cd /var/www/cacti/
patch -b -p1 -N < /usr/src/cacti-plugin-arch/cacti-plugin-$CactiVersion-PA-v$PAVersion.diff

sed -i 's/TYPE=MyISAM//' /usr/src/cacti-plugin-arch/pa.sql

mysql -u $MySQLCactiUser -p$MySQLCactiPwd cacti < /usr/src/cacti-plugin-arch/pa.sql
cd /var/www/cacti/include/
sed -i -e 's/"\/"/"\/cacti\/"/' config.php
rm -f /usr/src/cacti-plugin-$CactiVersion-PA-v$PAVersion.tar.gz
rm -rf /usr/src/cacti-plugin-arch/
cd
#
##############################################################################################################
#
## Settings plugin installation
#
#
cd /usr/src/
wget http://docs.cacti.net/_media/plugin:settings-v$SettingsVersion.tgz
mv plugin\:settings-v$SettingsVersion.tgz settings-v$SettingsVersion.tgz
tar zxvf ./settings-v$SettingsVersion.tgz
mv /usr/src/settings/ /var/www/cacti/plugins/
rm -f /usr/src/settings-v$SettingsVersion.tgz
cd
#
##############################################################################################################
#
## Cycle plugin installation
#
#
cd /usr/src/
wget http://docs.cacti.net/_media/plugin:cycle-v$CycleVersion.tgz
mv plugin\:cycle-v$CycleVersion.tgz cycle-v$CycleVersion.tgz
tar zxvf ./cycle-v$CycleVersion.tgz
mv /usr/src/cycle /var/www/cacti/plugins/cycle/
rm -f /usr/src/cycle-v$CycleVersion.tgz
cd
#
##############################################################################################################
#
## Realtime plugin installation
#
#
cd /usr/src/
wget http://docs.cacti.net/_media/plugin:realtime-v$RealTimeVersion.tgz
mv plugin:realtime-v$RealTimeVersion.tgz realtime-v$RealTimeVersion.tgz
tar zxvf ./realtime-v$RealTimeVersion.tgz
mv /usr/src/realtime/ /var/www/cacti/plugins/
mkdir /var/www/cacti/plugins/rt_cache/
mkdir /var/www/cacti/rcache
rm -f /usr/src/realtime-v$RealTimeVersion.tgz
cd
#
cd
touch rcache.sql
echo '
USE cacti;
insert into settings (name,value) values ('realtime_cache_path','/var/www/cacti/rcache');
insert into settings (name,value) values ('realtime_interval','5');
' >> rcache.sql
mysql -u root -p$MySQLRootPwd cacti < rcache.sql
rm -fr rcache.sql

mysql -u root -p$MySQLRootPwd cacti -s -e "insert into settings (name,value) values ('realtime_cache_path','/var/www/cacti/rcache');"
mysql -u root -p$MySQLRootPwd cacti -s -e "insert into settings (name,value) values ('realtime_interval','5');"

cd
#
##############################################################################################################
#
## LoginMod plugin installation
#
#
cd /usr/src/
wget http://docs.cacti.net/_media/plugin:loginmod-latest.tgz
mv plugin:loginmod-latest.tgz loginmod-latest.tgz
tar zxvf ./loginmod-latest.tgz
mv /usr/src/loginmod-$LoginModVersion /var/www/cacti/plugins/loginmod/
rm -f /usr/src/loginmod-latest.tgz
cd
#
##############################################################################################################
#
## Monitor plugin installation
#
#
cd /usr/src/
wget http://docs.cacti.net/_media/plugin:monitor-v$MonitorVersion.tgz
mv plugin:monitor-v$MonitorVersion.tgz monitor-v$MonitorVersion.tgz
tar zxvf ./monitor-v$MonitorVersion.tgz
mv /usr/src/monitor /var/www/cacti/plugins/
rm -f /usr/src/monitor-v$MonitorVersion.tgz
cd
#
##############################################################################################################
#
## Nectar plugin installation
#
#
cd /usr/src/
wget http://docs.cacti.net/_media/plugin:nectar-v$NectarVersion.tgz
mv plugin:nectar-v$NectarVersion.tgz nectar-v$NectarVersion.tgz
tar zxvf ./nectar-v$NectarVersion.tgz
mv /usr/src/nectar /var/www/cacti/plugins/
rm -f /usr/src/nectar-v$NectarVersion.tgz
cd
#
##############################################################################################################
#
## SpikeKill plugin installation
#
#
cd /usr/src/
wget http://docs.cacti.net/_media/plugin:spikekill-v$SpikeKillVersion.tgz
mv plugin:spikekill-v$SpikeKillVersion.tgz spikekill-v$SpikeKillVersion.tgz
tar zxvf ./spikekill-v$SpikeKillVersion.tgz
mv /usr/src/spikekill /var/www/cacti/plugins/
rm -f /usr/src/spikekill-v$SpikeKillVersion.tgz
cd
#
##############################################################################################################
#
## Thold plugin installation
#
#
cd /usr/src/
wget http://cactiusers.org/downloads/thold.gzip -O thold.tar.gz
tar zxvf ./thold.tar.gz
mv /usr/src/thold /var/www/cacti/plugins/
rm -f /usr/src/thold.tar.gz
# For some reason restarting apache and MySQL make the Mysql Thold related errors in cacti logs vanish, so...
/etc/init.d/apache2 restart
/etc/init.d/mysql restart
cd
#
#
##############################################################################################################
#
## PHP NetworkWeatherMap plugin installation
#
#
cd /usr/src/
apt-get install -y unzip php-pear
wget http://www.network-weathermap.com/files/php-weathermap-$WeatherMapVersion.zip
unzip ./php-weathermap-$WeatherMapVersion.zip
mv /usr/src/weathermap /var/www/cacti/plugins/weathermap/
rm -f /usr/src/php-weathermap-$WeatherMapVersion.zip
# Adding a "strict" security policy to the WeatherMap editor
echo '### Some security on the phpweathermap editor ##
 <Directory /var/www/cacti/plugins/weathermap>
        <Files editor.php>
            Order Deny,Allow
            Deny from all
            Allow from 127.0.0.1
            Allow from '$MeuIP'
        </Files>
    </Directory>' >> /etc/apache2/httpd.conf
sed -i -e 's/$ENABLED=false;/$ENABLED=true;/' /var/www/cacti/plugins/weathermap/editor.php
/etc/init.d/apache2 restart
cd
#
##############################################################################################################
#
## Clog plugin installation
#
#
cd /usr/src/
wget http://docs.cacti.net/_media/plugin:clog-v$ClogVersion.tgz
mv plugin:clog-v$ClogVersion.tgz clog-v$ClogVersion.tgz
tar zxvf ./clog-v$ClogVersion.tgz
mv /usr/src/clog /var/www/cacti/plugins/
rm -f /usr/src/clog-v$ClogVersion.tgz
cd
#
##############################################################################################################
#
## lmSensors/Net-SNMP Sensor Readings
#
#
cd
wget http://www.eric-a-hall.com/software/cacti-netsnmp-lmsensors/cacti-netsnmp-lmsensors.$lmSensorsVersion.tar.gz
tar -xvzf cacti-netsnmp-lmsensors.$lmSensorsVersion.tar.gz
rm -fr cacti-netsnmp-lmsensors.$lmSensorsVersion.tar.gz
cp cacti-netsnmp-lmsensors/scripts/ss_netsnmp_lmsensors.php /var/www/cacti/scripts/
cp cacti-netsnmp-lmsensors/resource/$CactilmSensorsVersion/netsnmp_lmsensors_* /var/www/cacti/resource/script_server/
rm -fr cacti-netsnmp-lmsensors
cd
#
##############################################################################################################
#
## LM Sensors stats on Cacti (via SNMP)
#
#
cd
cd /etc/snmp
wget http://www.pitt-pladdy.com/blog/_20091031-160232_0000_LM_Sensors_stats_on_Cacti_via_SNMP_/sensors-fans
wget http://www.pitt-pladdy.com/blog/_20091031-160232_0000_LM_Sensors_stats_on_Cacti_via_SNMP_/sensors-temps
wget http://www.pitt-pladdy.com/blog/_20091031-160232_0000_LM_Sensors_stats_on_Cacti_via_SNMP_/sensors-voltages
chmod +x sensors-*
cd
wget http://www.pitt-pladdy.com/blog/_20091031-160232_0000_LM_Sensors_stats_on_Cacti_via_SNMP_/cacti_host_template_lm_sensors_parameters.xml
/etc/init.d/snmpd restart
#
##############################################################################################################
#
## LM Sensors AMD
#
LinuxUser=$( dialog --stdout --inputbox 'LINUX - Usuario executando linux:' 0 0 )
#
cd
wget http://www.praecogito.com/bitcoin/amd-gpu/snmp-script/packages/amd-gpu-snmp-script-0.02.zip
unzip amd-gpu-snmp-script-0.02.zip
cd 0.02
mv gpu_snmp.pl /etc/snmp/
chmod +x /etc/snmp/gpu_snmp.pl
echo 'snmp    ALL=(ALL) NOPASSWD: /usr/bin/aticonfig' >> /etc/sudoers
cd
rm -fr 0.02/
rm -fr amd-gpu-snmp-script-0.02.zip
sed -i -e 's/$sudo = "sudo -u jintu"/$sudo = "sudo -u '$LinuxUser'"/' /etc/snmp/gpu_snmp.pl
sed -i -e 's/\/usr\/bin\/aticonfig/aticonfig/' /etc/snmp/gpu_snmp.pl
/etc/init.d/snmpd restart
cd
wget http://www.praecogito.com/bitcoin/amd-gpu/cacti-template/sources/0.01/cacti_data_query_amd_gpu.xml
wget http://www.praecogito.com/bitcoin/amd-gpu/cacti-template/sources/0.01/snmp_queries/amd_gpu.xml
mv amd_gpu.xml /var/www/cacti/resource/snmp_queries/
cd
#
##############################################################################################################
#
## HDD Temperature
#
#
cd
wget http://www.pawelko.net/xmedia/cacti/cacti-linux-hddtemp-1.0.tar.gz
tar zxvf ./cacti-linux-hddtemp-1.0.tar.gz
mv cacti-linux-hddtemp-1.0/hddtemp.xml /var/www/cacti/resource/script_queries/
mv cacti-linux-hddtemp-1.0/hddtemp.php /var/www/cacti/scripts/
mv cacti-linux-hddtemp-1.0/cacti_template_linux_hddtemp_disk_temperature.xml ./
rm -fr cacti-linux-hddtemp-1.0.tar.gz
rm -fr cacti-linux-hddtemp-1.0/
cd
#
##############################################################################################################
#
##############################################################################################################
#
## Some Apache and PHP Tweaking to make it quiet
#
#
#Silencing Apache
cd
sed -i -e 's/ServerTokens Full/ServerTokens Prod/' /etc/apache2/conf.d/security
sed -i -e 's/ServerSignature On/ServerSignature Off/' /etc/apache2/conf.d/security
sed -i -e 's/TraceEnable On/TraceEnable Off/' /etc/apache2/conf.d/security
#Removing Apache unused mod
a2dismod autoindex
#Silencing PHP
sed -i -e 's/expose_php = On/expose_php = Off/' /etc/php5/apache2/php.ini
sed -i -e 's/display_errors = On/display_errors = Off/' /etc/php5/apache2/php.ini
#Removing unused PHP options
sed -i -e 's/allow_url_fopen = On/allow_url_fopen = Off/' /etc/php5/apache2/php.ini
sed -i -e 's/allow_url_include = On/allow_url_include = Off/' /etc/php5/apache2/php.ini
sed -i -e 's/register_argc_argv = On/register_argc_argv = Off/' /etc/php5/apache2/php.ini
sed -i -e 's/file_uploads = On/file_uploads = Off/' /etc/php5/apache2/php.ini
cd
#
##################################################################################################
#
## SQUID TEMPLATE
#
# http://tutorial.jaringankantor.com/2010/08/use-cacti-for-server-squid-monitoring.html
# http://www.gentoo-wiki.info/Cacti/Squid_Setup
# http://docs.cacti.net/templates?datasrt=&dataflt=templates%3Asquid
#
cd
wget https://sites.google.com/site/tutorialjaringankantor/download/cacti_graph_template_squid_cache_objects.xml
wget https://sites.google.com/site/tutorialjaringankantor/download/cacti_graph_template_squid_http_data.xml
wget https://sites.google.com/site/tutorialjaringankantor/download/cacti_graph_template_squid_http_requests.xml
#
wget http://docs.cacti.net/_media/usertemplate:graph:squid:cacti_graph_template_squid_-_http_service_time.xml.zip
wget http://docs.cacti.net/_media/usertemplate:graph:host_resources_mib:cacti_graph_template_squid_-_hit_ratio.xml.zip
wget http://docs.cacti.net/_media/usertemplate:graph:host_resources_mib:cacti_graph_template_squid_-_request_rate.xml.zip
wget http://docs.cacti.net/_media/usertemplate:graph:squid:cacti_graph_template_squid_-_http_requests.xml.zip
#
mv usertemplate:graph:squid:cacti_graph_template_squid_-_http_service_time.xml.zip cacti_graph_template_squid_-_http_service_time.xml.zip
mv usertemplate:graph:host_resources_mib:cacti_graph_template_squid_-_hit_ratio.xml.zip cacti_graph_template_squid_-_hit_ratio.xml.zip
mv usertemplate:graph:host_resources_mib:cacti_graph_template_squid_-_request_rate.xml.zip cacti_graph_template_squid_-_request_rate.xml.zip 
mv usertemplate:graph:squid:cacti_graph_template_squid_-_http_requests.xml.zip cacti_graph_template_squid_-_http_requests.xml.zip
#
unzip cacti_graph_template_squid_-_hit_ratio.xml.zip
unzip cacti_graph_template_squid_-_http_requests.xml.zip
unzip cacti_graph_template_squid_-_http_service_time.xml.zip
unzip cacti_graph_template_squid_-_request_rate.xml.zip
#
rm -fr cacti_graph_template_squid_-_hit_ratio.xml.zip
rm -fr cacti_graph_template_squid_-_http_requests.xml.zip
rm -fr cacti_graph_template_squid_-_http_service_time.xml.zip
rm -fr cacti_graph_template_squid_-_request_rate.xml.zip
rm -fr __MACOSX
#
##############################################################################################################
#
# Apache restarts
/etc/init.d/apache2 restart
#
##############################################################################################################
#
## Dando permiãos
#
chmod -R 777 /var/www/cacti/
#
echo ################################################################################
echo Aponte seu navegador para : http://$MeuIP/cacti/
echo ################################################################################
#
echo ""
else
echo ""
echo "Instale o(s) seguinte(s) programa(s):"
echo ""
fi

if [ $PROGRAMA1 -eq 0 ]
then
echo "Instale o Apache2!"
echo ""
fi

if [ $PROGRAMA2 -eq 0 ]
then
echo "Instale o Php5!"
echo ""
fi

if [ $PROGRAMA3 -eq 0 ]
then
echo "Instale o Mysql Server!"
echo ""
fi

Scripts recomendados

Twitter via linha de comando!

Administração de VirtualBox com ShellScript

Software backup, restore, leitura de logs, com dialog

Firewall simples com iptables

ZVideo1.1 - Conversor de formatos de vídeo para divX


  

Comentários

Nenhum comentário foi encontrado.


Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts