====== FAN Documentation  ======

{{:fandocpic:100000000000012c000000d41868ca3c.png|}}
----
====== Presentation of FAN ======

The purpose of FAN is to supply an installation CD which includes the most-used tools in the Nagios community. The FAN CD-ROM is ISO-certified. It is thus very easy to install.
A large number of tools are also being distributed, which makes the implementation of an efficient monitoring platform much easier.



===== Distribution =====

FAN is based on CentOS. All CentOS packages remain available, so that you can keep all the advantages of CentOS while having the Nagios tools already installed and configured for you.

Integrated tools:
  * Nagios: core monitoring application; 
  * Nagios plug-ins: plug-ins to monitor different equipments;
  * Centreon: Web interface for Nagios (Centreon is one of the best for this purpose!);
  * NagVis: advanced mapping (geographical, functional, by services…);
  * NDOUtils: stores the Nagios data into a MySQL database;
  * NRPE: makes it possible to monitor the Windows servers (the NRPE daemon is not provided);
  * NaReTo (Nagios Reporting Tools): reporting tool (availability report).

{{:fandocpic:100002010000018e0000008d8445cfdc.png|}}{{:fandocpic:10000201000001490000006f1ea8b8eb.png|}}

{{:fandocpic:10000201000001a10000007b728f367d.png|}}{{:fandocpic:100000000000016d00000098d9bbd0b3.png|}}



===== Subjects not covered =====

The following subjects will not be covered by this documentation: 
  * The configuration of Nareto;
  * The detailed use of Nagios plug-ins;
  * The string theory.


====== Existing software ======


===== Nagios =====

Nagios™ (formerly Netsaint) is an application for system and network monitoring. It monitors the hosts and services you have specified, and informs you about the state of your systems. It is an open-source software under GPL licence.
It is a modular program which can be broken down into 3 parts:

  - The application engine which schedules the monitoring tasks. 
  - The Web interface, which gives an overview of the information system and the possible anomalies.
  - The plug-ins, a hundred mini-programs or so, which can be configured according to the user’s needs in monitoring each service or resource available on all computers or network devices of the Information System.

Description of the program: 
  * Monitoring of network services: (SMTP, POP3, HTTP, NNTP, ICMP, SNMP, LDAP, etc…)
  * Monitoring of server resources (processor load, hard disk usage, paged memory usage), and all this on the most-widespread  operating systems.
  * Interface with the SNMP protocol.
  * The Remote Monitoring can use SSH or a SSL tunnel.
  * The plug-ins are written in programming languages which are best-adapted to their tasks: script shell (Bash, ksh...), C++, Perl, Python, Ruby, PHP, C#, etc...
  * The checking of services is performed in parallel.
  * It is possible to create a network hierarchy in order to be able to differentiate between an unreachable and a crashed server. 
  * The alert notification is fully configurable through plug-ins (alerts by e-mail, text message, etc…).
  * Alerts are acknowledged by the administrators.
  * Alert escalation management.
  * Control of visibility: the users can have their access restricted to some devices. 
  * Oscillation management (changes from a "normal" state to an "error" state within a short period of time).
  * Each test returns a particular state:
  - OK (everything is fine)
  - WARNING (the alert threshold has been exceeded)
  - CRITICAL (the service has a problem)
  - UNKNOWN (it is impossible to know the state of the service)

===== Centreon =====

Centreon is a network monitoring software based on the Nagios open-source tool.
Centreon has a user-friendly interface which makes it possible for a large number of users (including non-technical people) to view the state of the system, especially with graphics. However, technicians still have access to the Nagios technical information.
In July 2007, the Oreon software changed names to become Centreon.

The program includes: 
  * An intuitive and customisable multi-user interface;
  * An advanced configuration interface allowing the user to configure the area to be monitored;
  * Configuration help;
  * Management of all Nagios configuration files (cgi, nagios.cfg...);
  * A Nagios configuration load module;
  * Compatibility with Nagios 1.x, Nagios 2.x, Nagios 3.x;
  * A configuration validity check with the Nagios debugger;
  * Network server/hardware ID files which include all the basic information on these types of resources;
  * Advanced and customisable graphic representations;
  * Intelligent management of access rights, including resources as well as interface pages;
  * A system of modules which makes it possible to include other applications into Centreon;
  * A full incident report;
  * A real-time calculation system for quality of service which notifies the user whenever quality of service decreases;
  * A Java map which offers a simplified version of the information system’s state (property of the Merethis Company).


===== Nareto =====

NaReTo (Nagios Reporting Tools) is a High Level Interface based on Nagios. NaReTo uses the Nagios information to provide high-level views to different groups of users. It is possible to set up a navigation tree with NaReTo: by allocating specific rights to some tree nodes, the user’s view can be restricted. Three views are currently available: Real-time, Reporting, History and Monitoring of Alerts.


===== Nagvis =====

Nagvis is visualisation module. It makes it possible to create functional views of monitoring. Nagvis can be paired with a network diagram in order to send the Nagios data to the diagram in real-time.

Example of a Nagvis diagram:

{{:fandocpic:10000201000003fd000003747226d8f0.png|}}

====== Installation of FAN ======


Installing FAN is similar to installing a standard CentOS. It is quick and intuitive. No installation help is necessary. It requires 1 Gb.

Below are the installation steps:

{{:fandocpic:1.png|}}

{{:fandocpic:2.png|}}

{{:fandocpic:3.png|}}

{{:fandocpic:4.png|}}

{{:fandocpic:5.png|}}

{{:fandocpic:6.png|}}

{{:fandocpic:7.png|}}

{{:fandocpic:8.png|}}

{{:fandocpic:9.png|}}

{{:fandocpic:10.png|}}

{{:fandocpic:11.png|}}

{{:fandocpic:12.png|}}

{{:fandocpic:13.png|}}

{{:fandocpic:14.png|}}

{{:fandocpic:15.png|}}


The Nagios process, which is vital to the functioning of the platform, is already running.
Isn’t it wonderful?




====== First configuration ======


In order to be able to use our new platform, a little configuration is required:
You must at least configure:
  * The network (IP address, routes, DNS…)
  * The machine's name

===== Interface réseau =====
The following command allows you to configure the server’s network interfaces :
<code># system-config-network</code>
Or
<code>
# vi /etc/sysconfig/networking/devices/ifcfg-eth0

DEVICE=eth0
ONBOOT=yes
HWADDR=00:0c:29:72:44:a3
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=192.168.1.21
GATEWAY=192.168.1.1</code>

===== Configuring the routes =====

<code># route add –net 0.0.0.0 gw 10.166.200.252 netmask 255.255.255.0</code>  (10.166.200.252 being the gateway)
Other routes will not be taken into account during startup.
To do so, you need to put them into a text file:
<code># touch /etc/sysconfig/network-scripts/route-eth0
# vi /etc/sysconfig/network-scripts/route-eth0
GATEWAY0=10.166.200.254
NETMASK0=255.255.0.0
ADDRESS0=10.174.0.0</code>
===== Rebooting the network interfaces =====
<code># ifup eth0</code> after configuring via system-config-network

===== Backing up/Restoring the network configuration =====

Back-up :
<code># system-config-network-cmd -e > /tmp/network-config</code>
Restoration :
<code># system-config-network-cmd -i -c -f /tmp/network-config</code>
The -i option indicates the data import, the –c option triggers the deletion (before import) of the existing configuration and the -f option specifies which file to import.

===== The DNS =====

<code># vi /etc/resolv.conf
nameserver myDNS
nameserver DNSpublic
search mydomain</code>

===== The machine’s name =====

<code># vi/etc/sysconfig/network
HOSTNAME=Nagios</code> (where Nagios is the new name :-) )
<code># hostname Nagios</code> (log in again) 

For those who’d rather have a graphical interface:

===== Installing the graphical environment =====

<code># yum --exclude=nautilus-sendto groupinstall "GNOME Desktop Environment" "X Window System"
# startx
# system-config-display (for display configuration)</code>

====== First steps ======


All monitoring tools have now been installed and configured (just what we needed!).

For those who can’t wait, it is possible to access the project home page (from a network computer) via: http://ip-serveur/ 

{{:fandocpic:ip2.png|}}

This home page contains all the different services offered by FAN. You just have to click on Nagios, for example, to access the Nagios interface.
As indicated above, the default login and password are: **nagiosadmin/nagiosadmin**.


__Nagios :__ 

{{:fandocpic:10000201000004200000023f00cfab2a.png|}}

__Nagvis :__ 

{{:fandocpic:10000201000004210000021113bb0c47.png|}}

__Nareto :__ 

{{:fandocpic:10000201000003cf0000025f80b122d7.png|}}

__Centreon :__ 

{{:fandocpic:10000201000003cc00000241486c4a79.png|}}

====== Prerequisites ======

===== Defining the requirements =====

Before the first line of command, it is important to precisely define the requirements.

The following questions should be asked:

  * Which device to monitor?
  * Which service to monitor?
  * Who will receive the e-mails?
  * Who will use this platform and modify it?

This step is very important. If enough details are given, the configuration of Nagios/Centreon will be made much easier.

There is no "miracle method", but the following advice can be useful:
  * Make a list of all the devices to be monitored (name and IP address);
  * Identify the critical services and attach them to the devices;
  * Set up a logical alert notification policy (define contacts and contact groups);
  * Create a network diagram which details the dependency of the devices;
  * More advice?

====== Configuring Nagios ======


The FAN project offers different configuration choices: The platform administrator can choose to only use Nagios. I will now give more details about platform configuration and I will use the Nagios text file configuration method.

First of all, it is important to know where the main files and directories are located.

===== Important directories =====

<code>/etc/nagios
/usr/lib/nagios
/usr/share/nagios</code>

=====Description of files =====

<code># ls /etc/nagios/</code>

  * cgi.cfg: CGI configuration file;
  * localhost.cfg: definition of host "localhost" (Nagios, in other words);
  * ndomod.cfg: NDOUtils configuration file;
  * resource.cfg: possibility to define sensitive information (identifier, password…);
  * command-plugins.cfg: definition of the Check commands;
  * nagios.cfg: main Nagios configuration file;
  * ndomod-load.cfg: NDOUtils configuration file ("broker_module" location);
  * send_nsca.cfg: NSCA configuration file;
  * commands.cfg: definition of commands (Check and Notification commands);
  * nagvis.ini.php: default Nagvis configuration file;
  * nrpe.cfg: NRPE server configuration file;
  * htpasswd.users: stores the usernames and passwords having access to Nagios (encrypted);
  * ndo2db.cfg: NDOUtils configuration file;
  * nsca.cfg: NSCA server configuration file.

===== Methodology =====


In order to add a host with services to monitor, several files need to be configured:
The following examples will help you understand how to configure Nagios. It is intended for people who have no or little knowledge of Nagios, and the following information is given as advice:
In order to simplify configuration, you can:

Create a "conf.d" directory located in "/etc/nagios/" where you will place all your configuration files.
Depending on your monitoring architecture (multi-site or not), you can create a directory with the company’s or the site’s name.

Create files named: 
  * servers_nameofsite.cfg;
  * printers_ nameofsite.cfg; 
  * switches_ nameofsite.cfg;
  * routers_ nameofsite.cfg.

In this way, the different devices will be defined according to their types.

We also advise you to create the following files: 
  * contacts.cfg : to define contacts;
  * dependances.cfg : to manage dependencies;
  * extinfo.cfg: to add graphical functionalities (icon…);
  * services.cfg: to define services;
  * hostgroups.cfg: to define host groups;
  * generic-host.cfg: to define host templates;
  * generic-service.cfg: to define service templates;
  * time-period.cfg: to define notification periods.

===== Example of configuration =====


==== servers_nameofsite.cfg ====

<code>#declaring a server				; comment
define host {
host_name	SRVLEMANS		;device name
alias		Server Le Mans	; alias
address	10.166.200.100	; IP address
use		 generic-host		;device type
}</code>


<code>#declaring a server
define host {
host_name	Fax-Server
alias		Fax Server
address	10.166.200.183
use		generic-host
}</code>


==== routers_ nameofsite.cfg ====

<code>#declaring a router
define host {
host_name	ASA-5505
alias		Cisco Router ASA-5505
address	10.166.200.252
use		generic-host
}</code>


<code>#declaring a router
define host {
host_name	Google
alias		Search engine
address	www.google.com
use		generic-host
parents	ASA-5505		; device it depends on (geographically) (status_map)
}</code>


The files switches_nameofsite.cfg and printers_nameofsite.cfg have the same configuration type.


==== hostgroups.cfg  ====

<code>#All devices
define hostgroup {
hostgroup_name	All
alias			All devices
members		*
}

# declaring a group
define hostgroup {
hostgroup_name	LINUX Servers 	; name of group
alias			Axians LINUX Servers; alias
members		nagios			; group member, corresponds to the host_name
}

# declaring a group
define hostgroup {
hostgroup_name 	WINDOWS Servers
alias			Axians WINDOWS Servers 
members		SRVLEMANS, Fax Server
}</code>


==== services.cfg  ====

<code>define service{
use			generic-service	; used template
host_name		nagios			; name of the affected host
service_description	User Number 		; name of service
check_command	check_users!20!50 	; used command (commands.cfg)
}

define service{
use			generic-service
	hostgroup_name	srv-linux		; name of the affected group
	service_description	Total Processus
	check_command	check_procs!400!800
	}

define service{
	use			generic-service
	host_name		nagios
	service_description	Current Load
	check_command	check_load!5.0!4.0!3.0!10.0!6.0!4.0
	}
</code>

==== generic-host.cfg  ====
<code>
define host{
	name                            generic-host    ; The name of this host template
	notifications_enabled           1       ; Host notifications are enabled
	event_handler_enabled           1       ; Host event handler is enabled
	flap_detection_enabled          1       ; Flap detection is enabled
	failure_prediction_enabled      1       ; Failure prediction is enabled
	process_perf_data               1       ; Process performance data
	retain_status_information       1       ; Retain status information across program restarts
	retain_nonstatus_information    1       ; Retain non-status information across program restarts
	check_command                   check-host-alive ; commande de test par défaut (ping)
	max_check_attempts              10
	notification_interval           0
	notification_period             24x7
	notification_options            d,u,r
	contact_groups                  admins
	register                        0    
	}</code>


==== generic-service.cfg  ====

<code>define service{
	name                            generic-service ; The 'name' of this service template
	active_checks_enabled           1       ; Active service checks are enabled
	passive_checks_enabled          1       ; Passive service checks are enabled/accepted
	parallelize_check               1       ; Active service checks should be parallelized (disabling this can lead to major performance problems)
	obsess_over_service             1       ; We should obsess over this service (if necessary)
	check_freshness                 0       ; Default is to NOT check service 'freshness'
	notifications_enabled           1       ; Service notifications are enabled
	event_handler_enabled           1       ; Service event handler is enabled
	flap_detection_enabled          1       ; Flap detection is enabled
	failure_prediction_enabled      1       ; Failure prediction is enabled
	process_perf_data               1       ; Process performance data
	retain_status_information       1       ; Retain status information across program restarts
	retain_nonstatus_information    1       ; Retain non-status information across program restarts
	notification_interval           0		; Only send notifications on status change by default.
	is_volatile                     0
	check_period                    24x7
	normal_check_interval           5
	retry_check_interval            1
	max_check_attempts              4
	notification_period             24x7
	notification_options            w,u,c,r
	contact_groups                  admins
	register                        0 
	}</code>


==== extinfo.cfg ====
 
<code>define hostextinfo{
	hostgroup_name	LINUX servers
	notes			LINUX servers
	icon_image		base/debian.png
	icon_image_alt	Debian GNU/Linux
	vrml_image		debian.png
	statusmap_image	base/debian.gd2
	}</code>


==== time-period.cfg ====

<code>define timeperiod{
	timeperiod_name workhours
	alias           Standard Work Hours
	monday          09:00-17:00
	tuesday         09:00-17:00
	wednesday       09:00-17:00
	thursday        09:00-17:00
	friday          09:00-17:00
	}</code>


==== dependances.cfg  ====

<code>define hostdependency {
	host_name		      ASA-5505	
	dependent_host_name           google
	notification_failure_criteria     d     ; d -> down
	}</code>
# If the ASA-5505 device is down, then no notification will be sent about the Google device.


If you want more information about these files, please refer to the official Nagios documentation at: http://nagios.sourceforge.net/docs/2_0/xodtemplate.html


Please note:
I won’t go into too much detail about the different possible monitoring tests, since it is not the purpose of this documentation. However, you will find many links on this subject in the appendix.

With the above examples of configuration, you can quickly obtain a monitoring platform of this type:

{{:fandocpic:10000201000004210000022138180bfe.png|}}

Tactical Overview: 87 Hosts up and 156 services tested.

{{:fandocpic:100002010000041f0000023daccf3f54.png|}}

Host Group – Summary: displays the host group with its statuses.


{{:fandocpic:100002010000041f00000227b98e86e0.png|}}

We now zoom in on the SRVLEMANS server:
The above server is monitored via Nsclient++/Check_nt.
For more information:
 http://blog.nicolargo.com/2007/10/surveiller-vos-serveurs-windows-avec-nagios.html 


===== Nagios tricks =====
 


==== Testing the configuration: ====

<code># nagios –v /etc/nagios/nagios.cfg</code>

==== Displaying statistics: ====

<code># nagiostats -c /etc/nagios/nagios.cfg
----
Total Services:                       156
Passive Service Checks:               0
Total Service State Change:           0.000 / 12.370 / 0.138 %
Active Service Latency:               0.003 / 1.127 / 0.485 sec
Active Service Execution Time:        0.010 / 4.200 / 1.680 sec
Active Service State Change:          0.000 / 12.370 / 0.138 %
-----
Total Hosts:                          87
Active Host State Change:             0.000 / 10.530 / 0.121 %
Active Hosts Last 1/5/15/60 min:      9 / 43 / 87 / 87
Passive Host State Change:            0.000 / 0.000 / 0.000 %
Passive Hosts Last 1/5/15/60 min:     0 / 0 / 0 / 0
Hosts Up/Down/Unreach:                87 / 0 / 0
Hosts Flapping:                       0
Hosts In Downtime:		0</code>

==== Nagios Checker ====

"Nagios Checker" is a Firefox add-on. In the status bar of your favourite browser, it informs you of all events raised by Nagios.
You can find it here: https://addons.mozilla.org/fr/firefox/addon/3607 

{{:fandocpic:100002010000016200000061ccbcab2e.png|}}

{{:fandocpic:10000201000001b5000000619aa39597.png|}}


==== Conclusion ====


We have now seen the minimum Nagios configuration. Configuring Nagios can be difficult and tiresome, and it requires meticulous organising and naming. On top of that, the Nagios web interface does not allow platform modification in any way. This is the reason why the Centreon tool is very popular in the community.

We are now going to have a look at the platform configuration via Centreon. We’re starting all over again, how exciting is that?

Please note:
It is possible to "inject" a Nagios configuration within Centreon, we’ll show you how in the "Centreon configuration" section.

====== Configuring Centreon ======

Unlike Nagios, Centreon needs to be configured via its web interface. After installing FAN, Centreon can work immediately.

===== Important directory =====

<code># /usr/share/centreon/</code>

===== Overview =====

{{:fandocpic:10000201000003cc00000241486c4a79.png|}}

Centreon Home Page. The default language is English.
In order to change languages: "Options" > "My account" > "Language".


{{:fandocpic:100002010000042100000243eae9b5a4.png|}}

The Monitoring tab lets you view the monitoring status. By default, it only displays problematic devices (with a "warning" or "critical" status). In order to view all the devices, please select "All Services".

{{:fandocpic:1000020100000421000001bd840f3f8f.png|}}

The undeniable advantage of Centreon over Nagios is that it can be configured via its web interface. 
Please select "Configuration" > "Hosts".


You can modify or duplicate the host configuration by clicking on it. Duplicating consists in copying and pasting the host configuration: you then just have to modify the name and the IP address.

{{:fandocpic:10000201000004210000022bd834fdc8.png|}}

It functions the same for services. Please note that services can be listed by "host" or "hostgroup".

{{:fandocpic:1000020100000421000001c1b5a98d1c.png|}}


The "Configuration" > "Users" tab lets you add users or user groups and modify time slots or notification commands.

{{:fandocpic:1000020100000421000002730b12a93b.png|}}

{{:fandocpic:100002010000030100000587467f7882.png|}}


===== Installing the Status Map =====


The "status map" module is the same as the one installed by default in Nagios. It allows you to have a graphical overview of the network, including the different levels of architecture.


Here is the installation process:
Download the sources:
<code># wget http:; download.oreon-project.org/index.php?id=60</code>
Decompress them:
<code># tar -xvzf NagiosStatusMap-1.1.tar.gz</code>
Place them into the Centreon directory:
<code># cp -r statusmap/ /usr/share/centreon/www/modules/</code>


{{:fandocpic:1000020100000421000001678b49889c.png|}}

Click on "Install module" in the "Actions" field.


{{:fandocpic:1000020100000421000002a919f38ec6.png|}}

{{:fandocpic:100002010000041f0000007de3a4bad2.png|}}


The module has now been installed.

You can display the "status map" in the "Monitoring" field then "Nagios Status Map".




====== Configuring Nagvis ======


We are now going to have a look at the Nagvis configuration.

<code>http://<nagiosserver>/<path-to-nagvis>/config.php</code>

example : http://10.166.200.162/nagios/config.php

or

http://10.166.200.162/nagios/nagvis/wui/ 

