1

Я уже пробовал много учебников по Интернету , пытаясь настройки nagios и centreon работать вместе в centOS 6.4

Я хочу запустить скрипт, и он сделает все, я должен зайти на centreon web page и все будет работать нормально.

Поэтому я разрабатываю этот сценарий, но я не знаю, что ответить на вопросы Centreon, он просит обновить мою pear и застрял там, в бесконечном цикле.

Теперь он показывает что-то по адресу http://localhost/centreon/install/pagesetup.php но все серое, и все. Что мне здесь не хватает?

2 ответа2

1

Я нашел решение и разделил его на пять этапов, чтобы вы могли установить его на Virtual machine и вам не нужно каждый раз upgrade или устанавливать package , чтобы вы могли выполнить только последний шаг, который вы выполняли раньше.

1. Добавление репозитория

#!/bin/bash

if [ ! -f rpmforge-release-0.5.3-1.el6.rf.i686.rpm ]; then

  #i386
  wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm

  #x86_64
  #wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

  wget http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
  rpm --import RPM-GPG-KEY.dag.txt

  #i386
  rpm -Uvh rpmforge-release-0.5.3-1.el6.rf.i686.rpm

  #x86_64
  #rpm -Uvh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

  yum update 
  yum upgrade -y
fi

2. Установка пакетов

#!/bin/bash

# Installing Apache2 + PHP
yum -y install httpd php php-mysql php-gd

# Installing GD modules
yum -y install gd fontconfig-devel libjpeg-devel libpng-devel gd-devel perl-GD

# Installing MySQL
yum -y install openssl-devel perl-DBD-MySQL mysql-server mysql-devel

# Installing PHP Dependencies
yum -y install php-ldap php-xml php-mbstring

# Installing DBI modules
yum -y install perl-DBI perl-DBD-MySQL

# Installing PERL modules
yum -y install perl-Config-IniFiles

# Installing RRDTools
yum -y install rrdtool perl-rrdtool

# Installing Mail
yum -y install mail

# Installing SNMP
yum -y install perl-Crypt-DES perl-Digest-SHA1 perl-Digest-HMAC net-snmp-utils
yum -y install perl-Socket6 perl-IO-Socket-INET6 net-snmp net-snmp-libs php-snmp dmidecode lm_sensors perl-Net-SNMP net-snmp-perl

# Misc
yum -y install fping cpp gcc gcc-c++ libstdc++ glib2-devel
# Make is not included on cent-os by default
yum -y install make

# PEAR
yum -y install php-pear
pear channel-update pear.php.net 
# for those who have a web proxy
# pear config-set http_proxy http://my_proxy.com:port 
pear upgrade-all

yum -y install fping openssl-devel openldap-devel postgresql-devel radiusclient-ng-devel samba-client libsmbclient  

yum -y install perl-devel

yum -y install patch

3. Монтаж

#!/bin/bash

# Stoping firewall
/sbin/service iptables stop
/sbin/service ip6tables stop

# Stoping firewall to start as daemon
/sbin/chkconfig iptables off
/sbin/chkconfig ip6tables off

#Installing Apache2
usermod -U apache
chkconfig httpd on

# Set your timezone in php.ini to get rid of an ugly warinng in the future.
# find date.timezone at the [date] section, uncomment and set it. for me it's Europe/Bucharest
# date.timezone = Europe/Bucharest
# find yours here: http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/timezone.html
vim /etc/php.ini

# Add port 80 to Firewall
sudo iptables -I INPUT -p tcp --dport 80 -j ACCEPT 
sudo service iptables save

# creating nagios log folder
mkdir -p /var/log/nagios

# add the line rocommunity public 127.0.0.1/32 to snmpd.conf
sed -i '$ a\rocommunity public 127.0.0.1/32' /etc/snmp/snmpd.conf
service snmpd start
chkconfig snmpd on
# enabling NTP couldn't hurt
chkconfig ntpd on 
ntpdate pool.ntp.org 
service ntpd start
# 

# Creating the nagios user
/usr/sbin/useradd -m nagios
/usr/sbin/usermod -L nagios

# Creating a group to be able to use external commands
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -G nagios,nagcmd nagios
/usr/sbin/usermod -G nagios,nagcmd apache

# Download & Compile
cd /usr/local/src/
wget -N http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.5.0.tar.gz
tar -xzf nagios-3.5.0.tar.gz
cd nagios

./configure --prefix=/usr/local/nagios --with-command-group=nagcmd --enable-nanosleep --enable-event-broker
make all
make install
make install-init
make install-commandmode
make install-config
chkconfig nagios on
service nagios start
#

#
cd /usr/local/src
wget -N http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.16/nagios-plugins-1.4.16.tar.gz

wget -N http://search.cpan.org/CPAN/authors/id/M/MS/MSCHWERN/ExtUtils-MakeMaker-6.64.tar.gz
tar -xzf ExtUtils-MakeMaker-6.64.tar.gz
cd ExtUtils-MakeMaker-6.64
perl Makefile.PL
make
make install

cd /usr/local/src
tar -xzf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16
./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl=/usr/bin/openssl --enable-perl-modules
make

# Test-Simple-0.70 fails to compile otherwise so have to do it manually first
cd ./perlmods/Test-Simple-0.70
perl Makefile.PL
make
make install

# go back to nagios-plugins to make install
cd ../..
make install
# 

#
cd /usr/local/src
wget -N http://sourceforge.net/projects/nagios/files/ndoutils-1.x/ndoutils-1.5.2/ndoutils-1.5.2.tar.gz
tar -zxvf ndoutils-1.5.2.tar.gz
cd ndoutils-1.5.2

# get the patch and apply it; wget to same folder as ndoutils
wget -N http://svn.centreon.com/trunk/ndoutils-patch/ndoutils1.5.2_light.patch
patch -p1 -N < ndoutils1.5.2_light.patch
# continue installation
./configure --prefix=/usr/local/nagios/ --enable-mysql --with-ndo2db-user=nagios --with-ndo2db-group=nagios
make

mkdir -p /usr/local/nagios/bin/
mkdir -p /usr/local/nagios/etc/ 

# After creating the binaries and libraries they have to be copied
cp -f ./src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o
cp -f ./src/ndo2db-3x /usr/local/nagios/bin/ndo2db
cp -f ./config/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg
cp -f ./config/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg
sudo chmod 774 /usr/local/nagios/bin/ndo*
sudo chown nagios:nagios /usr/local/nagios/bin/ndo*

# make ndo2db daemon autorun
cp -f ./daemon-init /etc/init.d/ndo2db
chmod +x /etc/init.d/ndo2db
chkconfig ndo2db on
#

## Add innodb_file_per_table=1 under the [mysqld] section in my.cnf
vim /etc/my.cnf

## then
service mysqld start
chkconfig mysqld on
# 

#
service httpd start
groupadd centreon
useradd -g centreon centreon
cd /usr/local/src/
wget http://download.centreon.com/index.php?id=4290

tar -zxf centreon-2.4.3.tar.gz
cd centreon-2.4.3
export PATH="$PATH:/usr/local/nagios/bin/"

# create an answer file with the following contents:
vim ./answer
#
./install.sh -f ./answer

# After installation configure SELinux
#yum -y install policycoreutils-python
#semanage fcontext -a -t httpd_sys_rw_content_t "/usr/local/centreon(/.*)?"
#restorecon -R /usr/local/centreon/
#semanage fcontext -a -t httpd_sys_rw_content_t "/etc/centreon(/.*)?"
#restorecon -R /etc/centreon
#semanage fcontext -a -t httpd_sys_rw_content_t "/usr/local/nagios/var/spool(/.*)?"
#semanage fcontext -a -t httpd_sys_content_t "/usr/local/nagios/share(/.*)?"
#restorecon -R /usr/local/nagios/
#semanage fcontext -a -t httpd_sys_content_t "/usr/share/php(/.*)?"
#restorecon -R /usr/share/php
#semanage fcontext -a -t httpd_sys_content_t "/usr/share/pear(/.*)?"
#restorecon -R /usr/share/pear

# give the correct permission
chown apache:apache /usr/local/centreon/GPL_LIB/SmartyCache/ -R

# disable selinux
setenforce 0

# Restart some services
service httpd restart
service ndo2db restart
service nagios restart
#

4. Настройка MySQL

# Setup MySQL
mysql -e "grant all on centreon.* to 'centreon'@localhost identified by 'centreon';"
mysql -e "grant all on centreon_storage.* to 'centreon'@localhost identified by 'centreon';"
mysql -e "grant all on centreon_status.* to 'centreon'@localhost identified by 'centreon';"
#

5. ответы

## CentWeb: Web front Centreon for Nagios
PROCESS_CENTREON_WWW=1
## CentStorage: Log and charts archiving.
PROCESS_CENTSTORAGE=1
## CentCore: Distributed Monitoring engine.
PROCESS_CENTCORE=1
## CentPlugins: Centreon Plugins for nagios
PROCESS_CENTREON_PLUGINS=1
## CentTraps: Centreon Snmp traps process for nagios
PROCESS_CENTREON_SNMP_TRAPS=1

#####################################################################
## Begin: Default variables
#####################################################################
## Your default variables
## $BASE_DIR is the centreon source directory
LOG_DIR="$BASE_DIR/log"
LOG_FILE="$LOG_DIR/install_centreon.log"

## Don't change values above unless you perfectly understand
## what you are doing.
## Centreon temporary directory to work
TMP_DIR="/tmp/centreon-setup"
## default snmp config directory
SNMP_ETC="/etc/snmp/"
## a list of pear modules require by Centreon
PEAR_MODULES_LIST="pear.lst"
#####################################################################
## End: Default variables
##################################################################


#####################################################################
## Begin: Centreon preferences
#####################################################################
## Above variables are necessary to run a silent install
## Where you want to install Centreon (Centreon root directory)
INSTALL_DIR_CENTREON="/usr/local/centreon"
## Centreon log files directory
CENTREON_LOG="/usr/local/centreon/log"
## Centreon config files
CENTREON_ETC="/etc/centreon"
## Where is your Centreon binaries directory ?
CENTREON_BINDIR="/usr/local/centreon/bin"
## Where is your Centreon data informations directory ?
CENTREON_DATADIR="/usr/local/centreon/data"
## Centreon generation config directory
##  filesGeneration and filesUpload
## Where is your Centreon generation_files directory ?
CENTREON_GENDIR="/usr/local/centreon"
## libraries temporary files directory
## Where is your Centreon variable library directory ?
CENTREON_VARLIB="/var/lib/centreon"
## Where is your CentPlugins Traps binary?
CENTPLUGINSTRAPS_BINDIR="/usr/local/centreon/bin"
## Where is the RRD perl module installed [RRDs.pm]
## ATTENTION: ON x64 SYSTEMS THE PATH IS LIB64 INSTEAD OF LIB
##               vv
RRD_PERL="/usr/lib64/perl5"
## What is the Centreon group ?
CENTREON_GROUP="centreon"
## What is the Centreon user ?
CENTREON_USER="centreon"
## What is the Monitoring engine user ?
MONITORINGENGINE_USER="nagios"
## What is the Monitoring engine group ?
MONITORINGENGINE_GROUP="nagios"
## What is the Monitoring engine log directory ?
MONITORINGENGINE_LOG="/usr/local/nagios/var"
## Where is your monitoring plugins (libexec) directory ?
PLUGIN_DIR="/usr/local/nagios/libexec"
## Path to sudoers file (optional)
## Where is sudo configuration file
SUDO_FILE="/etc/sudoers"
## What is the Monitoring engine init.d script ?
MONITORINGENGINE_INIT_SCRIPT="/etc/init.d/nagios"
## What is the Monitoring engine binary ?
MONITORINGENGINE_BINARY="/usr/local/nagios/bin/nagios"
## What is the Monitoring engine configuration directory ?
MONITORINGENGINE_ETC="/usr/local/nagios/etc"
## Where is the configuration directory for broker module ?
BROKER_ETC="/usr/local/nagios/etc"
## Where is the init script for broker module daemon ?
BROKER_INIT_SCRIPT="/etc/init.d/ndo2db"
## Do you want me to configure your sudo ? (WARNING)
FORCE_SUDO_CONF=1

#####################################################################
## Begin: Apache preferences
#####################################################################
## Apache configuration directory (optional)
#DIR_APACHE="/etc/apache"
## Apache local specific configuration directory (optional)
## Do you want to update Centreon Apache sub configuration file ?
# DIR_APACHE_CONF="/etc/apache/conf.d"
## Apache configuration file. Only file name. (optional)
#APACHE_CONF="apache.conf"
## Apache user (optional)
WEB_USER="apache"
## Apache group (optional)
WEB_GROUP="apache"
## Force apache reload (optional): set APACHE_RELOAD to 1
## Do you want to reload your Apache ?
APACHE_RELOAD=1
#####################################################################
## End: Apache preferences
#####################################################################


## Do you want me to install/upgrade your PEAR modules
PEAR_AUTOINST=1
## Centreon run dir (all .pid, .run, .lock)
## Where is your Centreon Run Dir directory?
CENTREON_RUNDIR="/var/run"

## path to centstorage binary
## Where is your CentStorage binary directory
CENTSTORAGE_BINDIR="/usr/local/centreon/bin"
## CentStorage RRDs directory (where .rrd files go)
## Where is your CentStorage RRD directory
CENTSTORAGE_RRD="/var/lib/centreon"
## Do you want me to install CentStorage init script ?
CENTSTORAGE_INSTALL_INIT=1
## Do you want me to install CentStorage run level ?
CENTSTORAGE_INSTALL_RUNLVL=1


## path to centcore binary
CENTCORE_BINDIR="usr/local/centreon/bin"
## force install init script (install in init.d)
## Set to "1" to enable
## Do you want me to install CentCore init script ?
CENTCORE_INSTALL_INIT=1
## force install run level for init script (add all link on rcX.d)
## Set to "1" to enable
## Do you want me to install CentCore run level
CENTCORE_INSTALL_RUNLVL=1

## Some plugins require temporary datas to process output.
## These temp datas are store in the CENTPLUGINS_TMP path.
## Where is your CentPlugins lib directory
CENTPLUGINS_TMP="/var/lib/centreon/centplugins"

## path for snmptt installation
SNMPTT_BINDIR="/usr/local/centreon/bin/"
## What is the Broker user ? (optional)
BROKER_USER=$MONITORINGENGINE_USER

## Nagios user (optional)
NAGIOS_USER="nagios"
## Nagios group (optional)
NAGIOS_GROUP="nagios"
## Centreon Connector PATH
## Mail (optional)
BIN_MAIL="/bin/mail"
##
0

Возможно, ваша проблема была в том, что SELinux был включен. Попробуйте отключить это.

# setenforce permissive

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .