Ir al contenido principal

COnfiguracion NAGIOS 3X--La experiencia

Me puse en la tarea de configurar NAGIOS, una herramienta de monitorización de dispositivos de red, servidores y otros.

Lo primero que hice fue darme una pasadita por wl WIKi de NAGIOS y relicé los siguientes pasos:

Articulo tomado de http://nagios.sourceforge.net/docs/3_0/quickstart-ubuntu.html

Introduction

This guide is intended to provide you with simple instructions on how to install Nagios from source (code) on Ubuntu and have it monitoring your local machine inside of 20 minutes. No advanced installation options are discussed here - just the basics that will work for 95% of users who want to get started.

These instructions were written based on an Ubuntu 6.10 (desktop) installation. They should work for an Ubuntu 7.10 install as well.

What You'll End Up With

If you follow these instructions, here's what you'll end up with:

Nagios and the plugins will be installed underneath /usr/local/nagios
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/
Required Packages

Make sure you've installed the following packages on your Ubuntu installation before continuing.

Apache 2
PHP
GCC compiler and development libraries
GD development libraries
You can use apt-get to install these packages by running the following commands:


sudo apt-get install apache2

sudo apt-get install libapache2-mod-php5

sudo apt-get install build-essential

With Ubuntu 6.10, install the gd2 library with this command:


sudo apt-get install libgd2-dev

With Ubuntu 7.10, the gd2 library name has changed, so you'll need to use the following:


sudo apt-get install libgd2-xpm-dev

1) Create Account Information

Become the root user.


sudo -s

Create a new nagios user account and give it a password.


/usr/sbin/useradd -m -s /bin/bash nagios

passwd nagios

On older Ubuntu server editions (6.01 and earlier), you will need to also add a nagios group (it's not created by default). You should be able to skip this step on desktop, or newer server editions of Ubuntu.


/usr/sbin/groupadd nagios

/usr/sbin/usermod -G nagios nagios

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

2) Download Nagios and the Plugins

Create a directory for storing the downloads.


mkdir ~/downloads

cd ~/downloads

Download 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.0.tar.gz

wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz

3) Compile and Install Nagios

Extract the Nagios source code tarball.


cd ~/downloads

tar xzf nagios-3.2.0.tar.gz

cd nagios-3.2.0

Run the Nagios configure script, passing the name of the group you created earlier like so:


./configure --with-command-group=nagcmd

Compile the Nagios source code.


make all

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

Don't start Nagios yet - there's still more that needs to be done...

4) Customize Configuration

Sample configuration files have now been installed in the /usr/local/nagios/etc directory. These sample files should work fine for getting started with Nagios. You'll need to make just one change before you proceed...

Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you'd like to use for receiving alerts.


vi /usr/local/nagios/etc/objects/contacts.cfg

5) 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. Remember the password you assign to this account - you'll need it later.


htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Restart Apache to make the new settings take effect.


/etc/init.d/apache2 reload

Note: Consider implementing the ehanced CGI security measures described here to ensure that your web authentication credentials are not compromised.

6) Compile and Install the Nagios Plugins

Extract the Nagios plugins source code tarball.


cd ~/downloads

tar xzf nagios-plugins-1.4.11.tar.gz

cd nagios-plugins-1.4.11

Compile and install the plugins.


./configure --with-nagios-user=nagios --with-nagios-group=nagios

make

make install

7) Start Nagios

Configure Nagios to automatically start when the system boots.


ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios

Verify the sample Nagios configuration files.


/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

If there are no errors, start Nagios.


/etc/init.d/nagios start

8) Login to the Web Interface

You should now be able to access the Nagios web interface at the URL below. You'll be prompted for the username (nagiosadmin) and password you specified earlier.


http://localhost/nagios/

Click on the "Service Detail" navbar link to see details of what's being monitored on your local machine. It will take a few minutes for Nagios to check all the services associated with your machine, as the checks are spread out over time.

9) Other Modifications

If you want to receive email notifications for Nagios alerts, you need to install the mailx (Postfix) package.


sudo apt-get install mailx

sudo apt-get install postfix

You'll have to edit the Nagios email notification commands found in /usr/local/nagios/etc/objects/commands.cfg and change any '/bin/mail' references to '/usr/bin/mail'. Once you do that you'll need to restart Nagios to make the configuration changes live.


sudo /etc/init.d/nagios restart

Configuring email notifications is outside the scope of this documentation. Refer to your system documentation, search the web, or look to the Nagios Support Portal or Nagios Community Wiki for specific instructions on configuring your Ubuntu system to send email messages to external addresses.


HAsta aqui todo muy bien, pero con el animo de poner a nagios mas facil de configurar en el momento de agregar host y demas dispositivos, busque un front-end que le ayudaría a nagios y encontré a CENTREON al parecer un update de Oreon, pero que tareita instalarlo de esta manera se logró:

http://www.planetit.ws/linux/debian/install-nagios-with-centreon-on-debian-based-distributions.html

Install Nagios with Centreon on Debian based Distributions

Article Stats:
Submitted by: Alex
Date: 2008-05-12 00:00:00
Views: 6791

Rating: 3.79

Introduction
About Nagios (http://www.nagios.org)
Nagios is a host and service monitor designed to inform you of network problems before your clients, end-users or managers do. It has been designed to run under the Linux operating system, but works fine under most *NIX variants as well. The monitoring daemon runs intermittent checks on hosts and services you specify using external "plugins" which return status information to Nagios. When problems are encountered, the daemon can send notifications out to administrative contacts in a variety of different ways (email, instant message, SMS, etc.). Current status information, historical logs, and reports can all be accessed via a web browser.

About Centreon (http://www.centreon.com)
Centreon is a network, system, applicative supervision and monitoring tool, it is based upon the most effective Open Source monitoring engine: Nagios. Centreon provides a new frontend and new functionalities to Nagios.

Prerequisites that not covered in this guide:
You will need some knowledge of basic Linux administration, in case you will need to do troubleshooting
You will need to be familiar with Nagios architecture, and know how to solve errors that come from nagios config validation
You will need an MTA daemon installed & configured, so nagios will able to send notifications, good examples are sendmail, postfix, exim.

Before we begin
All commands in this guide must be run as root user, in Ubuntu you can become a root user by using command "sudo -s".

This guide is indented for Debian/Ubuntu based distributions. It was tested on Debian 4.0r2, and Ubuntu 7.10 Server/Desktop.

Warning: Centreon installer will not work on Ubuntu 8.04 LTS, the installer failing to detect Apache User/Group names. It is because those settings are defined via environment variables in apache2.conf, those variables are located in /etc/apache2/envvars.
Still, you can use the installer after replacing 2 configuration options in apache2.conf
To do it, follow those commands:
# cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.default
# sed "s/\${APACHE_RUN_USER}/www-data/g" /etc/apache2/apache2.conf.default > /etc/apache2/apache2.tmp
# sed "s/\${APACHE_RUN_GROUP}/www-data/g" /etc/apache2/apache2.tmp > /etc/apache2/apache2.conf
# rm /etc/apache2/apache2.tmp

I recommend, to restore default apache configuration after Centreon Installation is finished:
# mv /etc/apache2/apache2.conf.default /etc/apache2/apache2.conf

Install required Ubuntu/Debian packages:
Sudo for Debian
# apt-get install sudo

dos2unix, Converts DOS <-> Unix text files, alias tofromdos
# apt-get install tofrodos

Apache 2 web server
# apt-get install apache2

Nagios 2
# apt-get install nagios2 nagios-plugins nagios-images nagios-nrpe-plugin

MySQL 5 database server
# apt-get install mysql-server-5.0

PHP5 + required modules
# apt-get install php5 php5-cli php-db php-date php5-gd php5-mysql php5-snmp \
php5-ldap php-mail php-mail-mime php-net-smtp php-net-socket php5-xmlrpc

RRDTool
# apt-get install rrdtool librrds-perl

Perl "ini" files support
# apt-get install libconfig-inifiles-perl

SNMP
# apt-get install snmp snmpd libnet-snmp-perl

Open file /etc/snmp/snmpd.conf for editing.
Find:
#com2sec readonly default public
Remove "#" sign

Save & restart SNMP deamon:
# invoke-rc.d snmpd restart

Test it:
# snmpget -v1 -c public localhost sysDescr.0

Successful output will be something like:
SNMPv2-MIB::sysDescr.0 = STRING: Linux monitor01 2.6.22-14-server #1 SMP Tue Feb 12 08:27:05 UTC 2008 i686

Additional pear modules
# pear channel-update pear.php.net
# pear upgrade pear
# pear install -f -a DB_DataObject DB_DataObject_FormBuilder MDB2 Numbers_Roman \
Numbers_Words HTML_Common HTML_QuickForm HTML_QuickForm_advmultiselect \
HTML_Table Auth_SASL HTTP Image_Canvas Image_Color Image_Graph \
Image_GraphViz Net_Traceroute Net_Ping Validate XML_RPC SOAP

Install optional packages, not required
PHPMyAdmin - web based Mysql console
# apt-get install phpmyadmin

JOE - Text editor
# apt-get install joe

Install Centreon
Download latest version of Centreon, http://www.centreon.com/Download/Download.html
By the time of writing the latest version is 1.4.2.6:
# wget http://download.centreon.com/centreon/centreon-1.4.2.6.tar.gz

Uncompress the archive
# tar xzvf centreon-1.4.2.6.tar.gz

Create symbolic link for nagios2, Centreon installation requires it
# ln -s /usr/sbin/nagios2 /usr/sbin/nagios

Run installation script
# cd centreon-1.4.2.6
# bash ./install.sh

Answer questions during install script
Are you sure to continue ?
[y/n], default to [n]: y

Were is installed Nagios ?
default to [/usr/local/nagios]: /usr/lib/cgi-bin/nagios2

Were is your nagios etc directory ?
default to [/usr/lib/cgi-bin/nagios2/etc]: /etc/nagios2

Were is your nagios var directory ?
default to [/usr/lib/cgi-bin/nagios2/var]: /var/lib/nagios2

Were is your nagios plugins (libexec) directory ?
default to [/usr/lib/cgi-bin/nagios2/libexec]: /usr/lib/nagios/plugins

Were is your nagios bin directory ?
default to [/usr/lib/cgi-bin/nagios2/bin]: /usr/sbin

Were is your nagios image directory ?
default to [/usr/lib/cgi-bin/nagios2/share/images]: /usr/share/nagios/htdocs/images/logos

Where do I install centreon ?
default to [/usr/local/centreon]: /usr/local/centreon

Do you want me to create this directory [/usr/local/centreon]?[Y/n] y

Where is sudo configuration file?
default to [/etc/sudoers]: /etc/sudoers

Where is installed RRD perl modules [RRDs.pm] ?
Just put directory, not full path.
default to [/usr/local/rrdtool/lib/perl]: /usr/lib/perl5

Where is rrdtool binary ?
default to [/usr/bin/rrdtool]: /usr/bin/rrdtool

Where is mail binary ?
default to [/usr/bin/mail]: /usr/bin/mail

Where is PEAR Path ?
default to [/usr/share/pear]: /usr/share/php

Do you want to install Centreon Plugins ?
[y/n], default to [y]: y

Do you want to install Centreon Traps Plugins ?
[y/n], default to [y]: y

Where is your SNMP configuration file?
default to [/etc/snmp/]: /etc/snmp

You already seem to have installed the plugins Centreon.
Do you want overwrite this file ? You must regenerate this one from Centreon interface.
[y/n], default to [n]: y

Specify user do you use for Centreon cron
Default to [nagios]

Apply writing permissions for plugins directory:
# chmod 775 /usr/lib/nagios/plugins

Restart Mysql server
# invoke-rc.d mysql restart

Restart Apache web server
# invoke-rc.d apache2 restart

Finalize the installation with the Centreon Web interface:
open in webrowser: http:///centreon/
replace with your server ip address or hostname.

Follow Centreon Setup instructions:
- Press Start
- Check "I Accept" and press Next
- Make sure that selected "Nagios Version" is "2.x", then press Next
- On next 2 screens, make sure that all components status is "OK", then press Next
- If everything is ok, then press Next again
- Fill required DB info, then press Next
· Root Password for MySQL: [Enter your DB root password]
· Centreon Database Name: centreon
· Centreon Data Storage Database Name: centreon_ods
· Database Password: centreon
· Confirm it: centreon
· MySQL Client version (Password Haching Changes): >=4.1 - PASSWORD()
- Press Next in the screen of DataBase Verification
- Fill required Admin user info, then press next.
- Check "No" in "LDAP Authentication" screen, then press Next
- Press Next again
- Press Next in "Creating Database" screen
- Press on "Click here to complete your install"

Fix paths to meet Nagios installation on Debian based distributions:
Login to Centreon Interface

Go to: Options -> Centreon -> General Options -> Nagios
Change settings to some options, as writed below:
Init Script: /etc/init.d/nagios2
Directory + Binary: /usr/sbin/nagios2
Press Save

Go to: Configuration -> Nagios -> CGI CFG, Press on Edit Icon
Change settings to some options, as writed below:
Physical HTML Path: /usr/share/nagios2/htdocs
URL HTML Path: /nagios2
Nagios Process Check Command: /usr/lib/nagios/plugins/check_nagios /var/cache/nagios2/status.dat 5 '/usr/sbin/nagios2'
Press Save

Go to: Configuration -> Nagios -> Nagios CFG, Press on Edit Icon
Change settings to some options, as writed below:
Log File: /var/log/nagios2/nagios.log
Temp File: /var/cache/nagios2/nagios.tmp
P1 File: /usr/lib/nagios2/p1.pl
Object Cache File: /var/cache/nagios2/objects.cache
Status File: /var/cache/nagios2/status.dat
Log Archive Path: /var/log/nagios2/archives/
Downtime File: /var/lib/nagios2/downtime.dat
Comment File: /var/lib/nagios2/comment.dat
Lock File: /var/run/nagios2/nagios2.pid
State Retention File: /var/lib/nagios2/retention.dat
Performance Data Processing Option: Yes
Service Performance Data Processing Command: process-service-perfdata
Press Save

Go back to terminal console, then...

Apply permissions, so Web interface can also send External Commands
# chmod g+rx /var/lib/nagios2/rw/

Also change ownership of nagios archive logs directory
# chown nagios:adm /var/log/nagios2/archives

Enable Centreon Data Storage (ods) deamon:
# update-rc.d ods defaults

Add htaccess user for nagios CGI:
# htpasswd -bc /etc/nagios2/htpasswd.users nagiosadmin P@ssw0rd

Reboot Server
# sync;sync;init 6

Start adding Hosts, Services, Contacts, Commands, Escalations...
Open Centreon web interface and Login
Start adding hosts, services, users
Restart Nagios to apply the changes, go to: Configuration -> Nagios
Select as writed below:
- Include Comments: Yes
- Run Nagios debug (-v): Yes
- Run Optimisation test (-s): Yes
- Move Export Files: Yes
- Restart Nagios: Yes, Restart
Press Export

This will restart Nagios & apply all changes you made in Web Interface.
You will do it every time you make changes like adding/modifying: hosts, commands, contacts, services...etc...etc...


Pero tambien me ayudaron las siguientes paginas:

http://www.debianhelp.co.uk/nagiosweb.htm
http://lindasantini.wordpress.com/2009/07/16/centreon/

Comentarios

Entradas populares de este blog

Vulnerabilidad en Bluetooth -- BIAS

Será el fin de TCP con la llegada de HTTP/3

La  IETF (Internet Engineering Task Force)  ha  publicado  información sobre lo que será el nuevo protocolo de transferencia de hypertexto que tanto usamos a diario, cuando accedemos a sitios web. HTTP/3 ya no usará TCP nunca más. En su lugar se ejecutará sobre el protocolo QUIC. El protocolo QUIC fue elaborado conceptualmente por Google en 2012 y tiene como objetivo mejorar tanto la seguridad como el rendimiento ofrecido por  TCP - Transmission Control Protocol , sobre todo lo segundo. ¿Qué es Quic y sus diferencias con TCP?   Quick UDP Internet Connections, es un protocolo de capa de transporte que se basa en el multiplexado de conexiones UDP. De hecho, QUIC utiliza esta combinación: TCP + TLS + SDPY sobre UDP Esto lo hace con varias mejoras respecto a la actual implementación de TCP. La IETF ha estado desde 2016 trabajando a fondo con una versión global del protocolo alumbra do por Google, y finalmente ha sido este año cuando ha decidido incluirlo en la nueva versión HTTP/3.   Sin e

Zoom y sus vulnerabilidades

Leyendo acerca de todas las quejas en cuanto a brechas de seguridad que tiene Zoom la plataforma de videoconferencia que conocí hace unos años, pero que ahora debido a la necesidad de estar en casa debido al COVID19, la ha convertido en la herramienta que muchos usan para sus reuniones empresariales virtuales, sus llamadas privadas o incluso para las fiestas virtuales o noches de Netflix.   Solo precisar que no es la única herramienta que se tiene para tener este tipo de video conferencias, alternativas como WhatsApp (Vulnerable- Facebook de por medio.. hmm) o como Teams de Microsoft, Cisco Webex, Webex Meetings (se necesita pago) o  Jitsi , esta última es de uso gratuito también y con algunas mejoras en su seguridad realizadas hace poco, puede ser una plataforma para cubrir esta necesidad.   Si  la opción es usar Zoom, no esta de más revisar este  link  para tratar de asegurar esta aplicación y sentirse un poco más tranquilo, o también puede ver el siguiente video.   Aquí les comparto