Académique Documents
Professionnel Documents
Culture Documents
Nagios
Core
Is an open source system and network monitoring
application
http://en.wikipedia.org/wiki/Comparison_of_network_monit
oring_systems
Requirements
Mandatory :
A machine
running Linux (or UNIX variant) that has network access and
a C compiler installed
Optional :
You are not required to use the CGIs included with Nagios Core, but if you
use it, you need to have installed:
a web server (preferably Apache)
PHP
Thomas Boutells GD library version 1.6.3 or higher (this allows to use
Nagios with web interface)
Nagios Features
How it works:
Installing (steps):
1) Required packages
Install Apache 2
Install PHP
Install GCC compiler and development libraries *
Install GD development libraries **
*GNU Compiler Collection (GCC) is a compiler system produced by the GNU Project, supporting various programming languages
**GD Graphics Library is a graphics software library by Thomas Boutell and others for dynamically manipulating images
5) Configure email
Change the email address associated with the nagiosadmin contact definition to the
address youd like to use for receiving alerts
(in usr/local/nagios/etc/objects/contacts.cfg file)
6) Configure the Web Interface
Install the Nagios web config file in the Apache conf.d directory (make install-webconf)
Create a nagiosadmin account for logging into the Nagios web interface
Restart Apache
> make install-webconf
> htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
> /etc/init.d/apache2 reload
Hosts:
Are one of the central objects in the monitoring logic
are usually physical devices on your network (servers, workstations, routers,
switches, printers, etc.)
have an address of some kind (e.g. an IP or MAC address)
have one or more more services associated with them
can have parent/child relationships with other hosts, often representing real-world
network connections, which is used in the network reachability logic
Services
Are one of the central objects in the monitoring logic
Services are associated with hosts and can be:
Attributes of a host (CPU load, disk usage, uptime, etc.)
Services provided by the host (HTTP, POP3, FTP, SSH, etc.)
Other things associated with the host (DNS records, etc.)
Contacts
Are people involved in the notification process, which:
have one or more notification methods (cellphone, pager,email, instant
messaging, etc.)
receive notifications for hosts and services they are responsible for
Timeperiods
Are used to control:
When hosts and services can be monitored
When contacts can receive notifications
Commands:
Are used to control:
When hosts and services can be monitored
When contacts can receive notifications
Host Groups/Service Groups/Contact Groups
Host/Service groups make it easier to view the status of related hosts/services in
the Nagios web interface
Contact groups make it easier to define all the people who get notified when
certain host or service problems occur
Monitor a printer
check_hpjd plugin
Check_hpjd plugin will only get compiled and installed if you have the net-snmp and
net-snmp-utils packages installed on your system
Used terms:
Simple Network Management Protocol (SNMP) is an "Internet-standard protocol
for managing devices on IP networks.
SNMP is one of the most commonly used technologies when it comes to network
monitoring
MIB(Management Information Base) is a collection of information organized
hierarchically. These are accessed using a protocol such as SNMP.
Install net-snmp
1. Install snmp if not installed:
> apt-get update && apt-get install snmpd
2. Enable snmp:
Edit the file /etc/snmp/snmp.conf and comment out the line containing "mibs:
From the console (Ctrl-Alt-t), enter the following commands:
> sudo apt-get install snmp-mibs-downloader
> sudo download-mibs
#cfg_file=/usr/local/nagios/etc/objects/printer.cfg
2. Edit the printer.cfg file (/usr/local/nagios/etc/objects/printer.cfg) and replace
printer IP (and name, alias and so on) with the correct value
3. Restart Nagios:
> sudo /etc/init.d/nagios restart
Modify the /etc/services and add the following at the end of the file.
nrpe 5666/tcp # NRPE
Start the service
service xinetd restart
Verify whether NRPE is listening
netstat -at | grep nrpe
Verify to make sure the NRPE is functioning properly
/usr/local/nagios/libexec/check_nrpe -H localhost
On Monitoring Server
Download NRPE Add-on
Install check_nrpe
Create host and service definition for remote host
Restart the nagios service
1. Download NRPE Add-on
2. Install check_nrpe on the nagios monitoring server
> cd ~/downloads
> wget http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe2.14/nrpe-2.14.tar.gz
> tar xzf nrpe-2.14.tar.gz
> cd nrpe-2.14
> ./configure
###################
Note: If you get the checking for SSL headers configure: error: Cannot find ssl
headers error message while performing ./configure, do the following:
define service{
use generic-service
host_name remotehost
service_description Root Partition
contact_groups admins
check_command check_nrpe!check_disk
}
Note: In all the above examples, replace remotehost with the corresponding
hostname of your remotehost.
4) Restart the nagios service
service nagios reload
Resources:
1. http://nagios.sourceforge.net/docs/3_0/quickstart.html
2. http://library.nagios.com/library/products/nagioscore/manuals/
3. http://sixrevisions.com/tools/10-free-server-network-monitoring-tools-thatkick-ass/
4. http://en.wikipedia.org/wiki/Comparison_of_network_monitoring_systems
5. https://nagios.demo.netways.de/nagios/
6. http://www.paessler.com/knowledgebase/en/topic/653-how-do-snmp-mibsand-oids-work
7. http://askubuntu.com/questions/141564/what-is-snmp-used-for
8. http://www.thegeekstuff.com/2008/06/how-to-monitor-remote-linux-hostusing-nagios-30/