Category: Administration


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 :

 

 

 

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

If you are dealing with a long program file, it might be interesting to hide part(s) of it to make it more readable for instance. VIM provides these features : folding for hiding sections of text and unfolding for  printing texts again.

Here are the basic VIM keyboard shortcuts to type in normal mode :

zfa} : create a fold within two brackets. the cursor is located after the opening bracket and the second one is indicated by }

zc : close the current fold

zo : open the current fold

zd : delete the fold at the cursor

[z : move to start of open fold

z] : move to end of open fold

You can create folders as many as you want within your current file. If you exit from your VIM editor, you will lose all of them.

For more details about folding/unfolding commands in VIM :

VIM folding

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

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

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.

If you have this error “CHECK_NRPE: Error – Could not complete SSL handshake” while configuring Nagios or Centreon, make sure that your (Nagios|Centreon) poller IP address is allowed in the remote monitored nrpe server configuration file. Just add the IP address :

Debian : cat  /etc/nagios/nrpe.cfg

allowed_hosts=your_ip_here

then, reload the nrpe server configuration file :

root@localhost:~#/etc/init.d/nagios-nrpe-server reload

RedHat : cat  /etc/nagios/nrpe.cfg

allowed_hosts=your_ip_here

Then, restart the nrpe server configuration file (no option for reloading) :

root@localhost:~#service nrpe restart

If you have a slow SSH connection to a server with the following message :

debug1: An invalid name was supplied
Cannot determine realm for numeric host address

Make sure that the server you try to reach has a well-configured reverse DNS. Then, you can desactivate GSSAPI authentication by adding the following line to your ssh client configuration file :

fool@localhost:~$echo “GSSAPIAuthentication no” >> $HOME/.ssh/config

You should be able to connect to your server through SSH quicker.

 

If your are connected as root on your MySQL database, you can list all the system and object privileges for a given user :

mysql> show grants for user ‘fool’@'localhost’;

or if you are connected as the user fool :

mysql> show grants;

mysql> show grants for current_user;

mysql> show grants for current_user();

current_user function is available if your MySQL version is equal or higher that 5.0

You can make searches for package(s) through apt-cache and other GUI related tools. Debtags provides a different way to do the same kind of job : debtags

To install it :

root@localhost:~#apt-get install debtags

To populate the debtags database with the latest up-to-date data, you should remove the “#” at the line beginning with “tags http://debtags.alioth.debian.org/tags/&#8221;.  You can launch the database update :

root@localhost:~# debtags update

Most of the packages available in the Debian repositories have tags inside their description. See below what an apt-cache show provides as information for the vim package.

root@localhost:~# apt-cache show vim
Package: vim
Priority: optional
Section: editors
Installed-Size: 1744
Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
Architecture: amd64
Version: 2:7.2.445+hg~cb94c42c0e1a-1
Provides: editor
Depends: vim-common (= 2:7.2.445+hg~cb94c42c0e1a-1), vim-runtime (= 2:7.2.445+hg~cb94c42c0e1a-1), libacl1 (>= 2.2.11-1), libc6 (>= 2.7), libgpm2 (>= 1.20.4), libncurses5 (>= 5.7+20100313), libselinux1 (>= 1.32)
Suggests: ctags, vim-doc, vim-scripts
Filename: pool/main/v/vim/vim_7.2.445+hg~cb94c42c0e1a-1_amd64.deb
Size: 915008
MD5sum: dab2644b07e8dea570fc020d59f69d41
SHA1: 8314d6388d378a8994e94d224255ef5b447851a8
SHA256: 22c28c136a0c761cdc19a299b7cd9b8adb00e9de7e66b787c945f2104cfdba9d
Description: Vi IMproved – enhanced vi editor
Vim is an almost compatible version of the UNIX editor Vi.
.
Many new features have been added: multi level undo, syntax
highlighting, command line history, on-line help, filename
completion, block operations, folding, Unicode support, etc.
.
This package contains a version of vim compiled with a rather
standard set of features.  This package does not provide a GUI
version of Vim.  See the other vim-* packages if you need more
(or less).
Homepage: http://www.vim.org/
Tag: devel::editor, implemented-in::c, interface::text-mode, role::program, scope::application, uitoolkit::ncurses, use::editing, works-with::text, works-with::unicode

Here is a couple of commands to deal with this kind of search. You do not need to be root to run these commands.

fool@localhost:~$ debtags show vim

With this command above, you get all the tags within the vim package. This is similar to apt-cache show.

If you want to list all the packages available in the repositories with the “devel::editor” tag :

fool@localhost:~$ debtags search devel::editor

cream – VIM macros that make the VIM easier to use for beginners
csstidy – CSS parser and optimiser
drpython – simple and customizable editor for the Python language
eclipse-jdt – Eclipse Java Development Tools (JDT)
editra – simple multi-platform text editor
eieio – Enhanced Implementation of Emacs Interpreted Objects
elvis – powerful clone of the vi/ex text editor (with X11 support)
elvis-common – common files for elvis, elvis-console and elvis-tools
elvis-console – powerful clone of the vi/ex text editor (without X11 support)
elvis-tiny – Tiny vi compatible editor for the base system
elvis-tools – text editing tools for programmers (elvfmt, elvtags, ref)
emacs – The GNU Emacs editor (metapackage)
emacs-goodies-el – Miscellaneous add-ons for Emacs
emacs-intl-fonts – Fonts to allow multi-lingual PostScript printing from Emacs
emacs23 – The GNU Emacs editor (with GTK+ user interface)
emacs23-bin-common – The GNU Emacs editor’s shared, architecture dependent files
emacs23-common – The GNU Emacs editor’s shared, architecture independent infrastructure
emacs23-nox – The GNU Emacs editor (without X support)
emacsen-common – Common facilities for all emacsen
eric – full featured Python IDE
fte – Text editor for programmers – base package
fte-console – Text editor for programmers – console edition, no I18N support
fte-docs – Documentation and examples for the FTE editor
fte-terminal – Text editor for programmers – version for terminals
fte-xwindow – Text editor for programmers – X Window System edition with I18N support
gphpedit – development environment for PHP/HTML/CSS
haskell-mode – A major mode for editing Haskell in Emacs
infon-devel – Develop bots for the infon game
jed – editor for programmers (textmode version)
jed-common – S-Lang runtime files for jed and xjed
jed-extra – collection of useful Jed modes and utilities
jove – Jonathan’s Own Version of Emacs – a compact, powerful editor
js2-mode – Emacs mode for editing Javascript programs
jvim-canna – Japanized VIM (Canna version)
kate – K Advanced Text Editor
kobby – Collaborative text editor for KDE
kwrite – simple graphical text editor
lpe – Lightweight Programmer’s Editor
medit – A useful programming and around-programming text editor
monodevelop – Development Environment for GNOME
monodevelop-java – Java plugin for MonoDevelop
nvi – 4.4BSD re-implementation of vi
padre – Perl Application Development and Refactoring Environment
pida – Python Integrated Development Application, a Python IDE
plt-scheme – PLT Scheme Programming Environment
projectmanager.app – Simple IDE for GNUstep
pype – Python programmers editor
pyragua – Very lightweight Python editor
rkward – a KDE frontend to the R statistics language
scite – Lightweight GTK-based Programming Editor
vigor – nvi with the evil paperclip
vile – VI Like Emacs – vi work-alike
vile-common – VI Like Emacs – support files for vile/xvile
vile-filters – VI Like Emacs – highlighting filters for vile/xvile
vim – Vi IMproved – enhanced vi editor
vim-common – Vi IMproved – Common files
vim-gnome – Vi IMproved – enhanced vi editor – with GNOME2 GUI
vim-gtk – Vi IMproved – enhanced vi editor – with GTK2 GUI
vim-latexsuite – view, edit and compile LaTeX documents from within Vim
vim-lesstif – Vi IMproved – enhanced vi editor – with LessTif GUI
vim-nox – Vi IMproved – enhanced vi editor
vim-runtime – Vi IMproved – Runtime files
vim-scripts – plugins for vim, adding bells and whistles
vim-tiny – Vi IMproved – enhanced vi editor – compact version
vim-vimoutliner – script for building an outline editor on top of Vim
vimhelp-de – Vi IMproved – Documentation files (German translation)
wily – A work-alike of the Acme programming environment for Plan 9
wims – server for educative contents as courses, exercises, exams
xemacs21 – highly customizable text editor
xemacs21-basesupport – Editor and kitchen sink — compiled elisp support files
xemacs21-basesupport-el – Editor and kitchen sink — source elisp support files
xemacs21-bin – highly customizable text editor — support binaries
xemacs21-gnome-mule – highly customizable text editor — transitional package
xemacs21-gnome-mule-canna-wnn – highly customizable text editor — transitional package
xemacs21-gnome-nomule – highly customizable text editor — transitional package
xemacs21-mule – highly customizable text editor — Mule binary
xemacs21-mule-canna-wnn – highly customizable text editor — Mule binary compiled with Canna and Wnn
xemacs21-mulesupport – Editor and kitchen sink — Mule elisp support files
xemacs21-mulesupport-el – Editor and kitchen sink — source elisp support files
xemacs21-nomule – highly customizable text editor — Non-mule binary
xemacs21-support – highly customizable text editor — architecture independent support files
xemacs21-supportel – highly customizable text editor — non-required library files
xjed – editor for programmers (x11 version)
xvile – VI Like Emacs – vi work-alike (X11)

Then, you can install one of them with the apt-get program.

To find which tags have been created for a particular subject :

fool@localhost:~$debtags tagsearch perl

devel::lang:perl – Perl Development
implemented-in::perl – Perl

More info in the debtags manpage : man (1) debtags

Follow

Get every new post delivered to your Inbox.