Wikijc:Sistemas nagios
Instalar y configurar nagios
Descargamos el codigo fuente de Nagios(http://www.nagios.org/download/)
$ sudo apt-get install apache2
$ sudo apt-get install build-essential
$ sudo apt-get install libgd2-xpm-dev
$ sudo apt-get install libglib2.0-dev libglib2.0-0
$ sudo apt-get install build-essential
$ sudo apt-get install libgd2-xpm-dev
$ sudo apt-get install libglib2.0-dev libglib2.0-0
Usuario y grupo
$ sudo useradd -m nagios
$ sudo passwd nagios
Enter new UNIX password: nagios
Retype new UNIX password: nagios
passwd: password updated successfully
$ sudo passwd nagios
Enter new UNIX password: nagios
Retype new UNIX password: nagios
passwd: password updated successfully
$ sudo groupadd nagios
groupadd: group nagios exists
$ sudo usermod -G nagios nagios
groupadd: group nagios exists
$ sudo usermod -G nagios nagios
$ sudo groupadd nagcmd
$ sudo usermod -G nagcmd nagios
$ sudo usermod -G nagcmd www-data
$ sudo usermod -G nagcmd nagios
$ sudo usermod -G nagcmd www-data
Compilacion/Instalacion de Nagios
$ tar xzf nagios-3.0.3.tar.gz
$ cd nagios-3.0.3/
$ ./configure --with-command-group=nagcmd
checking for a BSD-compatible install... /usr/bin/install -c
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking whether make sets $(MAKE)... yes
$ cd nagios-3.0.3/
$ ./configure --with-command-group=nagcmd
checking for a BSD-compatible install... /usr/bin/install -c
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking whether make sets $(MAKE)... yes
- Configuration summary for nagios 3.0.3 06-25-2008 ***:
General Options:
Nagios executable: nagios Nagios user/group: nagios,nagios Command user/group: nagios,nagcmd Embedded Perl: no Event Broker: yes Install ${prefix}: /usr/local/nagios Lock file: ${prefix}/var/nagios.lock Check result directory: ${prefix}/var/spool/checkresults Init directory: /etc/init.d Apache conf.d directory: /etc/apache2/conf.d Mail program: /bin/mail Host OS: linux-gnu
Web Interface Options:
------------------------ HTML URL: http://localhost/nagios/ CGI URL: http://localhost/nagios/cgi-bin/ Traceroute (used by WAP):
Review the options above for accuracy. If they look okay,
type 'make all' to compile the main program and CGIs.
$ sudo make all
- Compile finished ***
If the main program and CGIs compiled without any errors, you
can continue with installing Nagios as follows (type 'make'
without any arguments for a list of all possible options):
can continue with installing Nagios as follows (type 'make'
without any arguments for a list of all possible options):
make install - This installs the main program, CGIs, and HTML files
make install-init - This installs the init script in /etc/init.d
make install-commandmode - This installs and configures permissions on the directory for holding the external command file
make install-config - This installs *SAMPLE* config files in /usr/local/nagios/etc You'll have to modify these sample files before you can use Nagios. Read the HTML documentation for more info on doing this. Pay particular attention to the docs on object configuration files, as they determine what/how things get monitored!
make install-webconf - This installs the Apache config file for the Nagios web interface
- Support Notes *******************************************
If you have questions about configuring or running Nagios,
please make sure that you:
please make sure that you:
- Look at the sample config files - Read the HTML documentation - Read the FAQs online at http://www.nagios.org/faqs
before you post a question to one of the mailing lists.
Also make sure to include pertinent information that could
help others help you. This might include:
Also make sure to include pertinent information that could
help others help you. This might include:
- What version of Nagios you are using - What version of the plugins you are using - Relevant snippets from your config files - Relevant error messages from the Nagios log file
For more information on obtaining support for Nagios, visit:
http://www.nagios.org/support/
Enjoy.
$ sudo make install
$ sudo make install-init
$ sudo make install-commandmode
$ sudo make install-config
$ sudo make install-webconf
$ sudo make install-init
$ sudo make install-commandmode
$ sudo make install-config
$ sudo make install-webconf
Configuramos la direccion de correo para Nagios Admin
$ sudo vi /usr/local/nagios/etc/objects/contacts.cfg
Configuracion de la web
Creamos un usuario (admin) para poder ver la web
$ sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users admin
New password: Indiviso0
Re-type new password: Indiviso0
Adding password for user admin
New password: Indiviso0
Re-type new password: Indiviso0
Adding password for user admin
Creamos un host virtual dentro de apache,en la ruta
$ vi /etc/apache2/sites-available/nagios
$ vi /etc/apache2/sites-available/nagios
ServerAdmin dvielba@blom.es ServerName miron.val.blom.lan ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbinOptions ExecCGI AllowOverride None Order allow,deny Allow from all AuthName "Nagios Access" AuthType Basic AuthUserFile /usr/local/nagios/etc/htpasswd.users Require valid-user
Alias /nagios /usr/local/nagios/shareOptions None AllowOverride AuthConfig Order allow,deny Allow from all AuthName "Nagios Access" AuthType Basic AuthUserFile /usr/local/nagios/etc/htpasswd.users Require valid-user ServerSignature Off
Con estas 4 lineas le añadimos autenticacion al servidor
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
Creamos un enlace en sites-enabled para que apache cargue la configuracion del host virtual
$ sudo /etc/init.d/apache2 restart
Compilacion/Instalacion de los Plugin de Nagios
$ sudo tar xvfz nagios-plugins-1.4.12.tar.gz
$ cd nagios-plugins-1.4.12/
$ sudo ./configure --with-nagios-user=nagios --with-nagios-group=nagios
$ cd nagios-plugins-1.4.12/
$ sudo ./configure --with-nagios-user=nagios --with-nagios-group=nagios
config.status: creating po/Makefile.in
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile
--with-apt-get-command: /usr/bin/apt-get --with-ping6-command: --with-ping-command: /bin/ping -n -U -w %d -c %d %s --with-ipv6: yes --with-mysql: no --with-openssl: no --with-gnutls: no --enable-extra-opts: no --with-perl: /usr/bin/perl --enable-perl-modules: no --with-cgiurl: /nagios/cgi-bin --with-trusted-path: /bin:/sbin:/usr/bin:/usr/sbin
$ sudo make
$ sudo make install
Configuracion de alertas por mail
$ sudo apt-get install mailx
$ sudo vi /usr/local/nagios/etc/objects/commands.cfg - lo editamos y cambiamos todo '/bin/mail' por '/usr/bin/mail'
Arranque de nagios
$ sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
Opciones de nagios
Nagios 3.0.6
Copyright (c) 1999-2008 Ethan Galstad (http://www.nagios.org)
Last Modified: 12-01-2008
License: GPL
Usage: /usr/local/nagios/bin/nagios [options]
Options:
-v, --verify-config Verify all configuration data -s, --test-scheduling Shows projected/recommended check scheduling and other diagnostic info based on the current configuration files. -x, --dont-verify-paths Don't check for circular object paths - USE WITH CAUTION! -p, --precache-objects Precache object configuration - use with -v or -s options -u, --use-precached-objects Use precached object config file -d, --daemon Starts Nagios in daemon mode, instead of as a foreground process
Visit the Nagios website at http://www.nagios.org/ for bug fixes, new
releases, online documentation, FAQs, information on subscribing to
the mailing lists, and commercial support options for Nagios.
Verificamos que no exista ningun error en Nagios
$ sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Nagios 3.0.3
Copyright (c) 1999-2008 Ethan Galstad (http://www.nagios.org)
Last Modified: 06-25-2008
License: GPL
Reading configuration data...
Running pre-flight check on configuration data...
Checking services...
Checked 8 services.
Checking hosts...
Checked 1 hosts.
Checking host groups...
Checked 1 host groups.
Checking service groups...
Checked 0 service groups.
Checking contacts...
Checked 1 contacts.
Checking contact groups...
Checked 1 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 24 commands.
Checking time periods...
Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors: 0
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
$ sudo /etc/init.d/nagios start
Starting nagios: done.
Starting nagios: done.
En el fichero cgi.cfg le decimos que usuario tiene permiso para ejecutar los cgi
Fuente http://nagios.sourceforge.net/docs/3_0/quickstart-ubuntu.html
Fuente http://nagios.sourceforge.net/docs/3_0/quickstart-ubuntu.html
No hay comentarios:
Publicar un comentario
Nota: solo los miembros de este blog pueden publicar comentarios.