Installing Cacti from rpm on RHEL 5.8

Alongside Centreon, it might be interesting to have additional monitoring and capacity planning tools. Cacti is a frontend to RDDTool and can gather and store state information from any element of your IT infrastructure. Information are located in a MySQL database and in RDD databases as well. RHEL 5.8 comes up with a rpm package for Cacti.

Here are the prerequisites for Cacti. Please install these dependencies as an initial step :

root@localhost:~# rpm -qa |grep -Ei ‘(httpd|mysql-server|php-mysql|php-gd|php-snmp)’
httpd-2.2.3-65.el5_8
mysql-server-5.0.95-1.el5_7.1
php-mysql-5.1.6-39.el5_8
php-gd-5.1.6-39.el5_8
php-snmp-5.1.6-39.el5_8

If the packages above are not present, please install them.  Then, create the MySQL database cacti and an user cactiuser with the appropriate privileges.

root@localhost:~#mysql -u root -p ‘create database cacti’

mysql> CREATE USER cactiuser

mysql> GRANT ALL ON cacti.* to cactiuser@localhost IDENTIFIED BY ‘your_password’;

mysql> FLUSH privileges;

mysql> quit;

Now populate the new database cacti with its structure. Import the sql database creation file as follows :

fool@localhost:~$ mysql -u root -p cacti < /usr/share/doc/cacti-0.8.8a/cacti.sql

Add the right credentials to access cacti database in this file :

root@localhost:~# cat /etc/cacti/db.php

<?php
/*
+————————————————————————-+
| Copyright (C) 2004-2012 The Cacti Group                                 |
|                                                                         |
| This program is free software; you can redistribute it and/or           |
| modify it under the terms of the GNU General Public License             |
| as published by the Free Software Foundation; either version 2          |
| of the License, or (at your option) any later version.                  |
|                                                                         |
| This program is distributed in the hope that it will be useful,         |
| but WITHOUT ANY WARRANTY; without even the implied warranty of          |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           |
| GNU General Public License for more details.                            |
+————————————————————————-+
| Cacti: The Complete RRDTool-based Graphing Solution                     |
+————————————————————————-+
| This code is designed, written, and maintained by the Cacti Group. See  |
| about.php and/or the AUTHORS file for specific developer information.   |
+————————————————————————-+
| http://www.cacti.net/                                                   |
+————————————————————————-+
*/

/* make sure these values refect your actual database/host/user/password */
$database_type = “mysql”;
$database_default = “cacti”;
$database_hostname = “localhost”;
$database_username = “cactiuser”;
//$database_password = “your_password”;
$database_password = “cacti”;
$database_port = “3306”;
$database_ssl = false;

/*
Edit this to point to the default URL of your Cacti install
ex: if your cacti install as at http://serverip/cacti/ this
would be set to /cacti/
*/
//$url_path = “/cacti/”;

/* Default session name – Session name must contain alpha characters */
//$cacti_session_name = “Cacti”;

?>

Once done, modify Apache configuration file to make cacti available to browsers. In the first lines of /etc/httpd/conf.d/cacti.conf, make sure you have these details :

Alias /cacti    /usr/share/cacti

<Directory /usr/share/cacti/>
<IfModule mod_authz_core.c>
# httpd 2.4
Require host localhost
</IfModule>
<IfModule !mod_authz_core.c>
# httpd 2.2
Order deny,allow
#               Deny from all
#               Allow from localhost
Allow from all
</IfModule>
</Directory>

I replaced Allow from localhost by Allow from all. You can replace it if you want to limit access to http://localhost/cacti for security reasons.

After Apache conf file being modified, reload its configuration :

root@localhost:~#service httpd configtest && service httpd reload

The last steps of Cacti configuration is made through a web interface. Point your browser to the following url : http://localhost/cacti and just click on the next button at the bottom right hand corner to complete the installation.


Time now to log in. The default credentials are admin/admin. You will asked to change admin’s password :

And finally :

 

 

 

Upgrading Centreon to version 2.3.9

Centreon latest stable version was released on the 1st of August. On a server running RHEL 5.8 with the official Centreon repositories, here are the steps to follow. Make sure that you have installed the yum configuration file for CES repository :

root@localhost:~# cat /etc/yum.repos.d/ces-standard.repo

[ces-standard]
name=Centreon Entreprise Server RPM repository for ces $releasever
baseurl=http://yum.centreon.com/standard/stable/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CES
priority=1

[ces-standard-noarch]
name=Centreon Entreprise Server RPM repository for ces $releasever
baseurl=http://yum.centreon.com/standard/stable/noarch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CES
priority=1

[ces-standard-deps]
name=Centreon Entreprise Server dependencies RPM repository for ces $releasever
baseurl=http://yum.centreon.com/standard/stable/dependencies/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CES
priority=1

[ces-standard-deps-noarch]
name=Centreon Entreprise Server dependencies RPM repository for ces $releasever
baseurl=http://yum.centreon.com/standard/stable/dependencies/noarch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CES
priority=1

Stop some Centreon-related services :

root@localhost:~# service ndo2db stop

root@localhost:~#service centstorage stop

root@localhost:~#service centcore stop
Then, run yum update and you will get the list of rpm  packages to be upgraded for Centreon :

root@localhost:~#yum update

Dependencies Resolved

=============================================================================================================================
 Package                          Arch               Version                          Repository                        Size
=============================================================================================================================
Updating:
 centreon                         noarch             2.3.9-4                          ces-standard-noarch              7.4 M
 centreon-database                noarch             2.3.9-4                          ces-standard-noarch               59 k
 centreon-plugin-meta             noarch             2.3.9-4                          ces-standard-noarch              8.2 k
 centreon-plugins                 noarch             2.3.9-4                          ces-standard-noarch               74 k
 dhclient                         x86_64             12:3.0.5-31.el5_8.1              rhel-5-server-rpms               287 k
 initscripts                      x86_64             8.45.42-1.el5_8.1                rhel-5-server-rpms               1.6 M
 sudo                             x86_64             1.7.2p1-14.el5_8.3               rhel-x86_64-server-5             359 k
Installing for dependencies:
 php-pear-Archive-Zip             noarch             0.1.2-1                          ces-standard-noarch               22 k

Transaction Summary
=============================================================================================================================
Install       1 Package(s)
Upgrade       7 Package(s)

Total                                                                                        650 kB/s | 9.8 MB     00:15     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : initscripts                                                                                          1/15
  Updating       : sudo                                                                                                 2/15
  Updating       : dhclient                                                                                             3/15
  Updating       : centreon-plugins                                                                                     4/15
  Updating       : centreon-database                                                                                    5/15
  Installing     : php-pear-Archive-Zip                                                                                 6/15
install ok: channel://pear.php.net/Archive_Zip-0.1.2
  Updating       : centreon-plugin-meta                                                                                 7/15
  Updating       : centreon                                                                                             8/15
  Cleanup        : sudo                                                                                                 9/15
  Cleanup        : centreon-plugins                                                                                    10/15
  Cleanup        : centreon-plugin-meta                                                                                11/15
  Cleanup        : initscripts                                                                                         12/15
  Cleanup        : centreon                                                                                            13/15
  Cleanup        : centreon-database                                                                                   14/15
  Cleanup        : dhclient                                                                                            15/15
rhel-5-server-cf-tools-1-rpms/productid                                                               | 1.7 kB     00:00     
rhel-5-server-rpms/productid                                                                          | 1.7 kB     00:00     
Installed products updated.

Dependency Installed:
  php-pear-Archive-Zip.noarch 0:0.1.2-1                                                                                      

Updated:
  centreon.noarch 0:2.3.9-4              centreon-database.noarch 0:2.3.9-4       centreon-plugin-meta.noarch 0:2.3.9-4      
  centreon-plugins.noarch 0:2.3.9-4      dhclient.x86_64 12:3.0.5-31.el5_8.1      initscripts.x86_64 0:8.45.42-1.el5_8.1     
  sudo.x86_64 0:1.7.2p1-14.el5_8.3      

Complete!

Then, restart the services you stopped just before :

root@localhost:~# service centstorage start

root@localhost:~# service centcore start

root@localhost:~# service ndo2db start
A few steps left before the upgrade is over. Open up Firefox or your favorite browser and type in the URL adress bar : http://localhost/centreon

file /etc/fonts/conf.avail/10-autohint.conf from install of fontconfig-2.5.93-7.x86_64 conflicts with file from package fontconfig-2.4.1-7.el5.i386

While installing Centreon on RHEL 5.8 server, this message was displayed :

file /etc/fonts/conf.avail/10-autohint.conf from install of fontconfig-2.5.93-7.x86_64 conflicts w ith file from package fontconfig-2.4.1-7.el5.i386

On 64 bit-based system, yum may install 32 bit and 64 bit rpm packages for a given software. This is one of its features.  In that case, an upgrade was available for the fontconfig package in Centreon repositories. Their version was earlier than the one installed on the system. The 32 bit version of this rpm has been removed to solve the rpm dependency problem. Just issue the following command as root :

root@localhost:~# yum remove fontconfig-2.4.1-6.el5.i386

Then, type the following commands to install centreon :

root@localhost:~#yum clean all && yum update && yum install centreon

More information on this issue : Centreon official forum

Compilation failed in require at ./check_centreon_snmp_remote_storage line 50

After upgrading Centreon to the latest stable version (2.3.4 -> 2.3.8.3) using Centreon official rpm repositories and yum, some errors in CRITICAL state occured in the main monitoring webpage. All the data provided through the SNMP protocol were unavailable. After an in-depth checking at Centreon configuration, the problem came from the scripts check_centreon_snmp_* which can not be executed properly.

There are located in /usr/lib/nagios/plugins. To debug the problem, I made some tests with check_centreon_snmp_remote_storage. Here are the errors I got :

./check_centreon_snmp_remote_storage

Can’t locate List/MoreUtils.pm in @INC (@INC contains: /usr/lib/nagios/plugins /usr/lib64/nagios/plugins /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/lib/perl5/vendor_perl/5.8.8/Config/IniFiles.pm line 14.
BEGIN failed–compilation aborted at /usr/lib/perl5/vendor_perl/5.8.8/Config/IniFiles.pm line 14.
Compilation failed in require at /usr/lib/nagios/plugins/centreon.pm line 51.
BEGIN failed–compilation aborted at /usr/lib/nagios/plugins/centreon.pm line 51.
Compilation failed in require at ./check_centreon_snmp_remote_storage line 50.
BEGIN failed–compilation aborted at ./check_centreon_snmp_remote_storage line 50.

During the Centreon upgrade, the installation of the List::MoreUtils Perl module was missing. To install it on RHEL 5.8 x86_64, just issue the following command :

root@localhost:~# yum install perl-List-MoreUtils.x86_64

Once installed, to test this Perl module :

fool@localhost:~$ perl -MList::MoreUtils -e1

All the alerts in critical state in Centreon should progressively disappear.

 

It appears as though you do not have permission to view information for any of the services you requested…

While using Centreon on top of Nagios core, it is no more necessary to log on to the Nagios web interface to look after the monitoring overview. Centreon does it well even better.

Nevertheless, if you configure the Firefox addon “Nagios checker”, you need to have the right credentials with enough privileges to see all the Nagios monitoring views. Otherwise you can get the following errors :

it appears as though you do not have permission to view information for any of the services you requested…
If you believe this is an error, check the HTTP server authentication requirements for accessing this CGI
and check the authorization options in your CGI configuration file.

On RHEL 5.8 with a rpm-based Nagios installation, the  default user account created is nagiosadmin. Its password is located and encrypted in /etc/nagios/passwd. Make sure you did not forget its password or set a new one :

root@localhost:~# cd /etc/nagios

root@localhost:~# htpasswd -c passwd nagiosadmin

All the details concerning access to monitoring and configuration views are in /etc/nagios/cgi.cfg :

root@localhost:~# cat /etc/nagios/cgi.cfg

main_config_file=/etc/nagios/nagios.cfg
physical_html_path=/usr/local/nagios/share
url_html_path=/nagios
nagios_check_command=/usr/local/nagios/libexec/check_nagios /usr/local/nagios/var/status.log 5 ‘/usr/sbin/nagios’
use_authentication=1
default_user_name=nagiosadmin
authorized_for_system_information=nagiosadmin
authorized_for_system_commands=nagiosadmin
authorized_for_configuration_information=nagiosadmin
authorized_for_all_hosts=nagiosadmin
authorized_for_all_host_commands=nagiosadmin
authorized_for_all_services=nagiosadmin
authorized_for_all_service_commands=nagiosadmin
statusmap_background_image=logofullsize.jpg
default_statusmap_layout=4
default_statuswrl_layout=4
refresh_rate=90
ping_syntax=/bin/ping -n -c 5 $HOSTADDRESS$

If you have made any modification in the Nagios configuration, make sure the syntax is OK :

root@localhost:~#service nagios checkconfig

Then, reload Nagios configuration :

root@localhost:~# service nagios reload

More information in the official Nagios documentation :
Nagios Core : Authentication And Authorization In The CGIs

Firefox addon “Nagios checker” :

Nagios checker

ERROR: Received noSuchName(2) error-status at error-index 1.

Sometimes, after restarting all the Centreon-related services (Mysqld, Centcore, Centstorage, ndo2db, Nagios, Apache), you may have a long listing of error messages in the UNKNOWN status such as :

ERROR: Received noSuchName(2) error-status at error-index 1.

ERROR: Received noSuchName(2) error-status at error-index 4.

It concerns all the information monitored through SNMP. One solution to wipe them out of your Centreon dashboard is to stop all the Centreon-related services. Then, delete all the files contained in /var/lib./centreon/centplugins/:

root@localhost:~# rm -rf /var/lib/centreon/centplugins/*

Then restart Centreon and everything should be nice again.