My linux world » Centreon

Centreon


Contents

Prerequisites

I assume that you have a Centos installation

Installation

build and configure all modules

You can copy/paste this script and use it to configure automatically your server.

  1. #!/bin/bash
  2.  
  3. ##################################################
  4. # DEFINES
  5. ##################################################
  6. # all version are available here : https://download.centreon.com/
  7.  
  8. # tab "Centreon Core"
  9. CENTREON_ENGINE_VERSION=1.5.1
  10. CENTREON_BROKER_VERSION=2.11.5
  11. CENTREON_CONNECTOR_VERSION=1.1.2
  12. CENTREON_CLIB_VERSION=1.4.2
  13.  
  14. # tab "Centreon Web"
  15. CENTREON_WEB_VERSION=2.7.7
  16.  
  17. # current directory
  18. BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  19.  
  20. ##################################################
  21. # PREREQUISTES
  22. ##################################################
  23.  
  24. # cmake, gcc
  25. dnf -y install cmake make gcc gcc-c++
  26.  
  27. # qt
  28. dnf -y install qt qt-devel
  29.  
  30. # librrd
  31. dnf -y install rrdtool rrdtool-devel
  32.  
  33. # gnutls
  34. dnf -y install gnutls-devel
  35.  
  36. # perl
  37. dnf -y install perl-devel perl-ExtUtils-Embed
  38.  
  39. # mail
  40. dnf -y install mailx
  41.  
  42. # php
  43. dnf -y install php php-pear php-ldap php-intl
  44.  
  45. # snmp
  46. dnf -y install net-snmp
  47.  
  48. echo "create users abd groups"
  49. groupadd centreon
  50. useradd -g centreon centreon
  51. useradd -g centreon centreon-engine
  52. useradd -g centreon centreon-broker
  53.  
  54. ##################################################
  55. # CENTREON BROKER
  56. ##################################################
  57. echo "create required folders"
  58. mkdir -p /var/log/centreon-broker
  59. mkdir -p /etc/centreon-broker
  60. chown centreon-broker: /var/log/centreon-broker/ -R
  61. chown centreon-broker: /etc/centreon-broker/ -R
  62. chmod 775 /var/log/centreon-broker/ -R
  63. chmod 775 /etc/centreon-broker/ -R
  64.  
  65. echo "download and build centreon broker"
  66. cd /tmp
  67. wget https://s3-eu-west-1.amazonaws.com/centreon-download/public/centreon-broker/centreon-broker-$CENTREON_BROKER_VERSION.tar.gz
  68. tar -xvf centreon-broker-$CENTREON_BROKER_VERSION.tar.gz
  69. rm -f centreon-broker-$CENTREON_BROKER_VERSION.tar.gz
  70. cd centreon-broker-$CENTREON_BROKER_VERSION/build
  71. cmake \
  72. -DWITH_STARTUP_DIR=/etc/init.d \
  73. -DWITH_PREFIX_CONF=/etc/centreon-broker \
  74. -DWITH_PREFIX_LIB=/usr/lib64/nagios \
  75. -DWITH_PREFIX_MODULES=/usr/share/centreon/lib/centreon-broker \
  76. .
  77. make
  78. make install
  79.  
  80. # hack under centos 7 ("make install" does not create "cdb" service)
  81. if [ ! -f /etc/init.d/cdb ]; then
  82. cp $BASEDIR/cdb /etc/init.d
  83. chmod +x /etc/init.d/cdb
  84. fi
  85.  
  86.  
  87. ##################################################
  88. # CENTREON CONNECTOR
  89. ##################################################
  90. echo "download and build centreon connector"
  91. cd /tmp
  92. wget https://s3-eu-west-1.amazonaws.com/centreon-download/public/centreon-connectors/centreon-connector-$CENTREON_CONNECTOR_VERSION.tar.gz
  93. tar -xvf centreon-connector-$CENTREON_CONNECTOR_VERSION.tar.gz
  94. rm -f centreon-connector-$CENTREON_CONNECTOR_VERSION.tar.gz
  95. cd centreon-connector-$CENTREON_CONNECTOR_VERSION/perl/build
  96. cmake \
  97. -DWITH_PREFIX_BINARY=/usr/lib64/centreon-connector \
  98. .
  99. make -j 4
  100. make install
  101.  
  102. ##################################################
  103. # CENTREON CLIB
  104. ##################################################
  105. echo "download and build centreon clib"
  106. cd /tmp
  107. wget https://s3-eu-west-1.amazonaws.com/centreon-download/public/centreon-clib/centreon-clib-$CENTREON_CLIB_VERSION.tar.gz
  108. tar -xvf centreon-clib-$CENTREON_CLIB_VERSION.tar.gz
  109. rm -f centreon-clib-$CENTREON_CLIB_VERSION.tar.gz
  110. cd centreon-clib-$CENTREON_CLIB_VERSION/build
  111. cmake .
  112. make
  113. make install
  114. ln -s /usr/local/lib/libcentreon_clib.so /lib64/libcentreon_clib.so
  115.  
  116. ##################################################
  117. # CENTREON ENGINE
  118. ##################################################
  119. echo "create required folders"
  120. mkdir -p /var/log/centreon-engine
  121. mkdir -p /etc/centreon-engine
  122. chown centreon-engine: /var/log/centreon-engine/ -R
  123. chown centreon-engine: /etc/centreon-engine/ -R
  124. chmod 775 /var/log/centreon-engine/ -R
  125. chmod 775 /etc/centreon-engine/ -R
  126.  
  127. echo "download and build centreon engine"
  128. cd /tmp
  129. wget https://s3-eu-west-1.amazonaws.com/centreon-download/public/centreon-engine/centreon-engine-$CENTREON_ENGINE_VERSION.tar.gz
  130. tar -xvf centreon-engine-$CENTREON_ENGINE_VERSION.tar.gz
  131. rm -f centreon-engine-$CENTREON_ENGINE_VERSION.tar.gz
  132. cd centreon-engine-$CENTREON_ENGINE_VERSION/build
  133. cmake \
  134. -DWITH_PREFIX_BIN=/usr/sbin \
  135. -DWITH_RW_DIR=/var/lib64/centreon-engine/rw \
  136. -DWITH_PREFIX_LIB=/usr/lib64/centreon-engine \
  137. .
  138. make
  139. make install
  140.  
  141. ##################################################
  142. # CENTREON WEB
  143. ##################################################
  144. cd /tmp
  145. wget https://s3-eu-west-1.amazonaws.com/centreon-download/public/centreon/centreon-web-$CENTREON_WEB_VERSION.tar.gz
  146. tar -xvf centreon-web-$CENTREON_WEB_VERSION.tar.gz
  147. rm -f centreon/centreon-web-$CENTREON_WEB_VERSION.tar.gz
  148. cd centreon-web-$CENTREON_WEB_VERSION
  149.  
  150. # install centreon web :
  151. dos2unix $BASEDIR/centreon-response.txt
  152. ./install.sh -f $BASEDIR/centreon-response.txt
  153.  
  154.  
  155. ##################################################
  156. # POST INSTALLATION CONFIGURATION
  157. ##################################################
  158.  
  159. echo "configure apache for apache 2.4"
  160. cat > /etc/httpd/conf.d/centreon.conf << "EOF"
  161. Alias /centreon /usr/local/centreon/www/
  162. <Directory "/usr/local/centreon/www">
  163. Options Indexes
  164. AllowOverride AuthConfig Options
  165. Require all granted
  166. </Directory>
  167. EOF
  168.  
  169. echo "configure default timezone in php.ini"
  170. sed -i "s/^;\(date.timezone =\).*/\1Europe\/Paris/g" /etc/php.ini
  171.  
  172. echo "enable write to SmartyCache directory"
  173. chown centreon: /usr/local/centreon/GPL_LIB/SmartyCache/ -R
  174.  
  175. echo "restart httpd"
  176. systemctl restart httpd
  177.  
  178. echo "add option 'innodb_file_per_table=1' to /etc/my.cnf"
  179. if ! grep -q innodb_file_per_table=1 /etc/my.cnf; then
  180. sed -i 's/\(\[mysqld\]\)/\1\ninnodb_file_per_table=1/' /etc/my.cnf
  181. systemctl restart mariadb.service
  182. fi;
  183.  
  184. echo "create databases and grant amm privileges to user/password centreon/centreon":
  185. mysql --user=root --password=root -e "CREATE USER 'centreon'@'localhost' IDENTIFIED BY 'centreon';"
  186. mysql --user=root --password=root -e "CREATE DATABASE IF NOT EXISTS centreon;"
  187. mysql --user=root --password=root -e "use centreon; GRANT ALL PRIVILEGES ON centreon.* TO 'centreon'@'localhost' WITH GRANT OPTION;"
  188.  
  189. mysql --user=root --password=root -e "CREATE DATABASE IF NOT EXISTS centreon_status;"
  190. mysql --user=root --password=root -e "use centreon_status; GRANT ALL PRIVILEGES ON centreon_status.* TO 'centreon'@'localhost' WITH GRANT OPTION;"
  191.  
  192. ## meet you
  193. myip=`hostname -I`
  194. echo "Now meet you here: http://$myip/centreon/"

reponse file

  1. #########################################################################
  2. # Please choose what you want to install
  3. #########################################################################
  4.  
  5. # Do you want to install : Centreon Web Front
  6. PROCESS_CENTREON_WWW=1
  7.  
  8. #Do you want to install : Centreon CentCore
  9. PROCESS_CENTCORE=1
  10.  
  11. #Do you want to install : Centreon Nagios Plugins
  12. PROCESS_CENTREON_PLUGINS=1
  13.  
  14. #Do you want to install : CentreonTrapd process
  15. PROCESS_CENTREON_SNMP_TRAPS=1
  16.  
  17. # CentStorage ?
  18. PROCESS_CENTSTORAGE=1
  19.  
  20. ########################################################################
  21. # Start CentWeb Installation
  22. ########################################################################
  23.  
  24. # Where is mail binary
  25. BIN_MAIL=/usr/bin/mail
  26.  
  27. ################# INSTALLATION PATHS
  28.  
  29. # Where is your Centreon directory?
  30. INSTALL_DIR_CENTREON=/usr/local/centreon
  31.  
  32. # Where is your Centreon log directory
  33. CENTREON_LOG=/var/log/centreon
  34.  
  35. # Where is your Centreon etc directory
  36. CENTREON_ETC=/etc/centreon
  37.  
  38. # Where is your Centreon binaries directory
  39. CENTREON_BINDIR=/usr/local/centreon/bin
  40.  
  41. # Where is your Centreon data information directory
  42. CENTREON_DATADIR=/usr/local/centreon/data
  43.  
  44. # Where is your Centreon generation_files directory
  45. CENTREON_GENDIR=/usr/local/centreon
  46.  
  47. # Where is your Centreon variable library directory
  48. CENTREON_VARLIB=/var/lib/centreon
  49.  
  50. # Where is your CentPlugins Traps binary
  51. CENTPLUGINSTRAPS_BINDIR=/usr/local/centreon/bin
  52.  
  53. ################# RRDs.pm
  54.  
  55. # Where is the RRD perl module installed [RRDs.pm]
  56. RRD_PERL=`locate RRDs.pm`
  57.  
  58. # Where is PEAR [PEAR.php]
  59. PEAR_PATH=/usr/share/pear
  60.  
  61. ################# User and group centreon
  62.  
  63. # What is the Centreon group ? [centreon]
  64. CENTREON_GROUP=centreon
  65.  
  66. # What is the Centreon user ? [centreon]
  67. CENTREON_USER=centreon
  68.  
  69. ################# Montoring user
  70.  
  71. # What is the Monitoring engine user ?
  72. MONITORINGENGINE_USER=centreon-engine
  73.  
  74. # What is the Broker user ? (optional)
  75. BROKER_USER=centreon-broker
  76.  
  77. ################# Event log dir
  78.  
  79. # What is the Monitoring engine log directory ?
  80. MONITORINGENGINE_LOG=/var/log/centreon-engine
  81.  
  82. ################# Plugin folders
  83.  
  84. # Where is your monitoring plugins (libexec) directory ?
  85. PLUGIN_DIR=/usr/lib64/nagios/plugins
  86.  
  87. ########################################################################
  88. # Configure Sudo
  89. ########################################################################
  90.  
  91. # Where is sudo configuration file
  92. SUDO_FILE=/etc/sudoers
  93.  
  94. # What is the Monitoring engine init.d script ?
  95. MONITORINGENGINE_INIT_SCRIPT=/etc/init.d/centengine
  96.  
  97. # What is the Monitoring engine binary ?
  98. MONITORINGENGINE_BINARY=/usr/local/bin/centengine
  99.  
  100. # What is the Monitoring engine configuration directory ?
  101. MONITORINGENGINE_ETC=/etc/centreon-engine
  102.  
  103. # Where is the configuration directory for broker module ?
  104. BROKER_ETC=/etc/centreon-broker
  105.  
  106. # Where is the init script for broker module daemon ?
  107. BROKER_INIT_SCRIPT=/etc/init.d/cbd
  108.  
  109. # Do you want me to configure your sudo ? (WARNING)
  110. FORCE_SUDO_CONF=1
  111.  
  112. ########################################################################
  113. # Configure Apache server
  114. ########################################################################
  115.  
  116. # Do you want to reload your Apache ?
  117. APACHE_RELOAD=1
  118.  
  119. ########################################################################
  120. # Pear Modules
  121. ########################################################################
  122.  
  123. # Do you want me to install/upgrade your PEAR modules
  124. PEAR_AUTOINST=1
  125.  
  126. ########################################################################
  127. # Start CentStorage Installation
  128. ########################################################################
  129.  
  130. # Where is your Centreon Run Dir directory?
  131. CENTREON_RUNDIR=/var/run/centreon
  132.  
  133. # Where is your CentStorage binary directory
  134. CENTSTORAGE_BINDIR=/usr/local/centreon/bin
  135.  
  136. # Where is your CentStorage RRD directory
  137. CENTSTORAGE_RRD=/var/lib/centreon
  138.  
  139. ########################################################################
  140. # Start CentCore Installation
  141. ########################################################################
  142.  
  143. # Where is your CentCore binary directory
  144. CENTCORE_BINDIR=/usr/local/centreon/bin
  145.  
  146. # Do you want me to install CentCore init script ?
  147. CENTCORE_INSTALL_INIT=1
  148.  
  149. # Do you want me to install CentCore run level
  150. CENTCORE_INSTALL_RUNLVL=1
  151.  
  152. ########################################################################
  153. # Start CentPlugins Installation
  154. ########################################################################
  155.  
  156. # Where is your CentPlugins lib directory
  157. CENTPLUGINS_TMP=/var/lib/centreon/centplugins
  158.  
  159. ########################################################################
  160. # Start CentPlugins Traps Installation
  161. ########################################################################
  162.  
  163. # Where is your SNMP configuration directory
  164. SNMP_ETC=/etc/snmp
  165.  
  166. # Where is your CentreonTrapd binaries directory
  167. CENTREONTRAPD_BINDIR=/usr/local/centreon/bin
  168.  
  169. # Do you want me to install CentreonTrapd init script ?
  170. CENTREONTRAPD_INSTALL_INIT=1
  171.  
  172. # Do you want me to install CentreonTrapd run level ?
  173. CENTPLUGINSTRAPS_INSTALL_RUNLVL=1
  174.  

configure web part

Step 3, answer like this :

title value comments
Centreon Engine directory /usr/sbin because we used in cmake -DWITH_PREFIX_BIN=/usr/sbin
Centreon Engine Stats binary /usr/sbin/centenginestats
Centreon Engine var lib directory /var/lib64/centreon-engine because we used in cmake -DWITH_RW_DIR=/var/lib64/centreon-engine/rw
Centreon Engine Connector path /usr/lib64/centreon-connector because we used in cmake -DWITH_PREFIX_BINARY=/usr/lib64/centreon-connector
Centreon Engine Library (*.so) directory /usr/lib/centreon-engine because we used in cmake -DWITH_PREFIX_LIB=/usr/lib64/centreon-engine

Step4, answer like this :

title value comments
Centreon Broker etc directory /etc/centreon-broker because we used in cmake -DWITH_PREFIX_CONF=/etc/centreon-broker
Centreon Broker module (cbmod.so) /usr/lib64/nagios/cbmod.so because we used in cmake -DWITH_PREFIX_LIB=/usr/lib64/nagios
Centreon Broker log directory /var/log/centreon-broker
Retention file directory /var/lib64/centreon-broker
Centreon Broker lib (*.so) directory /usr/share/centreon/lib/centreon-broker because we used in cmake -DWITH_PREFIX_MODULES=/usr/share/centreon/lib/centreon-broker

That’s all 🙂
Administration – Centreon

Troubleshooting

sudo no tty present and no askpass program specified

  chmod 755 /etc/sudoers
  echo CENTREON ALL = NOPASSWD: ALL >> /etc/sudoers
  chmod 0440 /etc/sudoers

Copyright © 2024 My linux world - by Marc RABAHI
Design by Marc RABAHI and encelades.