Archivo de la Categoría “Tips”

Hago un C&P completo de un post de Mundonix, que me ha pasado un compi y no quiero perder ;)
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 comes 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.
Notes before we begin:
- This guide is intended for Debian/Ubuntu based distributions. It was tested on Debian 5.0 64-bit, and Ubuntu 8.10/9.04 Server 64-bit
- Centreon version 2.1.x is required for this gude to work, version 2.0.x of Centreon won’t work with this article.
- It’s recommended to use a clean install of Debian/Ubuntu.
- All commands in this article must be run as root user, in Ubuntu you can become a root user by using command “sudo -s”.
Install required Ubuntu/Debian packages:
Debian only:
# apt-get install sudo lsb-release
dos2unix, Converts DOS <-> Unix text files, alias tofromdos:
# apt-get install tofrodos
MTA (exim by default) and mail utilities:
# apt-get install mailx
Apache web server and PHP5:
# apt-get install apache2 php5 php-pear php5-mysql php5-ldap php5-snmp php5-gd
MySQL-Server:
# apt-get install mysql-server-5.0
You will be asked to specify a new password for the MySQL “root” user. Remember it, we will use it later.

RRDTool:
# apt-get install rrdtool librrds-perl
Required Perl modules:
# apt-get install libconfig-inifiles-perl libcrypt-des-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl
SNMP daemon:
# apt-get install snmp snmpd libnet-snmp-perl libsnmp-perl
Install Nagios 3 and NDOutils for MySQL:
Type:
# apt-get install nagios3 nagios-nrpe-plugin ndoutils-nagios3-mysql
When asked for “Configure database for ndoutils-mysql with dbconfig-common?”, answer NO, Centreon installation script will deal with it.
Now let’s move/backup the original Nagios configuration directory, as Centreon will use its own structure for Nagios configuration files:
# mv /etc/nagios3 /etc/nagios3.orig
# mkdir /etc/nagios3
# cp -Rt /etc/nagios3 /etc/nagios3.orig/nagios.cfg /etc/nagios3.orig/apache2.conf /etc/nagios3.orig/stylesheets/
# chown nagios:www-data /etc/nagios3
# chmod ug+w /etc/nagios3
Install optional packages (not required):
OpenSSH server (Every linux server must have it!):
# apt-get install ssh
PHPMyAdmin – web based Mysql console:
# apt-get install phpmyadmin
Install Centreon:
Note: Before beginning the installation make sure you have an internet connection!
Now download the latest Centreon distribution (by the time of writing latest version was 2.1.1):
# cd; wget http://download.centreon.com/centreon/centreon-2.1.1.tar.gz
Centreon installation script will update PEAR modules (if required). If you are behind proxy, use following command for PEAR proxy configuration:
# pear config-set http_proxy http://<my_proxy>:<port>/
Replace “<my_proxy>” with to your proxy address and “<port>” with your proxy port.
Next, type following commands (remember to replace the names to Centreon version you use):
# tar xzf centreon-2.1.1.tar.gz
# cd centreon-2.1.1
# ./install.sh -i
Let’s follow the installation script questions:
Press “Enter” to read the Centreon License, then type “y” to accept it.
Do you want to install : Centreon Web Front
[y/n], default to [n]: y
Do you want to install : Centreon CentCore
[y/n], default to [n]: y
Do you want to install : Centreon Nagios Plugins
[y/n], default to [n]: y
Do you want to install : Centreon Snmp Traps process
[y/n], default to [n]: y
Where is your Centreon directory?
default to [/usr/local/centreon]: /usr/local/centreon
Do you want me to create this directory ? [/usr/local/centreon]
[y/n], default to [n]: y
Where is your Centreon log directory
default to [/usr/local/centreon/log]: /usr/local/centreon/log
Do you want me to create this directory ? [/usr/local/centreon/log]
[y/n], default to [n]: y
Where is your Centreon etc directory
default to [/etc/centreon]: /etc/centreon
Do you want me to create this directory ? [/etc/centreon]
[y/n], default to [n]: y
Where is your Centreon generation_files directory?
default to [/usr/local/centreon]: /usr/local/centreon
Where is your Centreon variable library directory?
default to [/var/lib/centreon]: /var/lib/centreon
Do you want me to create this directory ? [/var/lib/centreon]
[y/n], default to [n]: y
Where is your CentPlugins Traps binary
default to [/usr/local/centreon/bin]: /usr/local/centreon/bin
Do you want me to create this directory ? [/usr/local/centreon/bin]
[y/n], default to [n]: y
Where is the RRD perl module installed [RRDs.pm]
default to [/usr/lib/perl5/RRDs.pm]: /usr/lib/perl5/RRDs.pm
Where is PEAR [PEAR.php]
default to [/usr/share/php/PEAR.php]: /usr/share/php/PEAR.php
Where is installed Nagios ?
default to [/usr/local/nagios]: /usr/lib/cgi-bin/nagios3
Where is your nagios config directory
default to [/usr/local/nagios/etc]: /etc/nagios3
Where is your Nagios var directory ?
default to [/usr/local/nagios/var]: /var/lib/nagios3
Where is your Nagios plugins (libexec) directory ?
default to [/usr/local/nagios/libexec]: /usr/lib/nagios/plugins
Where is your Nagios image directory ?
default to [/usr/local/nagios/share/images/logos]: /usr/share/nagios/htdocs/images/logos
Where is your NDO ndomod binary ?
default to [/usr/sbin/ndomod.o]: /usr/lib/ndoutils/ndomod-mysql-3x.o
Where is sudo configuration file
default to [/etc/sudoers]: /etc/sudoers
Do you want me to configure your sudo ? (WARNING)
[y/n], default to [n]: y
Do you want to add Centreon Apache sub configuration file ?
[y/n], default to [n]: y
Do you want to reload your Apache ?
[y/n], default to [n]: y
Do you want me to install/upgrade your PEAR modules
[y/n], default to [y]: y
Where is your Centreon Run Dir directory?
default to [/var/run/centreon]: /var/run/centreon
Do you want me to create this directory ? [/var/run/centreon]
[y/n], default to [n]: y
Where is your CentStorage binary directory
default to [/usr/local/centreon/bin]: /usr/local/centreon/bin
Where is your CentStorage RRD directory
default to [/var/lib/centreon]: /var/lib/centreon
Do you want me to install CentStorage init script ?
[y/n], default to [n]: y
Do you want me to install CentStorage run level ?
[y/n], default to [n]: y
Where is your CentCore binary directory
default to [/usr/local/centreon/bin]: /usr/local/centreon/bin
Do you want me to install CentCore init script ?
[y/n], default to [n]: y
Do you want me to install CentCore run level ?
[y/n], default to [n]: y
Where is your CentPlugins lib directory
default to [/var/lib/centreon/centplugins]: /var/lib/centreon/centplugins
Do you want me to create this directory ? [/var/lib/centreon/centplugins]
[y/n], default to [n]: y
Where is your SNMP configuration directory
default to [/etc/snmp]: /etc/snmp
Where is your SNMPTT binaries directory
default to [/usr/local/centreon/bin/]: /usr/local/centreon/bin/
Continue the installation with the Centreon Web interface:
Open in web browser: “http://<yourserverip>/centreon/” replace “<yourserverip>” with your Centreon server ip address or hostname.
Follow Centreon Setup instructions:
- Press Start
- Check “I Accept” and press Next
- Make sure that selected “Nagios Version” is “3.x”, then press Next
- On next screen, make sure that all components status is “OK”, then press Next
- If all components are “OK”, then press Next again
- Fill required DB info as follows, then press Next
· Root Password for MySQL: [MySQL root password which you entered during MySQL installation]
· Centreon Database Name: centreon
· Centreon Data Storage Database Name: centstorage
· 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 (make sure that a username is Admin)
- 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”
NDOUtils configuration (from command line):
In Centreon version 2.1 and newer, NDO database is configured as part of the Centreon installation. We don’t need to configure manually. We only need to enable NDO, in “/usr/default/ndoutils”.
Edit the “/usr/default/ndoutils” by typing:
# vi /etc/default/ndoutils
Change “ENABLE_NDOUTILS=0″ to “ENABLE_NDOUTILS=1″
Finalize Centreon configuration:
Open in webrowser: “http://<yourserverip>/centreon/”, replace “<yourserverip>” with your Centreon server ip address or hostname.
Go to: Configuration -> Nagios -> cgi (in sidebar), Press on “CGI.cfg” link
Change settings to some options, as writed below:
- Physical HTML Path: /usr/share/nagios3/htdocs
- URL HTML Path     : /nagios3
- Nagios Process Check Command: /usr/lib/nagios/plugins/check_nagios /var/cache/nagios3/status.dat 5 ‘/usr/sbin/nagios3′
Press Save
Go to: Configuration -> Nagios -> nagios.cfg (in sidebar), Press on “Nagios CFG 1″ link, you should be in “Files” section of the configuration screen.
Make sure to set folowing configuration values:
- Log File              : /var/log/nagios3/nagios.log
- Downtime File         : /var/lib/nagios3/downtime.dat
- Comment File          : /var/lib/nagios3/comment.dat
- Temp File             : /var/cache/nagios3/nagios.tmp
- P1 File               : /usr/lib/nagios3/p1.pl
- Lock File             : /var/run/nagios3/nagios3.pid
- Object Cache File     : /var/cache/nagios3/objects.cache
- Status File           : /var/cache/nagios3/status.dat
- External Command File : /var/lib/nagios3/rw/nagios.cmd
Now Press on “Logs Options” tab to go to “Logs Options” section.
Make sure to set folowing configuration values:
- Log Archive Path     : /var/log/nagios3/archives/
- State Retention File : /var/lib/nagios3/retention.dat
Press Save
Go to: Administration -> Options -> CentStorage (in sidebar)
Make sure to set folowing configuration values:
- Nagios current log file to parse: /var/log/nagios3/nagios.log
Press Save
Now let’s apply our changes, go to: Configuration -> Nagios
Select as below:
- Generate Configuration Files
- Include Comments
- Run Nagios debug (-v)
- Move Export Files
- Restart Nagios
- Method: “External Command”
Press Export
This will restart Nagios & apply all changes you made in Web Interface.
You will do it every time you make changes, e.g. adding/modifying of hosts, commands, contacts, services…etc…
The installation of Centreon is completed.
Final fixes (very important):
Go to terminal console, then…
In Debian/Ubuntu the user “nagios” is set to “/bin/false” shell. Because of it “centcore” and “centstorage” daemons won’t start. A reason for that is because those daemons use “su -c” command which requires a real shell, so the shell for “nagios” user must be set to “/bin/sh”:
# usermod -s /bin/sh nagios
Apply permissions for Web interface to be able to send “External Commands”, perform the following commands to change directory permissions and to make the changes permanent:
# invoke-rc.d nagios3 stop
# dpkg-statoverride –update –add nagios www-data 2710 /var/lib/nagios3/rw
# dpkg-statoverride –update –add nagios nagios 751 /var/lib/nagios3
Add htaccess user with password “P@ssw0rd” for nagios CGI:
# htpasswd -bc /etc/nagios3/htpasswd.users nagiosadmin P@ssw0rd
Allow SNMP readonly access:
# echo “rocommunity public” > /etc/snmp/snmpd.conf
If you want to allow SNMP access only for localhost then use this instead:
# echo “rocommunity public 127.0.0.1″ > /etc/snmp/snmpd.conf
Now, restart the server
# sync;sync;init 6
That’s it, after reboot, you will have a fully functional Nagios & Centreon environment.
Feel free to add comments/suggestions.

Comments No Hay Comentarios »

Si en un anterior post comentaba como ver las cuentas de Hotmail en Gmail, en este voy a contar como hacer exactamente lo contrario. Aunque realmente podemos utilizar/integrar cualquier tipo de cuenta POP3.

1. Lo primero de todo es habilitar el POP en la cuenta de Gmail. Fijate que también en este mismo sitio se puede habilitar el acceso vía IMAP.

image

2. Ahora desde nuestra cuenta Windows Live, seleccionamos la opción de Agregar una cuenta de correo electrónico.

image

3. Finalmente proporcionamos los datos de la cuenta y ya tenemos todo lo que necesitamos para aprovechar nuestras cuentas de Gmail desde el servicio Windows Live Hotmail.

imageimage

Comments No Hay Comentarios »

Ayer comentaba como Windows Live permite ahora configurar vía POP3 las cuentas de Hotmail.

De esta manera ya no será necesario seguir utilizando “parches” tipo hotmail popper para ver el correo desde Outlook, Thunderbird, Mail, desde el Iphone, etc.

La configuración para tu cliente POP3 sería esta:

Servidor POP3: pop3.live.com (Puerto 995)  
¿POP3 SSL requerido?
User: Tu Windows Live ID, (nombre@hotmail.com, nombre@live.com, nombre@tudominio.com* )
Password: Tu password de Hotmail o Windows Live
Servidor SMTP: smtp.live.com (Puerto 25)  
Se requiere autenticación?
¿TLS/SSL requerido?

* nombre@tudominio.com tiene que estar dado de alta como Live ID, en un próximo post explico como se hace.

Además de esto, existe Outlook Conector que es lo que yo utilizo en mi Outlook 2007 porque:

  1. También permite Enviar y recibir desde buzones Windows Live, pero en lugar de usar POP3 utiliza cuentas MAPI.

Ver el correo electrónico de Windows Live Hotmail en Outlook

2. Da acceso a los contactos creados desde Windows Live en Oulook y a la inversa.

Ver los contactos de Windows Live Hotmail en Outlook

3. Al tener una cuenta Hotmail Plus (de pago) permite sincronizar también el calendario (Windows Live Calendar).

Comments 1 Comentario »

Hace unos pocos días en el blog de Windows Live se anunció la disponibilidad del servicio POP3 para cuentas Hotmail.

¿Qué supone este servicio?

A partir de ahora podemos utilizar este protocolo para descargarnos mensajes desde los servidores de Hotmail a nuestros dispositivos como una cuenta normal, por ejemplo podemos configurar la cuenta en móviles, clientes de correo como Outlook, Thunderbird, … y también desde cualquier otro servicio que permita el uso de este tipo de cuentas como por ejemplo GMail.

En Gmail podemos configurar varias cuentas de correo de forma que veamos en “Recibidos” el listado de todos los mensajes que vayamos recibiendo independientemente de la cuenta a la que nos hayan enviado y liberándonos de entrar a diferentes webs y aplicaciones para ver las diferentes cuentas de correo que tengamos .

Los pasos que tenemos que seguir para configurar nuevas cuentas en Gmail son:

  1. Accede a Gmail > Configuración > Cuentas > Recibir Mensajes de Otras Cuentas > Añadir otra cuenta de correo.
  2. Se te abrirá una ventana solicitando los datos de la nueva cuenta.

image

Una vez añadas la cuenta también te preguntará si deseas poder enviar a través de ella utilizando para ello los servidores de Gmail y te llegará un mail a la cuenta que estás configurando para que procedas a verificarlo.

image

Tras esto Gmail empieza a bajar el contenido de la cuenta.

image

En el ejemplo podéis ver que utilizo mi cuenta con el dominio sergiosainz.com, realmente una cuenta de Hotmail no tiene porque ser del tipo @hotmail.com sino que puede ser @loquequieras.com. Pero esto lo dejo para otro post.

Comments 2 Comentarios »

1. En Windows tenemos que tener un directorio compartido con permisos para el usuario que queramos utilizar.

2. En LINUX se crea el directorio donde queremos montar el directorio compartido:

# mkdir /mnt/equipowin/

3. Para montar hay que especificar la ruta del directorio compartido (//10.0.0.1/recurso), el usuario (sergiosainz), la contraseña (qwerty) y donde queremos montar (/mnt/equipowin), Sustituye esos valores por los que correspondan en tu caso y ya tienes la partición montada.

 
# mount -t cifs //10.0.0.1/recurso -o username=sergiosainz,password=qwerty /mnt/equipowin/

Comments 2 Comentarios »