scrip install icinga php
admin
2023-06-30 12:24:05
0

本脚本是根据国外的网站上找的(脚本使用适合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



相关内容

热门资讯

一颗流星在美国马萨诸塞州上空爆... 当地时间5月30日,一颗流星在美国东北部马萨诸塞州近海上空爆炸,并引发巨响。该州多地居民均听到爆炸声...
鸿蒙智家框架合作协议签约仪式在... 5月29日,鲁班兄弟装饰工程有限公司与华为终端有限公司在华为云南区域总部举行鸿蒙智家框架合作协议签约...
中国科学院工程热物理所在超临界... 以超临界二氧化碳(S-CO₂)为代表的新型超临界流体正以其独特优势,在制冷、发电、储能等领域拓展应用...
5月31日,“蓝月亮”上线 5月31日,农历四月十五,一轮满月将现身夜空。这轮满月有些特别,它是本月第二次满月,同时它又是本年度...
原创 华... 华为在6月份的新品越来越丰富,比如智能手机、智能手表、耳夹式耳机、新一代全屋智能等,覆盖到多场景。其...
伊朗称对霍尔木兹海峡航运实施全... 据伊朗方面当地时间5月30日消息,伊朗武装部队哈塔姆安比亚中央总部说,伊朗对霍尔木兹海峡航运实施全面...
13人遇难“致命黑车”调查:座... 5月28日凌晨,一辆载满河南邓州周边等地乘客的大通客车,从浙江杭州出发赶回邓州,经过G40沪陕高速河...
多地职校招生报名火爆 作者 | 第一财经 林靖职业教育正在成为越来越多人的“主动选择”,中职赛道不再是备选项。近日,北京中...
初一男生校门口遭群殴或失聪,教... 哥哥同学辱骂母亲,辽宁鞍山13岁少年在学校门口维护哥哥与人发生争执,随后数名同龄少年一拥而上对其实施...
演唱会大量邀请票被当众焚毁,警... 极目新闻记者 杜光然5月29日,网友发帖称,有人当众焚烧大量演唱会邀请票,视频定位于温岭市体育中心。...