Beruflich Dokumente
Kultur Dokumente
Teacher: Dr A. D. KORA
1.1.About Nagios
Visit www.nagios.org/about/ for more information on Nagios - including features, capabilities, and
technical specifications.
These quickstart guides are intended to provide you with simple instructions on how to install Nagios
from source (code) and have it monitoring your local machine and your network LAN inside of 20
minutes.
You can also find additional quickstart guides on the Nagios Community Wiki. Cant find a quickstart
for your particular OS? Write one and post it to the wiki for others. If you are installing Nagios on an
operating system or Linux distribution that isnt listed above, read the Fedora quickstart for an
overview of what youll need to do. Command names, paths, etc. vary widely across different OSes /
distributions, so youll likely need to tweak the installation docs a bit to work for your particular case.
These instructions were written based on an Ubuntu 10.04 LTS (desktop) installation. They should
work for an Ubuntu 10.04 or higher install as well.
Nagios will be configured to monitor a few aspects of your local system (CPU load, disk usage,
etc.)
The Nagios web interface will be accessible at http://localhost/nagios/ or http://ip-addressserver/nagios/ if that ip-addrerss-server is the IP address for your Nagios server.
2. Required Packages
Make sure youve installed the following packages on your Ubuntu installation before continuing.
You can use apt-get or aptitude command to install these packages by running the following
commands:
With apt-get install nom-paquet or aptitude install nom-paquet with nom-paquet is the name that you
want to install. But its necessary to have internet connexion on you your linux server.
Its necessary login with user root for privileges of installation.
# apt-get install build-essential autoconf automake libxmu-dev gcc-4.3 ; for installing packets
system
GD development libraries
You can use apt-get to install these packages by running the following commands:
# apt-get install apache2
; for apache2
# aptitude install radiusclient1 snmp snmpd ; for a good functional of nagios and installing SNMP
parquets
# aptitude install libgd2-noxpm-dev libpng12-dev libjpeg62 libjpeg62-dev
from nagios
# apt-get install gcc, g++ ,
# apt-get install libgd2-xpm-dev
# apt-get install libgd2-dev ; for install install the gd2 library
# apt-get install libgd2-xpm-dev ; for install install the gd2 library
3. Installation of nagios-3.2.3
3.1.Creating Account and group Information
Notes: In this TP through all pictures:
root is the user current connected
VAIO-SOIDRIDINE is the name of the server (Computer)
/home/moindze/ is the directory for connected user
Become the root user with command su. On linux you can use the su r name-user to change a user
and give the correspondence password.
Notes: the symbol # in the beginning of line means that the user root (administrator) is connected
And the symbol $ in the beginning of line means that an invite (not administrator user) user is connect.
$ sudo su root
Create a new nagcmd group for allowing external commands to be submitted through the web
interface. Add both the nagios user and the apache user to the group.
# /usr/sbin/groupadd nagcmd
# /usr/sbin/usermod -a -G nagcmd nagios
# /usr/sbin/usermod -a -G nagcmd www-data
Download directly with internet connexion on the linux host, the source code tarballs of both Nagios
and the Nagios plugins (visit http://www.nagios.org/download/ for links to the latest versions).
These directions were tested with Nagios 3.1.1 and Nagios Plugins 1.4.11.
# wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.3.tar.gz
# wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz
You can also download separately and copy file on the directory of your choice. For this installation, I
had downloaded nagios and nagios-plugins and saved these files on Documents.
I used cd command to enter in Document
#cd /Document
And I used the ls command to list content of Docuent
#ls
Extract the Nagios source code tarball from Documents and save the desarchive file on /usr/local/
I have used option -C for specify the destination directory .
# cd Documents
# tar xzvf nagios-3.2.3.tar.gz -C /usr/local
# ./configure --with-command-group=nagcmd
3.4.installation of binaries
You can use the commands bellow to install binaries, init script, sample config files and set permissions
on the external command directory.
# make install
# make install-init
# make install-config
# make install-commandmode
Dont start Nagios yet - theres still more that needs to be done...
3.5.Customize Configuration
In this TP was not change the mail but keep the default mail.
Figure 12: create a nagiosadmin user and his password for connexion web interface and start
apache2
Extract the Nagios-plugins source code tarball from Documents to /usr/local also.
Note: I had already download nagios-plugins above.
# cd /Documents
# tar xzf nagios-plugins-1.4.11.tar.gz -C /usr/local
Install nagios-plugins
# make
# make install
The output of make is bellow
5. Start Nagios
Configure Nagios to automatically start when the system boots.
# ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Note: If you have Total warning is 0 and Total error is o that means everything is Ok. If you have
another number in total warning there is not problem but ensure that you have total Errors is 0
We had not any errors, and i started Nagios with the bellow command:
# /etc/init.d/nagios start
You should now be able to access the Nagios web interface at the URL below. Youll be prompted for
the username (nagiosadmin) and password you specified earlier. You can open a web browser and tape:
http://localhost/nagios/ or http://127.0.0.1/nagios/ or http://192.168.1.2/nagios/
Here 192.168.1.2 is the address of nagios server.
After identification with login nagiosadmin and password nagios, the home page of nagios is bellow:
Click on the "Service Detail" navbar link to see details of whats being monitored on your local
machine. You can click on the MAP button to see the MAP of your network.
Once youve verified your configuration files and fixed any errors you can go ahead and (re)start
Nagios.
8. Starting and Stopping Nagios
Theres more than one way to start, stop, and restart Nagios. Here are some of the more common ones.
Tip: Always make sure you verify your configuration before you (re)start Nagios.
8.1. Starting Nagios
a) Init Script: The easiest way to start the Nagios daemon is by using the init script like so:
# /etc/rc.d/init.d/nagios start
b) Manually: You can start the Nagios daemon manually with the -d command line option like so:
# /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
b) Web Interface: You can restart the Nagios through the web interface by clicking the "Process
Info" navigation link and selecting "Restart the Nagios process":
c) Manually: You can restart the Nagios process by sending it a SIGHUP signal like so:
# kill -HUP <nagios_pid>
c) Manually: You can stop the Nagios process by sending it a SIGTERM signal like so:
# kill <nagios_pid>
Tip: When you follow quickstart installation guide above, several sample object configuration files are
placed in /usr/local/nagios/etc/objects/. You can use these sample files to see how object inheritance
works and learn how to define your own object definitions.
a) Hosts are one of the central objects in the monitoring logic. Important attributes of hosts are as
follows:
Hosts are usually physical devices on your network (servers, workstations, routers,
switches, printers, etc).
Hosts have an address of some kind (e.g. an IP or MAC address).
Hosts have one or more more services associated with them.
Hosts can have parent/child relationships with other hosts, often representing real-world
network connections, which is used in the network reachability logic.
b) Host Groups are groups of one or more hosts. Host groups can make it easier to (1) view the
status of related hosts in the Nagios web interface and (2) simplify your configuration through
the use of object tricks.
c) 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.)
d) Service Groups are groups of one or more services. Service groups can make it easier to (1)
view the status of related services in the Nagios web interface and (2) simplify your
configuration through the use of object tricks.
Commands are used to tell Nagios what programs, scripts, etc. it should execute to perform:
Host and service checks
Notifications
Event handlers
and more...
;device name
; alias
; IP address
;device type
server-backbone
Directive Descriptions:
host_name: This directive is used to define a short name used to identify the host. It is used in host
group and service definitions to reference this particular host. Hosts can have multiple services (which
are monitored) associated with them. When used properly, the $HOSTNAME$ macro will contain this
short name.
alias: This directive is used to define a longer name or description used to identify the host. It is
provided in order to allow you to more easily identify a particular host. When used properly, the
$HOSTALIAS$ macro will contain this alias/description.
address: This directive is used to define the address of the host. Normally, this is an IP address,
although it could really be anything you want (so long as it can be used to check the status of the host).
You can use a FQDN to identify the host instead of an IP address, but if DNS services are not 3333ccle
this could cause problems. When used properly, the $HOSTADDRESS$ macro will contain this
address. Note: If you do not specify an address directive in a host definition, the name of the host will
be used as its address. A word of caution about doing this, however - if DNS fails, most of your
service checks will fail because the plugins will be unable to resolve the host name.
parents: This directive is used to define a comma-delimited list of short names of the "parent" hosts for
this particular host. Parent hosts are typically routers, switches, firewalls, etc. that lie between the
monitoring host and a remote hosts. A router, switch, etc. which is closest to the remote host is
considered to be that hosts "parent". Read the "Determining Status and Reachability of Network
Hosts" document located here for more information. If this host is on the same network segment as the
host doing the monitoring (without any intermediate routers, etc.) the host is considered to be on the
local network and will not have a parent host. Leave this value blank if the host does not have a parent
host (i.e. it is on the same segment as the Nagios host). The order in which you specify parent hosts has
no effect on how things are monitored.