scrip install icinga php
本脚本是根据国外的网站上找的(脚本使用适合centos系统解决支持库,解决依赖问题。)
#!/bin/bash
# Instalation des packages necessaires
# Installation of packages
yum install xterm
yum install php php-cli rrdtool librrds-perl php5-gd gcc make tomcat6 perl-* perl *-perl php-pear php-xmlrpc php-xsl php-pdo php-soap php-gd php-ldap php-mysql httpd gcc glibc glibc-common gd gd-devel libjpeg libjpeg-devel libpng libpng-devel net-snmp net-snmp-devel net-snmp-utils mysql mysql-server libdbi libdbi-devel libdbi-drivers libdbi-dbd-mysql postgresql postgresql-server libdbi libdbi-devel libdbi-drivers libdbi-dbd-pgsql
# Creation d‘un dossier pour l‘installation
# Creation of directory for installation
xterm -e mkdir /icinga
# Creation d‘un compte utilisateur et du groupe
# Creation of user account
useradd -m icinga
echo "
# Entrez le mot de passe pour l‘utilisateur icinga
le mot de passe est : icinga
# Enter password for icinga user
the password is : icinga
****** Fermer la fenetre apres avoir fini ******
****** Close windows if you finish ******
" > /icinga/tempo
xterm -e vim /icinga/tempo&
xterm -e passwd icinga&
groupadd icinga
groupadd icinga-cmd
usermod -a -G icinga-cmd icinga
usermod -a -G icinga-cmd apache
# Téléchargement des sources
# Download of sources
cd /usr/src/
xterm -e wget http://garr.dl.sourceforge.net/project/icinga/icinga-web/1.10.0/icinga-web-1.10.0.tar.gz&
xterm -e wget http://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz&
xterm -e wget http://garr.dl.sourceforge.net/project/icinga/icinga/1.10.1/icinga-1.10.1.tar.gz&
cd /usr/src/
clear
echo "
***** Telechargement en cours *****
***** Downloads is process *****
"
wait
# Compilation et installation d‘Icinga Core
# Compilation and installtion of Icinga Cor
cd /usr/src/
tar xzvf icinga-1.10.1.tar.gz
cd icinga-1.10.1/
./configure
make all
make install
make install-init
make install-config
make install-eventhandlers
make install-commandmode
make install-idoutils
cd /usr/local/icinga/etc/
cp idomod.cfg-sample idomod.cfg
cp ido2db.cfg-sample ido2db.cfg
/etc/init.d/mysqld start
echo "
# Initialisation de la base de données entrez les commandes
# suivantes sur mysql
# Initialize data base enter following commands on mysql
##############################
CREATE DATABASE icinga;
GRANT USAGE ON icinga.* TO ‘icinga‘@‘localhost‘
IDENTIFIED BY ‘icinga‘
WITH MAX_QUERIES_PER_HOUR 0
MAX_CONNECTIONS_PER_HOUR 0
MAX_UPDATES_PER_HOUR 0;
GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE
ON icinga.* TO ‘icinga‘@‘localhost‘;
FLUSH PRIVILEGES;
quit
##############################
****** Fermer la fenetre apres avoir fini ******
****** Close windows if you finish ******
" > /icinga/tempo
xterm -e vim /icinga/tempo&
mysql -u root
wait
cd /usr/src/icinga-1.10.1/module/idoutils/db/mysql/
mysql -u root icinga < mysql.sql
# Gestion des modules cassé
# Management of broken modules
cp /usr/local/icinga/etc/modules/idoutils.cfg-sample /usr/local/icinga/etc/modules/idoutils.cfg
# Configuration de l‘interface web classic
# Configurationof classic web interface
cd /usr/src/icinga-1.10.1/
make cgis
make install-cgis
make install-html
make install-webconf
# Creation du compte admin
# Creation of admin account
echo "
# Entrez le mot de passe pour l‘utilisateur icingaadmin
# Enter password for icingaadmin user
# Ce mot de passe sera utilisé pour l‘interface web
# That password will be use for web interface
****** Fermer la fenetre apres avoir fini ******
****** Close windows if you finish ******
" > /icinga/tempo
xterm -e vim /icinga/tempo&
xterm -e htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin&
wait
# Redemarrage du service web
# Restartweb service
service httpd restart
# Compilation et installation des plugin pour nagios
# Compilation and installation of plugin for nagios
cd /usr/src
tar xvzf nagios-plugins-1.5.tar.gz
cd nagios-plugins-1.5
./configure --prefix=/usr/local/icinga \
--with-cgiurl=/icinga/cgi-bin \
--with-nagios-user=icinga --with-nagios-group=icinga
make
make install
# Modification temporaire des parametres System
# Temporary modification of system settings
getenforce
setenforce 0
chcon -R -t httpd_sys_script_exec_t /usr/local/icinga/sbin/
chcon -R -t httpd_sys_content_t /usr/local/icinga/share/
# Redémarrage et sauvegarde
# Restart and save new services
for i in mysqld ido2db icinga httpd; do /etc/init.d/$i restart; done
for i in mysqld ido2db icinga httpd; do chkconfig --add $i; chkconfig $i on; done
################################################################################################
################################################################################################
################################################################################################
################################################################################################
################################################################################################
################################################################################################
################################################################################################
################################################################################################
################################################################################################
################################################################################################
# ICINGA WEB
# Compilation et instalation
# Compilation and Installation
cd /usr/src/
tar xvzf icinga-web-1.10.0.tar.gz
cd /usr/src/icinga-web-1.10.0/
./configure --prefix=/usr/local/icinga-web --with-db-type=mysql --with-db-host=localhost --with-db-port=3306 --with-db-name=icinga_web --with-db-user=icinga_web --with-db-pass=icinga_web
make install
make install-apache-config
make install-javascript
make install-done
make testdeps
# Configuration de la BD pour IcingaWeb
# Configuration of Data Base for Icinga Web
echo "
# Initialisation de la base de données entrez les commandes
# suivantes sur mysql
# Initialize data base enter following commands on mysql
##############################
CREATE DATABASE icinga_web;
GRANT USAGE ON *.* TO ‘icinga_web‘@‘localhost‘
IDENTIFIED BY ‘icinga_web‘
WITH MAX_QUERIES_PER_HOUR 0
MAX_CONNECTIONS_PER_HOUR 0
MAX_UPDATES_PER_HOUR 0;
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX ON icinga_web.* TO ‘icinga_web‘@‘localhost‘;
FLUSH PRIVILEGES;
quit
##############################
****** Fermer la fenetre apres avoir fini ******
****** Close windows if you finish ******
" > /icinga/tempo
xterm -e vim /icinga/tempo&
mysql -u root
wait
echo "
# Initialisation de la base de données
# Initialize data base
acceptez tout
accept all
****** Fermer la fenetre apres avoir fini ******
****** Close windows if you finish ******
" > /icinga/tempo
xterm -e vim /icinga/tempo&
xterm -e make db-initialize&
wait
for i in mysqld ido2db icinga httpd crond snmpd snmptrapd ; do /etc/init.d/$i restart; done
echo "
# Change idomod.cfg
#use_ssl=1
#output_type=tcpsocket
#output=127.0.0.1
# Change ido2db.cfg
#use_ssl=1
#socket_type=tcp
# Pour sauvegarder => Echap :wq
# To save => Echap :wq
****** Fermer la fenetre apres avoir fini ******
****** Close windows if you finish ******
" > /icinga/tempo
xterm -e vim /icinga/tempo&
xterm -e vim /usr/local/icinga/etc/ido2db.cfg&
xterm -e vim /usr/local/icinga/etc/idomod.cfg&
wait
echo "
# ******* idoutils.cfg **********
# Ajouter/Modifier
# Add/Upadate
# define module{
# module_name ido_mod
# path /usr/local/icinga/lib/idomod.so
# module_type neb
# args config_file=/usr/local/icinga/etc/idomod.cfg
# }
# Pour sauvegarder => Echap :wq
# To save => Echap :wq
****** Fermer la fenetre apres avoir fini ******
****** Close windows if you finish ******
" > /icinga/tempo
xterm -e vim /icinga/tempo&
xterm -e vim /usr/local/icinga/etc/modules/idoutils.cfg&
wait
echo "
# Pour enregistrer les parametres systeme de maniere permanente
# changer
SELINUX=enforcing
#par
SELINUX=disabled
# To save system settings
# change
SELINUX=enforcing
#by
SELINUX=disabled
******************************************
# Pour sauvegarder => Echap :wq
# To save => Echap :wq
****** Fermer la fenetre apres avoir fini ******
****** Close windows if you finish ******
" > /icinga/tempo
xterm -e vim /icinga/tempo&
xterm -e vim /etc/sysconfig/selinux&
wait
for i in mysqld ido2db icinga httpd crond snmpd snmptrapd ; do /etc/init.d/$i restart; done
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。