Centreon mit Ubuntu 12.04…einige Hinweise

Meiner Meinung nach ist Centreon immer noch eines der besten Tools um den Funktionsumfang von Nagios zu erweitern und die Konfiguration zu vereinfachen. Im Einsatz habe ich Centreon nun schon seit über vier Jahren und bin durchweg zufrieden. Leider ist die Installation unter Ubuntu 12.04  eine große Frickelei. Mit Debian war es in meiner Erinnerung deutlich einfacher. Ich fasse mal ein paar Tipps zusammen. Ich habe bewusst versucht Nagios & Co aus den Ubuntu Quellen zu nehmen und nichts von „außerhalb“ zu installieren. Ein how to wie man Nagios und Centreon eigenständig installiert findet man hier und hier (der link ist zur zeit broken…mal abwarten gestern ging er noch).  Will man sich wenig Arbeit machen, kann man auch einfach zum FAN Projekt (fully automated nagios) greifen. Icinga habe ich vor längerer Zeit mal installiert, konnte mich aber damals nicht überzeugen, eventuell ist die aktuelle Versionen besser. OMD habe ich mir noch nicht angeschaut, zweifel aber generell an der Beständigkeit von solchen Projekten.

Sicherlich habe ich irgendwelche Punkte und Pakete übersehen….aber dies ist kein how to.

Fangen wir mit ein paar Paketen an

aptitude install  mysql-server nagios3 nagios-plugins

aptitude install librrds-perl rrdtool php-pear ndoutils-nagios3-mysql sysutils lsb-release snmp libnet-snmp-perl libsnmp-perl libgd2-xpm libgd2-xpm-dev libpng12-dev

Persönlich würde ich noch phpmyadmin installieren.

Dann schauen wir erst mal ob Nagios überhaupt läuft. Bei mir lief es nicht („error: Could not stat() command file“) und ich musste

chmod g+x /var/lib/nagios3/rw

ausführen. Hinweise gab es hier.

Sobald alles läuft machen wir uns daran Centreon zu installieren:

wget http://download.centreon.com/centreon/centreon-2.3.9.tar.gz

Auspacken usw.

./install.sh -i

blabla und dann


------------------------------------------------------------------------
 Please choose what you want to install
 ------------------------------------------------------------------------

Do you want to install : Centreon Web Front
 [y/n], default to [n]:
 > y

Do you want to install : Centreon CentCore
 [y/n], default to [n]:
 > y

Do you want to install : Centreon Nagios Plugins
 [y/n], default to [n]:
 > y

Do you want to install : Centreon Snmp Traps process
 [y/n], default to [n]:
 > n

------------------------------------------------------------------------
 Start CentWeb Installation
 ------------------------------------------------------------------------

Where is your Centreon directory?
 default to [/usr/local/centreon]
 >

Do you want me to create this directory ? [/usr/local/centreon]
 [y/n], default to [n]:
 >
 Directory /usr/local/centreon does not exists.             CRITICAL

Where is your Centreon directory?
 default to [/usr/local/centreon]
 >

Do you want me to create this directory ? [/usr/local/centreon]
 [y/n], default to [n]:
 > y
 Path /usr/local/centreon                                   OK

Where is your Centreon log directory
 default to [/usr/local/centreon/log]
 >

Do you want me to create this directory ? [/usr/local/centreon/log]
 [y/n], default to [n]:
 > y
 Path /usr/local/centreon/log                               OK

Where is your Centreon etc directory
 default to [/etc/centreon]
 >

Do you want me to create this directory ? [/etc/centreon]
 [y/n], default to [n]:
 > y
 Path /etc/centreon                                         OK

Where is your Centreon generation_files directory?
 default to [/usr/local/centreon]
 >
 Path /usr/local/centreon                                   OK

Where is your Centreon variable library directory?
 default to [/var/lib/centreon]
 >

Do you want me to create this directory ? [/var/lib/centreon]
 [y/n], default to [n]:
 > y
 Path /var/lib/centreon                                     OK

Where is your CentPlugins Traps binary
 default to [/usr/local/centreon/bin]
 >

Do you want me to create this directory ? [/usr/local/centreon/bin]
 [y/n], default to [n]:
 > y
 Path /usr/local/centreon/bin                               OK

Where is the RRD perl module installed [RRDs.pm]
 default to [/usr/lib/perl5/RRDs.pm]
 >
 Path /usr/lib/perl5                                        OK
 /usr/bin/rrdtool                                           OK
 /usr/bin/mail                                              OK

Where is PEAR [PEAR.php]
 default to [/usr/share/php/PEAR.php]
 >
 Path /usr/share/php                                        OK

Where is installed Nagios ?
 default to [/usr/local/nagios]
 > /usr/lib/cgi-bin/nagios3
 Path /usr/lib/cgi-bin/nagios3                              OK

Where is your nagios config directory
 default to [/usr/local/nagios/etc]
 > /etc/nagios3
 Path /etc/nagios3                                          OK

Where is your Nagios var directory ?
 default to [/usr/local/nagios/var]
 > /var/lib/nagios3
 Path /var/lib/nagios3                                      OK

Where is your Nagios plugins (libexec) directory ?
 default to [/usr/local/nagios/libexec]
 > /usr/lib/nagios/plugins
 Path /usr/lib/nagios/plugins                               OK
 /usr/sbin/nagios3                                          OK

Where is your Nagios image directory ?
 default to [/usr/local/nagios/share/images/logos]
 > /usr/share/nagios/htdocs/images/logos
 Path /usr/share/nagios/htdocs/images/logos                 OK
 /usr/sbin/nagios3stats                                     OK
 p1_file : /usr/lib/nagios3/p1.pl                           OK
 /usr/bin/php                                               OK
 /usr/bin/perl                                              OK
 Finding Apache group :                                     www-data
 Finding Apache user :                                      www-data
 Finding Nagios user :                                      nagios
 Finding Nagios group :                                     nagios

Where is your NDO ndomod binary ?
 default to [/usr/sbin/ndomod.o]
 > /usr/lib/ndoutils/ndomod-mysql-3x.o
 /usr/lib/ndoutils/ndomod-mysql-3x.o                        OK

------------------------------------------------------------------------
 Configure Sudo
 ------------------------------------------------------------------------

Where is sudo configuration file
 default to [/etc/sudoers]
 >
 /etc/sudoers                                               OK
 Nagios init script                                         OK
 Your sudo is not configured

Do you want me to configure your sudo ? (WARNING)
 [y/n], default to [n]:
 > y
 Configuring Sudo                                           OK

------------------------------------------------------------------------
 Configure Apache server
 ------------------------------------------------------------------------

Do you want to add Centreon Apache sub configuration file ?
 [y/n], default to [n]:
 > y
 Create '/etc/apache2/conf.d/centreon.conf'                 OK
 Configuring Apache                                         OK

Do you want to reload your Apache ?
 [y/n], default to [n]:
 > y
 Reloading Apache service                                   OK
 Preparing Centreon temporary files
 Change right on /usr/local/centreon/log                    OK
 Change right on /etc/centreon                              OK
 Change right on /usr/share/nagios/htdocs/images/logos      OK
 Install nagios documentation                               OK
 Change macros for insertBaseConf.sql                       OK
 Change macros for php files                                OK
 Change right on /etc/nagios3                               OK
 Copy CentWeb in system directory
 Install CentWeb (web front of centreon)                    OK
 Install libraries                                          OK
 Copying libinstall                                         OK
 Change macros for centreon.cron                            OK
 Install Centreon cron.d file                               OK
 Change macros for centAcl.php                              OK
 Change macros for downtimeManager.php                      OK
 Change macros for eventReportBuilder.pl                    OK
 Change macros for dashboardBuilder.pl                      OK
 Install cron directory                                     OK
 Change right for eventReportBuilder.pl                     OK
 Change right for dashboardBuilder.pl                       OK

------------------------------------------------------------------------
 Pear Modules
 ------------------------------------------------------------------------
 Check PEAR modules
 PEAR                            1.4.9       1.9.4          OK
 DB                              1.7.6                      NOK
 DB_DataObject                   1.8.4                      NOK
 DB_DataObject_FormBuilder       1.0.0RC4                   NOK
 MDB2                            2.0.0                      NOK
 Date                            1.4.6                      NOK
 HTML_Common                     1.2.2                      NOK
 HTML_QuickForm                  3.2.5                      NOK
 HTML_QuickForm_advmultiselect   1.1.0                      NOK
 HTML_Table                      1.6.1                      NOK
 Archive_Tar                     1.1         1.3.7          OK
 Auth_SASL                       1.0.1                      NOK
 Console_Getopt                  1.2         1.3.0          OK
 Net_SMTP                        1.2.8                      NOK
 Net_Socket                      1.0.1                      NOK
 Net_Traceroute                  0.21                       NOK
 Net_Ping                        2.4.1                      NOK
 Validate                        0.6.2                      NOK
 XML_RPC                         1.4.5                      NOK
 SOAP                            0.10.1                     NOK
 Log                             1.9.11                     NOK
 Archive_Zip                     0.1.2                      NOK

Do you want me to install/upgrade your PEAR modules
 [y/n], default to [y]:
 > y
 Upgrading PEAR modules
 Installing PEAR modules
 DB                              1.7.6       1.7.14         OK
 DB_DataObject                   1.8.4       1.10.0         OK
 DB_DataObject_FormBuilder       1.0.0RC4    1.0.2          OK
 MDB2                            2.0.0       2.4.1          OK
 HTML_QuickForm_advmultiselect   1.1.0       1.5.1          OK
 HTML_Table                      1.6.1       1.8.3          OK
 Auth_SASL                       1.0.1       1.0.6          OK
 Net_SMTP                        1.2.8       1.6.1          OK
 Net_Traceroute                  0.21        0.21.3         OK
 Net_Ping                        2.4.1       2.4.5          OK
 Validate                        0.6.2       0.8.5          OK
 XML_RPC                         1.4.5       1.5.5          OK
 SOAP                            0.10.1      0.13.0         OK
 Log                             1.9.11      1.12.7         OK
 Archive_Zip                     0.1.2       0.1.2          OK
 Check PEAR modules
 PEAR                            1.4.9       1.9.4          OK
 DB                              1.7.6       1.7.14         OK
 DB_DataObject                   1.8.4       1.10.0         OK
 DB_DataObject_FormBuilder       1.0.0RC4    1.0.2          OK
 MDB2                            2.0.0       2.4.1          OK
 Date                            1.4.6       1.4.7          OK
 HTML_Common                     1.2.2       1.2.5          OK
 HTML_QuickForm                  3.2.5       3.2.13         OK
 HTML_QuickForm_advmultiselect   1.1.0       1.5.1          OK
 HTML_Table                      1.6.1       1.8.3          OK
 Archive_Tar                     1.1         1.3.7          OK
 Auth_SASL                       1.0.1       1.0.6          OK
 Console_Getopt                  1.2         1.3.0          OK
 Net_SMTP                        1.2.8       1.6.1          OK
 Net_Socket                      1.0.1       1.0.10         OK
 Net_Traceroute                  0.21        0.21.3         OK
 Net_Ping                        2.4.1       2.4.5          OK
 Validate                        0.6.2       0.8.5          OK
 XML_RPC                         1.4.5       1.5.5          OK
 SOAP                            0.10.1      0.13.0         OK
 Log                             1.9.11      1.12.7         OK
 Archive_Zip                     0.1.2       0.1.2          OK
 All PEAR modules                                           OK

------------------------------------------------------------------------
 Centreon Post Install
 ------------------------------------------------------------------------
 Create /usr/local/centreon/www/install/install.conf.php    OK
 Create /etc/centreon/instCentWeb.conf                      OK

------------------------------------------------------------------------
 Start CentStorage Installation
 ------------------------------------------------------------------------

Where is your Centreon Run Dir directory?
 default to [/var/run/centreon]
 >

Do you want me to create this directory ? [/var/run/centreon]
 [y/n], default to [n]:
 > y
 Path /var/run/centreon                                     OK

Where is your CentStorage binary directory
 default to [/usr/local/centreon/bin]
 >
 Path /usr/local/centreon/bin                               OK

Where is your CentStorage RRD directory
 default to [/var/lib/centreon]
 >
 Path /var/lib/centreon                                     OK
 Finding Nagios group :                                     nagios
 Finding Nagios user :                                      nagios
 Preparing Centreon temporary files
 /tmp/centreon-setup exists, it will be moved...
 install www/install/createTablesCentstorage.sql            OK
 Creating Centreon Directory '/var/lib/centreon/status'     OK
 Creating Centreon Directory '/var/lib/centreon/metrics'    OK
 Change macros for centstorage binary                       OK
 Install CentStorage binary                                 OK
 Install library for centstorage                            OK
 Change right : /var/run/centreon                           OK
 Change macros for centstorage init script                  OK

Do you want me to install CentStorage init script ?
 [y/n], default to [n]:
 > y
 CentStorage init script installed                          OK

Do you want me to install CentStorage run level ?
 [y/n], default to [n]:
 > y
 update-rc.d: warning: /etc/init.d/centstorage missing LSB information
 update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
 Adding system startup for /etc/init.d/centstorage ...
 /etc/rc0.d/K30centstorage -> ../init.d/centstorage
 /etc/rc1.d/K30centstorage -> ../init.d/centstorage
 /etc/rc6.d/K30centstorage -> ../init.d/centstorage
 /etc/rc2.d/S40centstorage -> ../init.d/centstorage
 /etc/rc3.d/S40centstorage -> ../init.d/centstorage
 /etc/rc4.d/S40centstorage -> ../init.d/centstorage
 /etc/rc5.d/S40centstorage -> ../init.d/centstorage
 Configuration file /etc/centreon/conf.pm not found.  Exiting.
 CentStorage stop                                           FAIL
 Change macros for logAnalyser                              OK
 Install logAnalyser                                        OK
 Change macros for nagiosPerfTrace                          OK
 Install nagiosPerfTrace                                    OK
 Change macros for purgeLogs                                OK
 Install purgeLogs                                          OK
 Change macros for purgeCentstorage                         OK
 Install purgeCentstorage                                   OK
 Change macros for centreonPurge.sh                         OK
 Install centreonPurge.sh                                   OK
 Change macros for centstorage.cron                         OK
 Install CentStorage cron                                   OK
 Create /etc/centreon/instCentStorage.conf                  OK

------------------------------------------------------------------------
 Start CentCore Installation
 ------------------------------------------------------------------------

Where is your CentCore binary directory
 default to [/usr/local/centreon/bin]
 >
 Path /usr/local/centreon/bin                               OK
 /usr/bin/ssh                                               OK
 /usr/bin/scp                                               OK
 Finding Nagios group :                                     nagios
 Finding Nagios user :                                      nagios
 Preparing Centreon temporary files
 /tmp/centreon-setup exists, it will be moved...
 Change CentCore Macro                                      OK
 Copy CentCore in binary directory                          OK
 Change right : /var/run/centreon                           OK
 Change right : /var/lib/centreon                           OK
 Replace CentCore init script Macro                         OK

Do you want me to install CentCore init script ?
 [y/n], default to [n]:
 > y
 CentCore init script installed                             OK

Do you want me to install CentCore run level ?
 [y/n], default to [n]:
 > y
 update-rc.d: warning: /etc/init.d/centcore missing LSB information
 update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
 Adding system startup for /etc/init.d/centcore ...
 /etc/rc0.d/K30centcore -> ../init.d/centcore
 /etc/rc1.d/K30centcore -> ../init.d/centcore
 /etc/rc6.d/K30centcore -> ../init.d/centcore
 /etc/rc2.d/S40centcore -> ../init.d/centcore
 /etc/rc3.d/S40centcore -> ../init.d/centcore
 /etc/rc4.d/S40centcore -> ../init.d/centcore
 /etc/rc5.d/S40centcore -> ../init.d/centcore
 Create /etc/centreon/instCentCore.conf                     OK

------------------------------------------------------------------------
 Start CentPlugins Installation
 ------------------------------------------------------------------------

Where is your CentPlugins lib directory
 default to [/var/lib/centreon/centplugins]
 >

Where is your CentPlugins lib directory
 default to [/var/lib/centreon/centplugins]
 >

Do you want me to create this directory ? [/var/lib/centreon/centplugins]
 [y/n], default to [n]:
 > y
 Path /var/lib/centreon/centplugins                         OK
 Finding Nagios user :                                      nagios
 Finding Nagios group :                                     nagios
 Preparing Centreon temporary files
 /tmp/centreon-setup exists, it will be moved...
 Change macros for CentPlugins                              OK
 Installing the plugins                                     OK
 Change right on centreon.conf                              OK
 CentPlugins is installed
 Create /etc/centreon/instCentPlugins.conf                  OK

Danach führt man den Rest der Installation via Webinterface durch.
Nun schaut man ob die beiden Prozesse

/usr/bin/perl -w /usr/local/centreon/bin/centcore

und

/usr/bin/perl -w /usr/local/centreon/bin/centstorage

laufen. Tun sie das nicht, versucht man sie via


/etc/init.d/centcore start

/etc/init.d/centstorage start

zu starten.  Funktioniert das nicht, liegt es eventuell daran, dass der nagios User keine shell hat. Also ändert man in der /etc/passwd/ beim user nagios das /bin/false auf /bin/sh. Nun sollte man die beiden Prozesse starten können.

Ganz am Ende habe ich nochmal ein

./install.sh -u /etc/centreon

ausgeführt. Das braucht man eigentlich nicht, aber erst danach wurden erst alle checks  bei Centreon angezeigt, vorher hatte ich nur eine sehr kleine Auswahl an checks.  „Service Performance Data File“ sollte eventuell noch in Centreon konfiguriert werden um Performancedaten darstellen zu können (das ist aber eine andere Geschichte und soll ein anderes mal erzählt werden).

Ich empfehle immer gleichzeitig eine zweite Testmaschine aufzusetzen, so kann man Updates testen und hat eine gewisse Redundanz für den Notfall.

Ich bin für jede Verbesserung offen ;-).

Update 1: Als System kam ein 32bit 12.04 Ubuntu unter KVM zum Einsatz.
Update 2: den „Physical HTML Path“ in der CGI.cfg in centreon anpassen zu /usr/share/nagios3/htdocs un den URL HTML Path zu /nagios3
Update 3: adduser www-data nagios ist nötig falls ein „Error: Could not read object configuration data!“ beim Aufruf von Nagios erscheint
Update 4: secure_path in /etc/sudoers anpassen bzw. auskommentieren (achtung!)

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.