viernes, 19 de julio de 2013

Solaris boot devices

Hola,

 seguro que en todos o practicamente todos nuestros servidores Solaris tenemos el sistema en RAID 1 entre dos discos. Vamos a ver como comprobarlo y ver que el servidor arranca con el disco adecuado.

El hardware de Sparc de Solaris tiene una eeprom donde guarda los parametros de hardware y arranque del sistema. Algo parecido a la BIOS del PC, Sun en su momento le llamo Open Boot Prompt. Se pude acceder directamente a ella con "init 0" al finalizar veremos un el "ok" prompt que nos indicará que estamos en ella.

También podemos acceder a Open Boot Prompt des de el propio sistema operativo con el comando "eeprom".
root@myserver # eeprom
nvramrc=devalias mirrordisk /ssm@0,0/pci@18,600000/pci@1/scsi@2/disk@0,0
devalias rootdisk /ssm@0,0/pci@19,700000/pci@2/scsi@2/disk@0,0
devalias cdrom /ssm@0,0/pci@19,700000/pci@2/scsi@2/disk@6,0:f
network-boot-arguments: data not available.
secondary-diag?=false
auto-boot-timeout=512
scsi-initiator-id=7
powerfail-time=0
fcode-debug?=true
output-device=/sgcn
input-device=/sgcn
load-base=0x4000
boot-command=boot
auto-boot?=true
error-reset-recovery=sync
diag-file: data not available.
boot-file: data not available.
diag-device=disk diskifp diskglm diskc net
boot-device=rootdisk mirrordisk
local-mac-address?=false
ansi-terminal?=true
screen-#columns=80
screen-#rows=34
silent-mode?=false
use-nvramrc?=true
oem-logo: data not available.
oem-logo?=false
oem-banner: data not available.
oem-banner?=false
security-mode=none
security-password: data not available.
security-#badlogins: data not available.
hardware-revision: data not available.
last-hardware-update: data not available.
#power-cycles: data not available.
diag-switch?=false

Podemos ver todas la variables. Nos interesa ver el boot-device que és donde está el orden de arranque de los dispositivos. En nuestro ejemplo:
boot-device=rootdisk mirrordisk
Y los alias corresponden a los siguientes dispositivos:

mirrordisk /ssm@0,0/pci@18,600000/pci@1/scsi@2/disk@0,0
rootdisk /ssm@0,0/pci@19,700000/pci@2/scsi@2/disk@0,0

Bien ahora identificamos en que disco tenemos la partición "/" o root.

root@myserver(SunOS-5.10) # df -h /dev/md/dsk/d0
Filesystem             size   used  avail capacity  Mounted on
/dev/md/dsk/d0         9.6G   3.4G   6.2G    36%    /
Se encuentra en el dispositivo de raid /dev/md/dsk/d0. Vamos a ver su estado con metastat. También nos mostrara los devices.

root@myserver(SunOS-5.10) # metastat d0
d0: Mirror
    Submirror 0: d10
      State: Okay        
    Submirror 1: d20
      State: Okay        
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 20494464 blocks (9.8 GB)

d10: Submirror of d0
    State: Okay        
    Size: 20494464 blocks (9.8 GB)
    Stripe 0:
        Device     Start Block  Dbase        State Reloc Hot Spare
        c1t0d0s0          0     No            Okay   Yes


d20: Submirror of d0
    State: Okay        
    Size: 20494464 blocks (9.8 GB)
    Stripe 0:
        Device     Start Block  Dbase        State Reloc Hot Spare
        c0t0d0s0          0     No            Okay   Yes


Device Relocation Information:
Device   Reloc  Device ID
c1t0d0   Yes    id1,sd@n5000cca0044105bf
c0t0d0   Yes    id1,sd@n5000cca0044105b3
Si hacemos un ls vemos la dirección del hardware:

root@suxb175(SunOS-5.10) # ls -ltra /dev/dsk/c0t0d0s0
lrwxrwxrwx   1 root     root          57 Jul 17  2008 /dev/dsk/c0t0d0s0 -> ../../devices/ssm@0,0/pci@18,600000/pci@1/scsi@2/sd@0,0:a
root@suxb175(SunOS-5.10) # ls -ltra /dev/dsk/c1t0d0s0
lrwxrwxrwx   1 root     root          57 Jul 17  2008 /dev/dsk/c1t0d0s0 -> ../../devices/ssm@0,0/pci@19,700000/pci@2/scsi@2/sd@0,0:a

Como podemos ver concuerdan con los alias.

Saludos!!


jueves, 18 de julio de 2013

Instalación del Servidor de Centreon (I)

Buenos días,

 hoy vamos a ver un software de monitorización en tiempo real basado en Nagios cuyo nombre es Centreon. Nagios es bastante conocido y ampliamente usado en el mundo IT, su principal función es la de comprobar el estado de nuestros servidores y servicios. Uno de los principales escollos de Nagios es su configuración basada en ficheros de texto plano. Conforme nuestra infraestructura va creciendo estos archivos se vuelven complejos y complicados de mantener. Para solventar esto la empresa Merethis se ha ingeniado un interface web que funciona como una capa más, haciendo de interface entre el usuario y el propio servidor de Nagios. A su vez aporta nuevas funcionalidades como gráficas de rendimiento y un dashboard donde nos muestra datos de tiempos online bastante útiles para calcular SLA.

En la página de Centreon podemos encontrar más información sobre sus caracteristicas. En la misma página podemos ver las diferentes versiones que podemos encontrar. Por un lado hay una versión en tar.gz para instalar. Y por otro lado nos encontramos con una versión embebida que te instala un servidor sobre CentOS prácticamente automatizada, hoy nos centraremos en está ultima versión llamada "CES" o Centreon Entreprise Server. Todo es software libre. Si fuera necesario soporte Merethis te lo puede proporcionar con un coste adicional.

Para estás pruebas crearemos dos maquinas virtuales sobre KVM. Una para el servidor de Centreon y otra un PC con Windows XP al que realizaremos una monitorización básica.

Descargaremos la última versión Stable del servidor de CES.

Crearemos una máquina virtual mínima con 1G de RAM y 8G de HD. Arrancaremos la VM con la ISO de CES.



Pulsaremos Intro para la instalación por defecto.


Seleccionamos el idioma.


La parte de instalación en modo texto es practicamente la misma a la de RHEL/CentOS. Posteriomente arrancara el modo gráfico.


Le diremos que sí, que borre todos los datos del disco.


Aceptamos la partición del disco por defecto.


Seleccionaremos la zona horaria.


Introducimos el password de root.


Veremos el proceso de instalación.


Reiniciamos.


Dejaremos sin modificar ninguno de los Items.


 OK! Servidor arrancado.

Una vez acabada la instalación accederemos a la página principal.
http://192.168.122.25/centreon/index.php
 El  usuario por defecto es "admin/centreon", os aconsejo cambiarlo una vez hecha la instalació.

Clickando en "Home" iremos al dashboard principal de alertas.

En el siguiente post agregaremos una máquina a la monitorización.

Saludos...


viernes, 12 de julio de 2013

Configurar una nueva alerta de Centreon

Hola,

 vamos a configurar una alerta de memoria en nuestro servidor linux. Ya tenemos instalado el cliente de NRPE.  Vamos a buscar en "Nagios Exchange" si hay ya hecho algún script que se ajuste al tipo de alerta que estamos buscando. He encontrado este que nos ira bien para el ejemplo.
  • Copiamos el chequeo en la libreria de scripts y le damos permisos de ejecución.
    [root@myserver]# cd /usr/lib64/nagios/plugins
    [root@myserver plugins]# vi check_linux_mem
    [root@myserver plugins]# chmod +x check_linux_mem
  • Lo ejecutamos para ver que todo funciona correctamente.
    [root@myserver plugins]# ./check_mem 80 90
    OK | Total=3924872;;;;Used=3063452;;;;Free=861420;;;;Buffers=364708;;;;Cached=1693484
     
  • Buscamos la configuración de nrpe y la editamos.
    [root@myserver plugins]# ps -ef | grep nrpe
    nagios   23755     1  0 09:14 ?        00:00:00 nrpe -c /etc/nagios/nrpe.cfg -d
    root     24254 23713  0 09:26 pts/0    00:00:00 grep nrpe
    [root@myserver plugins]# vi /etc/nagios/nrpe.cfg
  • Agregamos la linea.
    command[check_mem]=/usr/lib64/nagios/plugins/check_linux_mem 90 95
  • Reiniciamos el demonio de nrpe.
    [root@myserver plugins]# service nrpe restart
    Shutting down Nagios NRPE daemon (nrpe):                   [  OK  ]
    Starting Nagios NRPE daemon (nrpe):                        [  OK  ]

    Ya tenemos el servidor nrpe esperado para ser consultado por el nuevo comando.
  • Desde Nagios/Centreon no crearemos un nuevo comando, ya que lo comprobaremos usando el "check_nrpe" ya existente en la instalación por defecto.
  • Crearemos un nuevo servicio en:


    En la pestaña "Relations" hemos de agregar nuestro servidor para que el chequeo quede vinculado.
  • El resultado final con gráfica y datos es el siguiente:


 Saludos!!


jueves, 11 de julio de 2013

Instalación del cliente de NRPE para Linux


La instalación del cliente de NRPE nos permitirá monitorizar nuestros equipos con Nagios o Centreon. Hay varios metodos para su instalación. Podriamos bajarnos el código, compilarlo e instalarlo. O lo que haremos en este tutorial, bajarnos el paquete desde rpmforge.

Rpmforge es un proyecto libre donde se compilan y empaquetan programas de código abierto para distribuciones RHEL, CentOs y Scientific Linux.

Pongamos que nuestro servidor es un RHEL 6 de 64 Bits. Nos bajamos el paquete de repoforge y lo instalamos:

[root@master ~]# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
--2013-03-11 11:52:16--  http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
Connecting to 192.168.122.1:3128... connected.
Proxy request sent, awaiting response... 200 OK
Length: 12700 (12K) [application/x-redhat-package-manager]
Saving to: “rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm”
100%[=====================================================================>] 12,700      39.4K/s   in 0.3s  
2013-03-11 11:52:17 (39.4 KB/s) - “rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm” saved [12700/12700]
[root@master ~]# rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
warning: rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6: NOKEY
Preparing...                ########################################### [100%]
   1:rpmforge-release       ########################################### [100%]
[root@master ~]# yum repolist
Loaded plugins: product-id, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
rhel-local                                                                              | 4.0 kB     00:00  
rhel-local/primary_db                                                                   | 3.1 MB     00:00  
rpmforge                                                                                | 1.9 kB     00:00  
rpmforge/primary_db                                                                     | 2.5 MB     00:00  
repo id                                repo name                                                         status
rhel-local                             Red Hat Linux 6Server - x86_64 - DVD                              3,585
rpmforge                               RHEL 6Server - RPMforge.net - dag                                 4,458
repolist: 8,043
[root@master ~]# yum install nrpe
Loaded plugins: product-id, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package nagios-nrpe.x86_64 0:2.12-1.el6.rf will be installed
--> Processing Dependency: nagios-plugins for package: nagios-nrpe-2.12-1.el6.rf.x86_64
--> Running transaction check
---> Package nagios-plugins.x86_64 0:1.4.16-1.el6.rf will be installed
--> Processing Dependency: perl(Net::SNMP) for package: nagios-plugins-1.4.16-1.el6.rf.x86_64
--> Processing Dependency: fping for package: nagios-plugins-1.4.16-1.el6.rf.x86_64
--> Running transaction check
---> Package fping.x86_64 0:3.4-1.el6.rf will be installed
---> Package perl-Net-SNMP.noarch 0:5.2.0-1.2.el6.rf will be installed
--> Processing Dependency: perl(Socket6) >= 0.19 for package: perl-Net-SNMP-5.2.0-1.2.el6.rf.noarch
--> Processing Dependency: perl(Digest::HMAC) for package: perl-Net-SNMP-5.2.0-1.2.el6.rf.noarch
--> Processing Dependency: perl(Crypt::DES) for package: perl-Net-SNMP-5.2.0-1.2.el6.rf.noarch
--> Processing Dependency: perl(Digest::SHA1) for package: perl-Net-SNMP-5.2.0-1.2.el6.rf.noarch
--> Running transaction check
---> Package perl-Crypt-DES.x86_64 0:2.05-3.2.el6.rf will be installed
---> Package perl-Digest-HMAC.noarch 0:1.01-22.el6 will be installed
---> Package perl-Digest-SHA1.x86_64 0:2.12-2.el6 will be installed
---> Package perl-Socket6.x86_64 0:0.23-3.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================
 Package                       Arch                Version                       Repository               Size
===============================================================================================================
Installing:
 nagios-nrpe                   x86_64              2.12-1.el6.rf                 rpmforge                 34 k
Installing for dependencies:
 fping                         x86_64              3.4-1.el6.rf                  rpmforge                 47 k
 nagios-plugins                x86_64              1.4.16-1.el6.rf               rpmforge                795 k
 perl-Crypt-DES                x86_64              2.05-3.2.el6.rf               rpmforge                 41 k
 perl-Digest-HMAC              noarch              1.01-22.el6                   rhel-local               21 k
 perl-Digest-SHA1              x86_64              2.12-2.el6                    rhel-local               49 k
 perl-Net-SNMP                 noarch              5.2.0-1.2.el6.rf              rpmforge                 88 k
 perl-Socket6                  x86_64              0.23-3.el6                    rhel-local               23 k
Transaction Summary
===============================================================================================================
Install       8 Package(s)
Total download size: 1.1 M
Installed size: 5.5 M
Is this ok [y/N]: y
Downloading Packages:
(1/8): fping-3.4-1.el6.rf.x86_64.rpm                                                    |  47 kB     00:00  
(2/8): nagios-nrpe-2.12-1.el6.rf.x86_64.rpm                                             |  34 kB     00:00  
(3/8): nagios-plugins-1.4.16-1.el6.rf.x86_64.rpm                                        | 795 kB     00:00  
(4/8): perl-Crypt-DES-2.05-3.2.el6.rf.x86_64.rpm                                        |  41 kB     00:00  
(5/8): perl-Digest-HMAC-1.01-22.el6.noarch.rpm                                          |  21 kB     00:00  
(6/8): perl-Digest-SHA1-2.12-2.el6.x86_64.rpm                                           |  49 kB     00:00  
(7/8): perl-Net-SNMP-5.2.0-1.2.el6.rf.noarch.rpm                                        |  88 kB     00:00  
(8/8): perl-Socket6-0.23-3.el6.x86_64.rpm                                               |  23 kB     00:00  
---------------------------------------------------------------------------------------------------------------
Total                                                                          572 kB/s | 1.1 MB     00:01  
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : perl-Digest-SHA1-2.12-2.el6.x86_64                                                          1/8
  Installing : perl-Digest-HMAC-1.01-22.el6.noarch                                                         2/8
  Installing : perl-Socket6-0.23-3.el6.x86_64                                                              3/8
  Installing : perl-Crypt-DES-2.05-3.2.el6.rf.x86_64                                                       4/8
  Installing : perl-Net-SNMP-5.2.0-1.2.el6.rf.noarch                                                       5/8
  Installing : fping-3.4-1.el6.rf.x86_64                                                                   6/8
  Installing : nagios-plugins-1.4.16-1.el6.rf.x86_64                                                       7/8
  Installing : nagios-nrpe-2.12-1.el6.rf.x86_64                                                            8/8
Installed products updated.
  Verifying  : fping-3.4-1.el6.rf.x86_64                                                                   1/8
  Verifying  : nagios-nrpe-2.12-1.el6.rf.x86_64                                                            2/8
  Verifying  : perl-Digest-SHA1-2.12-2.el6.x86_64                                                          3/8
  Verifying  : perl-Net-SNMP-5.2.0-1.2.el6.rf.noarch                                                       4/8
  Verifying  : perl-Crypt-DES-2.05-3.2.el6.rf.x86_64                                                       5/8
  Verifying  : perl-Digest-HMAC-1.01-22.el6.noarch                                                         6/8
  Verifying  : perl-Socket6-0.23-3.el6.x86_64                                                              7/8
  Verifying  : nagios-plugins-1.4.16-1.el6.rf.x86_64                                                       8/8
Installed:
  nagios-nrpe.x86_64 0:2.12-1.el6.rf                                                                        
Dependency Installed:
  fping.x86_64 0:3.4-1.el6.rf                            nagios-plugins.x86_64 0:1.4.16-1.el6.rf            
  perl-Crypt-DES.x86_64 0:2.05-3.2.el6.rf                perl-Digest-HMAC.noarch 0:1.01-22.el6              
  perl-Digest-SHA1.x86_64 0:2.12-2.el6                   perl-Net-SNMP.noarch 0:5.2.0-1.2.el6.rf            
  perl-Socket6.x86_64 0:0.23-3.el6                    
Complete!

Para evitar confusiones a la hora de actualizar paquetes de sistema, deshabilitaremos el repositorio de rpmforge. Nos aseguramos que el resto de los paquetes se actualizaran desde redhat.

[root@master ~]# cd /etc/yum.repos.d/
[root@master yum.repos.d]# ls
local.repo        mirrors-rpmforge-extras   rhel-source.repo
mirrors-rpmforge  mirrors-rpmforge-testing  rpmforge.repo
[root@master yum.repos.d]# vi rpmforge.repo 

En la sección de rmpforge pondremos enable = 0

[root@master yum.repos.d]# cat rpmforge.repo
### Name: RPMforge RPM Repository for RHEL 6 - dag
### URL: http://rpmforge.net/
[rpmforge]
name = RHEL $releasever - RPMforge.net - dag
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/rpmforge
mirrorlist = http://apt.sw.be/redhat/el6/en/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1
[rpmforge-extras]
name = RHEL $releasever - RPMforge.net - extras
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/extras
mirrorlist = http://apt.sw.be/redhat/el6/en/mirrors-rpmforge-extras
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-extras
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1
[rpmforge-testing]
name = RHEL $releasever - RPMforge.net - testing
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/testing
mirrorlist = http://apt.sw.be/redhat/el6/en/mirrors-rpmforge-testing
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-testing
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1
[root@master yum.repos.d]# yum repolist
Loaded plugins: product-id, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
repo id                                repo name                                                         status
rhel-local                             Red Hat Linux 6Server - x86_64 - DVD                              3,585
repolist: 3,585

Podemos comprobar que el servicio se ha instalado. Lo ejecutamos y vemos cual es el fichero de configuración que está usando.

[root@master yum.repos.d]# service nrpe status
nrpe is stopped
[root@master yum.repos.d]# service nrpe start
Starting Nagios NRPE daemon (nrpe):                        [  OK  ]
[root@master yum.repos.d]# ps -ef |grep nrpe
nagios    1504     1  0 11:59 ?        00:00:00 nrpe -c /etc/nagios/nrpe.cfg -d
root      1507  1402  0 11:59 pts/0    00:00:00 grep nrpe

Modificaremos el fichero de configuración y añadiremos los datos que hacen referencia a nuestro servidor, puerto, etc, etc...

[root@master yum.repos.d]# cat /etc/nagios/nrpe.cfg
#############################################################################
# Sample NRPE Config File
# Written by: Ethan Galstad (nagios@nagios.org)
#
# Last Modified: 11-23-2007
#
# NOTES:
# This is a sample configuration file for the NRPE daemon.  It needs to be
# located on the remote host that is running the NRPE daemon, not the host
# from which the check_nrpe client is being executed.
#############################################################################

# LOG FACILITY
# The syslog facility that should be used for logging purposes.
log_facility=daemon


# PID FILE
# The name of the file in which the NRPE daemon should write it's process ID
# number.  The file is only written if the NRPE daemon is started by the root
# user and is running in standalone mode.
pid_file=/var/run/nrpe.pid


# PORT NUMBER
# Port number we should wait for connections on.
# NOTE: This must be a non-priviledged port (i.e. > 1024).
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
server_port=5666


# SERVER ADDRESS
# Address that nrpe should bind to in case there are more than one interface
# and you do not want nrpe to bind on all interfaces.
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
#server_address=127.0.0.1


# NRPE USER
# This determines the effective user that the NRPE daemon should run as.
# You can either supply a username or a UID.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
nrpe_user=nagios


# NRPE GROUP
# This determines the effective group that the NRPE daemon should run as.
# You can either supply a group name or a GID.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
nrpe_group=nagios


# ALLOWED HOST ADDRESSES
# This is an optional comma-delimited list of IP address or hostnames
# that are allowed to talk to the NRPE daemon.
#
# Note: The daemon only does rudimentary checking of the client's IP
# address.  I would highly recommend adding entries in your /etc/hosts.allow
# file to allow only the specified host to connect to the port
# you are running this daemon on.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
allowed_hosts=127.0.0.1


# COMMAND ARGUMENT PROCESSING
# This option determines whether or not the NRPE daemon will allow clients
# to specify arguments to commands that are executed.  This option only works
# if the daemon was configured with the --enable-command-args configure script
# option.
#
# *** ENABLING THIS OPTION IS A SECURITY RISK! ***
# Read the SECURITY file for information on some of the security implications
# of enabling this variable.
#
# Values: 0=do not allow arguments, 1=allow command arguments
dont_blame_nrpe=0


# COMMAND PREFIX
# This option allows you to prefix all commands with a user-defined string.
# A space is automatically added between the specified prefix string and the
# command line from the command definition.
#
# *** THIS EXAMPLE MAY POSE A POTENTIAL SECURITY RISK, SO USE WITH CAUTION! ***
# Usage scenario:
# Execute restricted commmands using sudo.  For this to work, you need to add
# the nagios user to your /etc/sudoers.  An example entry for alllowing
# execution of the plugins from might be:
#
# nagios          ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/
#
# This lets the nagios user run all commands in that directory (and only them)
# without asking for a password.  If you do this, make sure you don't give
# random users write access to that directory or its contents!
# command_prefix=/usr/bin/sudo


# DEBUGGING OPTION
# This option determines whether or not debugging messages are logged to the
# syslog facility.
# Values: 0=debugging off, 1=debugging on
debug=0


# COMMAND TIMEOUT
# This specifies the maximum number of seconds that the NRPE daemon will
# allow plugins to finish executing before killing them off.
command_timeout=60


# CONNECTION TIMEOUT
# This specifies the maximum number of seconds that the NRPE daemon will
# wait for a connection to be established before exiting. This is sometimes
# seen where a network problem stops the SSL being established even though
# all network sessions are connected. This causes the nrpe daemons to
# accumulate, eating system resources. Do not set this too low.
connection_timeout=300


# WEEK RANDOM SEED OPTION
# This directive allows you to use SSL even if your system does not have
# a /dev/random or /dev/urandom (on purpose or because the necessary patches
# were not applied). The random number generator will be seeded from a file
# which is either a file pointed to by the environment valiable $RANDFILE
# or $HOME/.rnd. If neither exists, the pseudo random number generator will
# be initialized and a warning will be issued.
# Values: 0=only seed from /dev/[u]random, 1=also seed from weak randomness
#allow_weak_random_seed=1


# INCLUDE CONFIG FILE
# This directive allows you to include definitions from an external config file.
#include=<somefile.cfg>


# INCLUDE CONFIG DIRECTORY
# This directive allows you to include definitions from config files (with a
# .cfg extension) in one or more directories (with recursion).
#include_dir=<somedirectory>
#include_dir=<someotherdirectory>


# COMMAND DEFINITIONS
# Command definitions that this daemon will run.  Definitions
# are in the following format:
#
# command[<command_name>]=<command_line>
#
# When the daemon receives a request to return the results of <command_name>
# it will execute the command specified by the <command_line> argument.
#
# Unlike Nagios, the command line cannot contain macros - it must be
# typed exactly as it should be executed.
#
# Note: Any plugins that are used in the command lines must reside
# on the machine that this daemon is running on!  The examples below
# assume that you have plugins installed in a /usr/local/nagios/libexec
# directory.  Also note that you will have to modify the definitions below
# to match the argument format the plugins expect.  Remember, these are
# examples only!

# The following examples use hardcoded command arguments...
command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/lib64/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs -w 150 -c 200

# The following examples allow user-supplied arguments and can
# only be used if the NRPE daemon was compiled with support for
# command arguments *AND* the dont_blame_nrpe directive in this
# config file is set to '1'.  This poses a potential security risk, so
# make sure you read the SECURITY file before doing this.
#command[check_users]=/usr/lib64/nagios/plugins/check_users -w $ARG1$ -c $ARG2$
#command[check_load]=/usr/lib64/nagios/plugins/check_load -w $ARG1$ -c $ARG2$
#command[check_disk]=/usr/lib64/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
#command[check_procs]=/usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$

Reiniciaremos el demonio...

[root@master yum.repos.d]# service nrpe restart

 ...y ya desde Nagios/Centreon configuraremos las nuevas alertas.

miércoles, 10 de julio de 2013

Actualización de paquetes de RH fuera de los repositorios oficiales (II)

... Siguiendo.

Tenemos nuestro servidor instalado con RHEL 6.4 x86_64. Lo registramos en la Red Hat Network y le habilitamos el Optional Channel, que nos permitirá instalar PHP. Seguiremos los pasos de la guía de IUS.

La versión oficial de Red Hat en los repositorios es la siguiente:

[root@myserver ~]# php -v
PHP 5.3.3 (cli) (built: Jun 25 2012 04:41:23)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Una versión de hace un año, un poco antigua.

Descargaremos los paquetes de IUS y EPEL para que se configuren los nuevos repositorios:

[root@myserver ~]# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/x86_64/ius-release-1.0-11.ius.el6.noarch.rpm
[root@myserver ~]# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/x86_64/epel-release-6-5.noarch.rpm
[root@myserver ~]# rpm -Uvh epel-release-6-5.noarch.rpm
[root@myserver ~]# rpm -Uvh ius-release-1.0-11.ius.el6.noarch.rpm

Instalaremos un plugin que realiza el reemplazo de paquetes:

[root@myserver ~]#yum install yum-plugin-replace

Hacemos la actualización propiamente dicha. Vemos que también instalará el resto de dependencias:

[root@myserver ~]# yum replace php --replace-with php53u
Loaded plugins: replace
Excluding Packages in global exclude list
Finished
Replacing packages takes time, please be patient...

This may be normal depending on the package. Continue? [y/N] y

Removed:
php.x86_64 0:5.1.6-27.el5 php-cli.x86_64 0:5.1.6-27.el5 php-common.x86_64 0:5.1.6-27.el5
php-devel.x86_64 0:5.1.6-27.el5 php-pear.noarch 1:1.4.9-6.el5

Installed:
php53.x86_64 0:5.3.2-6.ius.el5 php53-cli.x86_64 0:5.3.2-6.ius.el5
php53-common.x86_64 0:5.3.2-6.ius.el5 php53-devel.x86_64 0:5.3.2-6.ius.el5
php53-pear.noarch 1:1.8.1-4.ius.el5 php53-pspell.x86_64 0:5.3.2-6.ius.el5

Complete!

Comprobamos la nueva versión:

[root@myserver ~]# php -v
PHP 5.3.26 (cli) (built: Jun 24 2013 15:05:00)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies

Actualizado!!

Lo comprobaremos con un phpinfo:


En principio todo es correcto. Recordar repasar el resto de módulos que tengáis instalados y sobretodo los que habéis instalado sin paquete vía pear.

Saludos!!


Actualización de paquetes de RH fuera de los repositorios oficiales (I)

Buenos días,

 voy a realizar una entrada explicando como actualizar paquetes comunes como php/python/mysql a unas versiones más actuales de las disponibles en los repositorios de red hat.

Como sabéis las versiones de php, python, mysql que hay almacenadas en red hat son de versiones algo más antiguas que las disponibles en otros repositorios libres o no oficiales. ¿Por qué es así? La respuesta es que Red Hat dispone de versiones más antiguas alegando la estabilidad y robustez de las mismas. Al ser más antiguas están más probadas y dan menos problemas, eso sí con menos funcionalidades. Si lo que queremos es un entorno actual con las ultimas versiones y funcionalidades, asumiendo un poquito de más de riesgo de inestabilidades o bug se puede realizar la actualización desde otros repositorios.

De los repositorios que he ido buscando para tal menester, he encontrado los repositorios de REMI.  Leyendo el FAQ vemos los objetivos que se ha marcado este repositorio libre:

Which are the goals of this repository ?

    Providing the  latest versions of the LAMP stack, and some other software, to the Fedora and Enterprise Linux (RHEL, CentOS, Oracle, Scientific Linux, ...) users. It mainly contains :

        packages I also maintains in Fedora
        backports of packages available in Fedora development version
        some packages incompatible with Fedora policy
        some packages in progress before being submitted to Fedora repository
        (nearly) vanilla versions

    This is quite away from backporting fixes policy of Enterprise Linux.
Un repositorio de las ultimas versiones de LAMP y alguna cosa más para RHEL. Nos valdría para una parte.  Leyendo el Blog da la sensación que hay un solo programador detrás de estos.

Buscando otra alternativa me he encontrado con los repositorios de IUS Community Project.  En el FAQ también nos encontramos sus objetivos, que son y que no son:

What is the IUS Community Project?

The IUS Community Project is an effort to package rpms of the latest stable versions of the most commonly requested software on Red Hat Enterprise Linux and CentOS. IUS provides a better way to upgrade PHP/MySQL/Python/Etc on RHEL or CentOS. The project is run by professional Linux Engineers that are primarily focused on RPM Development in the web hosting industry.

What is it NOT?

For one, IUS is not a service of Rackspace but rather is Sponsored by Rackspace. Additionally, IUS is not the same as Fedora EPEL or similar repos. EPEL is geared towards adding packages to RHEL, and has strict guidelines that none of their packages replace anything in RHEL. IUS on the other hand is explicitly geared towards providing packages that do replace existing software in RHEL. Essentially, we are offering a proper way to upgrade software on RHEL when you really need it the latest upstream versions of software.
 Me ha inspirado más confianza que el origen de estos repositorios viene directamente del Hosting de Rackspace. Al tener muchas peticiones de sus clientes para obtener unas versiones más actuales de los paquetes se ingeniaron este repositorio. Al ver que era bueno y útil decidieron abrirlo a la comunidad.

Otro de los puntos fuertes es que actualiza los paquetes de redhat, los sustituye. De está manera evitaremos tener problemas de duplicados o dependencias.

Lo dejamos aquí y en le próximo post veremos como instalar/configurar los IUS Repositories y actualizaremos la versión de PHP.

Continuará....