forked from zeysh/centreon-install
-
Notifications
You must be signed in to change notification settings - Fork 1
/
centreon.sh
673 lines (567 loc) · 20.9 KB
/
centreon.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
#!/bin/bash
# Centreon + engine install script for Debian Wheezy
# Source https://github.com/zeysh/centreon-install
# Thanks to Eric http://eric.coquard.free.fr
#
# Variables
## Versions
CLIB_VER="1.4.0"
CONNECTOR_VER="1.0.3"
ENGINE_VER="1.4.6"
PLUGIN_VER="2.0.3"
BROKER_VER="2.6.3"
CENTREON_VER="2.5.2"
CLAPI_VER="1.6.1"
# MariaDB Series
MARIADB_VER='5.5'
## Sources URL
CLIB_URL="http://download.centreon.com/index.php?id=4318"
CONNECTOR_URL="http://download.centreon.com/index.php?id=4317"
ENGINE_URL="http://download.centreon.com/index.php?id=4322"
PLUGIN_URL="http://www.nagios-plugins.org/download/nagios-plugins-${PLUGIN_VER}.tar.gz"
BROKER_URL="http://download.centreon.com/index.php?id=4323"
CENTREON_URL="http://download.centreon.com/index.php?id=4320"
CLAPI_URL="http://download.centreon.com/index.php?id=4596"
## Sources widgets
WIDGET_VER="1.0.0"
WIDGET_HOST_VER="1.1.2"
WIDGET_HOSTGROUP_VER="1.1.1"
WIDGET_SERVICE_VER="1.1.2"
WIDGET_SERVICEGROUP_VER="1.1.0"
WIDGET="https://forge.centreon.com/attachments/download/1508/centreon-widgets-${WIDGET_VER}.tar.gz"
WIDGET_HOST="http://download.centreon.com/centreon-widgets/centreon-widget-host-monitoring/centreon-widget-host-monitoring-${WIDGET_HOST_VER}.tar.gz"
WIDGET_HOSTGROUP="http://download.centreon.com/centreon-widgets/centreon-widget-hostgroup-monitoring/centreon-widget-hostgroup-monitoring-${WIDGET_HOSTGROUP_VER}.tar.gz"
WIDGET_SERVICE="http://download.centreon.com/centreon-widgets/centreon-widget-service-monitoring/centreon-widget-service-monitoring-${WIDGET_SERVICE_VER}.tar.gz"
WIDGET_SERVICEGROUP="http://download.centreon.com/centreon-widgets/centreon-widget-servicegroup-monitoring/centreon-widget-servicegroup-monitoring-${WIDGET_SERVICEGROUP_VER}.tar.gz"
## Temp install dir
DL_DIR="/usr/local/src"
## Install dir
INSTALL_DIR="/usr/local"
## Log install file
INSTALL_LOG="/usr/local/src/centreon-install.log"
## Set mysql-server root password
MYSQL_PASSWORD="password"
## Users and groups
ENGINE_USER="centreon-engine"
ENGINE_GROUP="centreon-engine"
BROKER_USER="centreon-broker"
BROKER_GROUP="centreon-broker"
CENTREON_USER="centreon"
CENTREON_GROUP="centreon"
## TMPL file (template install file for Centreon)
CENTREON_TMPL="centreon_engine.tmpl"
ETH0_IP=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
function text_params () {
ESC_SEQ="\x1b["
bold=`tput bold`
normal=`tput sgr0`
COL_RESET=$ESC_SEQ"39;49;00m"
COL_GREEN=$ESC_SEQ"32;01m"
COL_RED=$ESC_SEQ"31;01m"
STATUS_FAIL="[$COL_RED${bold}FAIL${normal}$COL_RESET]"
STATUS_OK="[$COL_GREEN${bold} OK ${normal}$COL_RESET]"
}
function mariadb_install() {
echo "
======================================================================
Install MariaDB
======================================================================
"
DISTRO=`lsb_release -i -s | tr '[:upper:]' '[:lower:]'`
RELEASE=`lsb_release -c -s`
apt-get install -y lsb-release python-software-properties
MIRROR_DOMAIN='ftp.igh.cnrs.fr'
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
add-apt-repository "deb http://${MIRROR_DOMAIN}/pub/mariadb/repo/${MARIADB_VER}/${DISTRO} ${RELEASE} main"
apt-get update
# Pin repository in order to avoid conflicts with MySQL from distribution
# repository. See https://mariadb.com/kb/en/installing-mariadb-deb-files
# section "Version Mismatch Between MariaDB and Ubuntu/Debian Repositories"
echo "
Package: *
Pin: origin ${MIRROR_DOMAIN}
Pin-Priority: 1000
" | tee /etc/apt/preferences.d/mariadb
debconf-set-selections <<< "mariadb-server-${MARIADB_VER} mysql-server/root_password password ${MYSQL_PASSWORD}"
debconf-set-selections <<< "mariadb-server-${MARIADB_VER} mysql-server/root_password_again password ${MYSQL_PASSWORD}"
apt-get install --force-yes -y mariadb-server
}
function php3_install () {
echo "
======================================================================
Add Squeeze repo for php 5.3 on Wheezy
At the moment Centreon doesn't support PHP 5.4
======================================================================
"
echo 'deb http://ftp.fr.debian.org/debian/ squeeze main non-free
deb-src http://ftp.fr.debian.org/debian/ squeeze main non-free
deb http://security.debian.org/ squeeze/updates main non-free
deb-src http://security.debian.org/ squeeze/updates main non-free' > /etc/apt/sources.list.d/squeeze.list
# Fix version PHP5.3 on Wheezy
echo 'Package: php5*
Pin: release a=oldstable
Pin-Priority: 700
Package: libapache2-mod-php5
Pin: release a=oldstable
Pin-Priority: 700
Package: php-pear
Pin: release a=oldstable
Pin-Priority: 700
Package: *
Pin: release a=stable
Pin-Priority: 600' > /etc/apt/preferences.d/preferences
apt-get update
}
function clib_install () {
echo "
======================================================================
Install Clib
======================================================================
"
apt-get install -y build-essential cmake
cd ${DL_DIR}
if [[ -e centreon-clib-${CLIB_VER}.tar.gz ]] ;
then
echo 'File already exist !'
else
wget ${CLIB_URL} -O ${DL_DIR}/centreon-clib-${CLIB_VER}.tar.gz
fi
tar xzf centreon-clib-${CLIB_VER}.tar.gz
cd centreon-clib-${CLIB_VER}/build
cmake \
-DWITH_TESTING=0 \
-DWITH_PREFIX=${INSTALL_DIR}/centreon-lib \
-DWITH_SHARED_LIB=1 \
-DWITH_STATIC_LIB=0 \
-DWITH_PKGCONFIG_DIR=/usr/lib/pkgconfig .
make
make install
echo "${INSTALL_DIR}/centreon-lib/lib" >> /etc/ld.so.conf.d/libc.conf
}
function centreon_connectors_install () {
echo "
======================================================================
Install Centreon Perl and SSH connectors
======================================================================
"
apt-get install -y libperl-dev
cd ${DL_DIR}
if [[ -e centreon-connector-${CONNECTOR_VER}.tar.gz ]]
then
echo 'File already exist !'
else
wget ${CONNECTOR_URL} -O ${DL_DIR}/centreon-connector-${CONNECTOR_VER}.tar.gz
fi
tar xzf centreon-connector-${CONNECTOR_VER}.tar.gz
cd ${DL_DIR}/centreon-connector-${CONNECTOR_VER}/perl/build
cmake \
-DWITH_PREFIX=${INSTALL_DIR}/centreon-connector \
-DWITH_CENTREON_CLIB_INCLUDE_DIR=${INSTALL_DIR}/centreon-lib/include \
-DWITH_CENTREON_CLIB_LIBRARIES=${INSTALL_DIR}/centreon-lib/lib/libcentreon_clib.so \
-DWITH_TESTING=0 .
make
make install
# install Centreon SSH Connector
apt-get install -y libssh2-1-dev libgcrypt11-dev
# Cleanup to prevent space full on /var
apt-get clean
cd ${DL_DIR}/centreon-connector-${CONNECTOR_VER}/ssh/build
cmake \
-DWITH_PREFIX=${INSTALL_DIR}/centreon-connector \
-DWITH_CENTREON_CLIB_INCLUDE_DIR=${INSTALL_DIR}/centreon-lib/include \
-DWITH_CENTREON_CLIB_LIBRARIES=${INSTALL_DIR}/centreon-lib/lib/libcentreon_clib.so \
-DWITH_TESTING=0 .
make
make install
}
function centreon_engine_install () {
echo "
======================================================================
Install Centreon Engine
======================================================================
"
groupadd -g 6001 ${ENGINE_GROUP}
useradd -u 6001 -g ${ENGINE_GROUP} -m -r -d /var/lib/centreon-engine -c "Centreon-engine Admin" ${ENGINE_USER}
apt-get install -y libcgsi-gsoap-dev zlib1g-dev libssl-dev libxerces-c-dev
# Cleanup to prevent space full on /var
apt-get clean
cd ${DL_DIR}
if [[ -e centreon-engine-${ENGINE_VER}.tar.gz ]]
then
echo 'File already exist !'
else
wget ${ENGINE_URL} -O ${DL_DIR}/centreon-engine-${ENGINE_VER}.tar.gz
fi
tar xzf centreon-engine-${ENGINE_VER}.tar.gz
cd ${DL_DIR}/centreon-engine-${ENGINE_VER}/build
cmake \
-DWITH_CENTREON_CLIB_INCLUDE_DIR=${INSTALL_DIR}/centreon-lib/include \
-DWITH_CENTREON_CLIB_LIBRARY_DIR=${INSTALL_DIR}/centreon-lib/lib \
-DWITH_PREFIX=${INSTALL_DIR}/centreon-engine \
-DWITH_USER=${ENGINE_USER} \
-DWITH_GROUP=${ENGINE_GROUP} \
-DWITH_LOGROTATE_SCRIPT=1 \
-DWITH_VAR_DIR=/var/log/centreon-engine \
-DWITH_RW_DIR=/var/lib/centreon-engine/rw \
-DWITH_STARTUP_DIR=/etc/init.d \
-DWITH_PKGCONFIG_SCRIPT=1 \
-DWITH_PKGCONFIG_DIR=/usr/lib/pkgconfig \
-DWITH_TESTING=0 \
-DWITH_WEBSERVICE=1 .
make
make install
chmod +x /etc/init.d/centengine
update-rc.d centengine defaults
}
function nagios_plugin_install () {
echo "
======================================================================
Install Plugins Nagios
======================================================================
"
apt-get install --force-yes -y libgnutls-dev libssl-dev libkrb5-dev libldap2-dev libsnmp-dev gawk \
libwrap0-dev libmcrypt-dev smbclient fping gettext dnsutils libmariadbclient-dev \
libnet-snmp-perl
# Cleanup to prevent space full on /var
apt-get clean
cd ${DL_DIR}
if [[ -e nagios-plugins-${PLUGIN_VER}.tar.gz ]]
then
echo 'File already exist !'
else
wget ${PLUGIN_URL} -O ${DL_DIR}/nagios-plugins-${PLUGIN_VER}.tar.gz
fi
tar xzf nagios-plugins-${PLUGIN_VER}.tar.gz
cd ${DL_DIR}/nagios-plugins-${PLUGIN_VER}
./configure --with-nagios-user=${ENGINE_USER} --with-nagios-group=${ENGINE_GROUP} \
--prefix=${INSTALL_DIR}/centreon-plugins --enable-perl-modules --with-openssl=/usr/bin/openssl \
--enable-extra-opts
make
make install
}
function centreon_broker_install() {
echo "
======================================================================
Install Centreon Broker
======================================================================
"
groupadd -g 6002 ${BROKER_GROUP}
useradd -u 6002 -g ${BROKER_GROUP} -m -r -d /var/lib/centreon-broker -c "Centreon-broker Admin" ${BROKER_USER}
usermod -aG ${BROKER_GROUP} ${ENGINE_USER}
apt-get install -y librrd-dev libqt4-dev libqt4-sql-mysql
# Cleanup to prevent space full on /var
apt-get clean
cd ${DL_DIR}
if [[ -e centreon-broker-2.5.0.tar.gz ]]
then
echo 'File already exist !'
else
wget ${BROKER_URL} -O ${DL_DIR}/centreon-broker-${BROKER_VER}.tar.gz
fi
if [[ -d /var/log/centreon-broker ]]
then
echo "Directory already exist!"
else
mkdir /var/log/centreon-broker
chown ${BROKER_USER}:${ENGINE_GROUP} /var/log/centreon-broker
chmod 775 /var/log/centreon-broker
fi
tar xzf centreon-broker-${BROKER_VER}.tar.gz
cd ${DL_DIR}/centreon-broker-${BROKER_VER}/build/
cmake \
-DWITH_DAEMONS='central-broker;central-rrd' \
-DWITH_GROUP=${BROKER_GROUP} \
-DWITH_PREFIX=${INSTALL_DIR}/centreon-broker \
-DWITH_STARTUP_DIR=/etc/init.d \
-DWITH_STARTUP_SCRIPT=auto \
-DWITH_TESTING=0 \
-DWITH_USER=${BROKER_USER} .
make
make install
update-rc.d cbd defaults
# Cleanup to prevent space full on /var
apt-get clean
}
function create_centreon_tmpl() {
echo "
======================================================================
Centreon template generation
======================================================================
"
cat > ${DL_DIR}/${CENTREON_TMPL} << EOF
#Centreon template
PROCESS_CENTREON_WWW=1
PROCESS_CENTSTORAGE=1
PROCESS_CENTCORE=1
PROCESS_CENTREON_PLUGINS=1
PROCESS_CENTREON_SNMP_TRAPS=1
LOG_DIR="$BASE_DIR/log"
LOG_FILE="$LOG_DIR/install_centreon.log"
TMPDIR="/tmp/centreon-setup"
SNMP_ETC="/etc/snmp/"
PEAR_MODULES_LIST="pear.lst"
PEAR_AUTOINST=1
INSTALL_DIR_CENTREON="${INSTALL_DIR}/centreon"
CENTREON_BINDIR="${INSTALL_DIR}/centreon/bin"
CENTREON_DATADIR="${INSTALL_DIR}/centreon/data"
CENTREON_USER=${CENTREON_USER}
CENTREON_GROUP=${CENTREON_GROUP}
PLUGIN_DIR="${INSTALL_DIR}/centreon-plugins/libexec"
CENTREON_LOG="/var/log/centreon"
CENTREON_ETC="/etc/centreon"
CENTREON_RUNDIR="/var/run/centreon"
CENTREON_GENDIR="/var/cache/centreon"
CENTSTORAGE_RRD="/var/lib/centreon"
CENTSTORAGE_BINDIR="${INSTALL_DIR}/centreon/bin"
CENTCORE_BINDIR="${INSTALL_DIR}/centreon/bin"
CENTREON_VARLIB="/var/lib/centreon"
CENTPLUGINS_TMP="/var/lib/centreon/centplugins"
CENTPLUGINSTRAPS_BINDIR="${INSTALL_DIR}/centreon/bin"
SNMPTT_BINDIR="${INSTALL_DIR}/centreon/bin"
CENTCORE_INSTALL_INIT=1
CENTCORE_INSTALL_RUNLVL=1
CENTSTORAGE_INSTALL_INIT=0
CENTSTORAGE_INSTALL_RUNLVL=0
CENTREONTRAPD_BINDIR="${INSTALL_DIR}/centreon/bin"
CENTREONTRAPD_INSTALL_INIT=1
CENTREONTRAPD_INSTALL_RUNLVL=1
INSTALL_DIR_NAGIOS="${INSTALL_DIR}/centreon-engine"
CENTREON_ENGINE_USER="${ENGINE_USER}"
MONITORINGENGINE_USER="${CENTREON_USER}"
MONITORINGENGINE_LOG="/var/log/centreon-engine"
MONITORINGENGINE_INIT_SCRIPT="/etc/init.d/centengine"
MONITORINGENGINE_BINARY="${INSTALL_DIR}/centreon-engine/bin/centengine"
MONITORINGENGINE_ETC="${INSTALL_DIR}/centreon-engine/etc"
NAGIOS_PLUGIN="${INSTALL_DIR}/centreon-plugins/libexec"
FORCE_NAGIOS_USER=1
NAGIOS_GROUP="${CENTREON_USER}"
FORCE_NAGIOS_GROUP=1
NDOMOD_BINARY="${INSTALL_DIR}/centreon-broker/bin/cbd"
NDO2DB_BINARY="${INSTALL_DIR}/centreon-broker/bin/cbd"
NAGIOS_INIT_SCRIPT="/etc/init.d/centengine"
CENTREON_ENGINE_CONNECTORS="/usr/lib/centreon-connector"
BROKER_USER="${BROKER_USER}"
BROKER_ETC="${INSTALL_DIR}/centreon-broker/etc"
BROKER_INIT_SCRIPT="/etc/init.d/cbd"
BROKER_LOG="/var/log/centreon-broker"
DIR_APACHE="/etc/apache2"
DIR_APACHE_CONF="/etc/apache2/conf.d"
APACHE_CONF="apache.conf"
WEB_USER="www-data"
WEB_GROUP="www-data"
APACHE_RELOAD=1
BIN_RRDTOOL="/usr/bin/rrdtool"
BIN_MAIL="/usr/bin/mail"
BIN_SSH="/usr/bin/ssh"
BIN_SCP="/usr/bin/scp"
PHP_BIN="/usr/bin/php"
GREP="/bin/grep"
CAT="/bin/cat"
SED="/bin/sed"
CHMOD="/bin/chmod"
CHOWN="/bin/chown"
RRD_PERL="/usr/lib/perl5"
SUDO_FILE="/etc/sudoers"
FORCE_SUDO_CONF=1
INIT_D="/etc/init.d"
CRON_D="/etc/cron.d"
PEAR_PATH="/usr/share/php"
EOF
}
function centreon_install () {
echo "
======================================================================
Install Centreon Web Interface
======================================================================
"
DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes bsd-mailx \
apache2 php5-mysql rrdtool librrds-perl tofrodos php5 php-pear php5-ldap php5-snmp \
php5-gd libconfig-inifiles-perl libcrypt-des-perl libdigest-hmac-perl libgd-gd2-perl \
snmp snmpd snmp-mibs-downloader sudo libdigest-sha-perl php5-sqlite
# Cleanup to prevent space full on /var
apt-get clean
# MIBS errors
if [[ -d /root/mibs_removed ]]
then
echo 'MIBS already moved !'
else
mkdir /root/mibs_removed
mv /usr/share/mibs/ietf/IPATM-IPMC-MIB /root/mibs_removed
mv /usr/share/mibs/ietf/SNMPv2-PDU /root/mibs_removed
mv /usr/share/mibs/ietf/IPSEC-SPD-MIB /root/mibs_removed
mv /usr/share/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB /root/mibs_removed
fi
cd ${DL_DIR}
if [[ -e centreon-${CENTREON_VER}.tar.gz ]]
then
echo 'File already exist!'
else
wget ${CENTREON_URL} -O ${DL_DIR}/centreon-${CENTREON_VER}.tar.gz
fi
groupadd -g 6003 ${CENTREON_GROUP}
useradd -u 6003 -g ${CENTREON_GROUP} -m -r -d ${INSTALL_DIR}/centreon -c "Centreon Web user" ${CENTREON_USER}
usermod -aG ${CENTREON_GROUP} ${ENGINE_USER}
tar xzf centreon-${CENTREON_VER}.tar.gz
cd ${DL_DIR}/centreon-${CENTREON_VER}
echo " Generate Centreon template "
./install.sh -i -f ${DL_DIR}/${CENTREON_TMPL}
}
function post_install () {
echo "
=====================================================================
Post install
=====================================================================
"
# Add mysql config for Centreon
echo '[mysqld]
innodb_file_per_table=1' > /etc/mysql/conf.d/innodb.cnf
service mysql restart
service cbd restart
service centcore restart
service centengine restart
service centreontrapd restart
## Workarounds
## config: cannot open '/var/lib/centreon-broker/module-temporary.tmp-1-central-module-output-master-failover'
## (mode w+): Permission denied)
chmod 775 /var/lib/centreon-broker/
## drwxr-xr-x 3 root root 15 Feb 4 20:31 centreon-engine
chown ${ENGINE_USER}:${ENGINE_GROUP} /var/lib/centreon-engine/
}
##ADDONS
function clapi_install () {
echo "
=======================================================================
Install CLAPI
=======================================================================
"
cd ${DL_DIR}
if [[ -e ${DL_DIR}/centreon-clapi-${CLAPI_VER}.tar.gz ]]
then
echo 'File already exist!'
else
wget ${CLAPI_URL} -O ${DL_DIR}/centreon-clapi-${CLAPI_VER}.tar.gz
tar xzf ${DL_DIR}/centreon-clapi-${CLAPI_VER}.tar.gz
fi
cd ${DL_DIR}/centreon-clapi-${CLAPI_VER}
CENTREON_CONF=${CENTREON_ETC} || ./install.sh -i
}
function widget_install() {
echo "
=======================================================================
Install WIDGETS
=======================================================================
"
cd ${DL_DIR}
wget -qO- ${WIDGET} | tar -C ${INSTALL_DIR}/centreon/www/widgets -xvz
wget -qO- ${WIDGET_HOST} | tar -C ${INSTALL_DIR}/centreon/www/widgets -xzv
wget -qO- ${WIDGET_HOSTGROUP} | tar -C ${INSTALL_DIR}/centreon/www/widgets -xzv
wget -qO- ${WIDGET_SERVICE} | tar -C ${INSTALL_DIR}/centreon/www/widgets -xzv
wget -qO- ${WIDGET_SERVICEGROUP} | tar -C ${INSTALL_DIR}/centreon/www/widgets -xzv
}
function main () {
echo "
=======================| Install details |============================
MariaDB : ${MARIADB_VER}
Clib : ${CLIB_VER}
Connector : ${CONNECTOR_VER}
Engine : ${ENGINE_VER}
Plugin : ${PLUGIN_VER}
Broker : ${BROKER_VER}
Centreon : ${CENTREON_VER}
Install dir: ${INSTALL_DIR}
Source dir : ${DL_DIR}
======================================================================
"
text_params
mariadb_install > ${INSTALL_LOG} 2>&1
if [[ $? -ne 0 ]];
then
echo -e "${bold}Step1${normal} => Install MariaDB ${STATUS_FAIL}"
else
echo -e "${bold}Step1${normal} => Install MariaDB ${STATUS_OK}"
fi
php3_install >> ${INSTALL_LOG} 2>&1
if [[ $? -ne 0 ]];
then
echo -e "${bold}Step2${normal} => Install PHP3 on Wheezy ${STATUS_FAIL}"
else
echo -e "${bold}Step2${normal} => Install PHP3 on Wheezy ${STATUS_OK}"
fi
clib_install >> ${INSTALL_LOG} 2>&1
if [[ $? -ne 0 ]];
then
echo -e "${bold}Step3${normal} => Clib install ${STATUS_FAIL}"
else
echo -e "${bold}Step3${normal} => Clib install ${STATUS_OK}"
fi
centreon_connectors_install >> ${INSTALL_LOG} 2>&1
if [[ $? -ne 0 ]];
then
echo -e "${bold}Step4${normal} => Centreon Perl and SSH connectors install ${STATUS_FAIL}"
else
echo -e "${bold}Step4${normal} => Centreon Perl and SSH connectors install ${STATUS_OK}"
fi
centreon_engine_install >> ${INSTALL_LOG} 2>&1
if [[ $? -ne 0 ]];
then
echo -e "${bold}Step5${normal} => Centreon Engine install ${STATUS_FAIL}"
else
echo -e "${bold}Step5${normal} => Centreon Engine install ${STATUS_OK}"
fi
nagios_plugin_install >> ${INSTALL_LOG} 2>&1
if [[ $? -ne 0 ]];
then
echo -e "${bold}Step6${normal} => Nagios plugins install ${STATUS_FAIL}"
else
echo -e "${bold}Step6${normal} => Nagios plugins install ${STATUS_OK}"
fi
centreon_broker_install >> ${INSTALL_LOG} 2>&1
if [[ $? -ne 0 ]];
then
echo -e "${bold}Step7${normal} => Centreon Broker install ${STATUS_FAIL}"
else
echo -e "${bold}Step7${normal} => Centreon Broker install ${STATUS_OK}"
fi
create_centreon_tmpl >> ${INSTALL_LOG} 2>&1
if [[ $? -ne 0 ]];
then
echo -e "${bold}Step8${normal} => Centreon template generation ${STATUS_FAIL}"
else
echo -e "${bold}Step8${normal} => Centreon template generation ${STATUS_OK}"
fi
centreon_install >> ${INSTALL_LOG} 2>&1
if [[ $? -ne 0 ]];
then
echo -e "${bold}Step9${normal} => Centreon web interface install ${STATUS_FAIL}"
else
echo -e "${bold}Step9${normal} => Centreon web interface install ${STATUS_OK}"
fi
post_install >> ${INSTALL_LOG} 2>&1
if [[ $? -ne 0 ]];
then
echo -e "${bold}Step10${normal} => Post install ${STATUS_FAIL}"
else
echo -e "${bold}Step10${normal} => Post install ${STATUS_OK}"
fi
clapi_install >> ${INSTALL_LOG} 2>&1
if [[ $? -ne 0 ]];
then
echo -e "${bold}Step11${normal} => CLAPI install ${STATUS_FAIL}"
else
echo -e "${bold}Step11${normal} => CLAPI install ${STATUS_OK}"
fi
widget_install >> ${INSTALL_LOG} 2>&1
if [[ $? -ne 0 ]];
then
echo -e "${bold}Step12${normal} => Widgets install ${STATUS_FAIL}"
else
echo -e "${bold}Step12${normal} => Widgets install ${STATUS_OK}"
fi
echo ""
echo "##### Install completed #####" >> ${INSTALL_LOG} 2>&1
}
# Exec main function
main
echo -e ""
echo -e "${bold}Go to http://${ETH0_IP}/centreon to complete the setup${normal} "
echo -e ""