Por arte de magia el script check_snmp ha desaparecido de la ubicación en la que estaba (/home/administrador/nagios-plugins-1.4.11/plugins/check_snmp)
Buscando por la red parece ser que no he sido el único al que le ha pasado algo similar tras las actualizaciones de Ubuntu, he pasado de la 7.10 a la 8.04, por suerte solucionarlo ha sido tan sencillo como volver a instalar el pack de plugins.
Compilamos e instalamos los plugins
tar xzf nagios-plugins-1.4.11.tar.gz
cd nagios-plugins-1.4.11
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
jueves, 22 de mayo de 2008
lunes, 19 de mayo de 2008
NAGIOS. Ayuda plugin check_nt
This plugin collects data from the NSClient service running on a
Windows NT/2000/XP/2003 server.
Usage: check_nt -H host -v variable [-p port] [-w warning] [-c critical]
[-l params] [-d SHOWALL] [-t timeout]
Options:
-H, --hostname=HOST
Name of the host to check
-p, --port=INTEGER
Optional port number (default: 1248)
-s
Password needed for the request
-w, --warning=INTEGER
Threshold which will result in a warning status
-c, --critical=INTEGER
Threshold which will result in a critical status
-t, --timeout=INTEGER
Seconds before connection attempt times out (default: 10)
-h, --help
Print this help screen
-V, --version
Print version information
-v, --variable=STRING
Variable to check. Valid variables are:
CLIENTVERSION = Get the NSClient version
If -l is specified, will return warning if versions differ.
CPULOAD = Average CPU load on last x minutes.
Request a -l parameter with the following syntax:
-l,,.
should be less than 24*60.
Thresholds are percentage and up to 10 requests can be done in one shot.
ie: -l 60,90,95,120,90,95
UPTIME = Get the uptime of the machine.
No specific parameters. No warning or critical threshold
USEDDISKSPACE = Size and percentage of disk use.
Request a -l parameter containing the drive letter only.
Warning and critical thresholds can be specified with -w and -c.
MEMUSE = Memory use.
Warning and critical thresholds can be specified with -w and -c.
SERVICESTATE = Check the state of one or several services.
Request a -l parameters with the following syntax:
-l,,,...
You can specify -d SHOWALL in case you want to see working services
in the returned string.
PROCSTATE = Check if one or several process are running.
Same syntax as SERVICESTATE.
COUNTER = Check any performance counter of Windows NT/2000.
Request a -l parameters with the following syntax:
-l "\\\\counter","
The parameter is optional and
is given to a printf output command which requires a float parameter.
If does not include "%", it is used as a label.
Some examples:
"Paging file usage is %.2f %%"
"%.f %% paging file used."
Notes:
- The NSClient service should be running on the server to get any information
(http://nsclient.ready2run.nl).
- Critical thresholds should be lower than warning thresholds
Windows NT/2000/XP/2003 server.
Usage: check_nt -H host -v variable [-p port] [-w warning] [-c critical]
[-l params] [-d SHOWALL] [-t timeout]
Options:
-H, --hostname=HOST
Name of the host to check
-p, --port=INTEGER
Optional port number (default: 1248)
-s
Password needed for the request
-w, --warning=INTEGER
Threshold which will result in a warning status
-c, --critical=INTEGER
Threshold which will result in a critical status
-t, --timeout=INTEGER
Seconds before connection attempt times out (default: 10)
-h, --help
Print this help screen
-V, --version
Print version information
-v, --variable=STRING
Variable to check. Valid variables are:
CLIENTVERSION = Get the NSClient version
If -l
CPULOAD = Average CPU load on last x minutes.
Request a -l parameter with the following syntax:
-l
Thresholds are percentage and up to 10 requests can be done in one shot.
ie: -l 60,90,95,120,90,95
UPTIME = Get the uptime of the machine.
No specific parameters. No warning or critical threshold
USEDDISKSPACE = Size and percentage of disk use.
Request a -l parameter containing the drive letter only.
Warning and critical thresholds can be specified with -w and -c.
MEMUSE = Memory use.
Warning and critical thresholds can be specified with -w and -c.
SERVICESTATE = Check the state of one or several services.
Request a -l parameters with the following syntax:
-l
You can specify -d SHOWALL in case you want to see working services
in the returned string.
PROCSTATE = Check if one or several process are running.
Same syntax as SERVICESTATE.
COUNTER = Check any performance counter of Windows NT/2000.
Request a -l parameters with the following syntax:
-l "\\
The
is given to a printf output command which requires a float parameter.
If
Some examples:
"Paging file usage is %.2f %%"
"%.f %% paging file used."
Notes:
- The NSClient service should be running on the server to get any information
(http://nsclient.ready2run.nl).
- Critical thresholds should be lower than warning thresholds
viernes, 9 de mayo de 2008
Copiar y pegar en vi un número de lineas concretas
Copiamos indicando el número de líneas sustituyendo a $
:$yy
Pegamos
p
:$yy
Pegamos
p
jueves, 8 de mayo de 2008
Monitorizar máquina Windows con Nagios
Instalar NSClient++ en el equipo a monitorizar
Descargamos la última versión desde http://sourceforge.net/projects/nscplus
Descomprimimos el zip en C:\NSClient++
Abrimos una consola de comandos y nos situamos en la carpeta anterior, C:\NSClient++
Registramos NSClient++ como servicio de sistema
nsclient++ /install
Editamos el archivo NSC.INI situado en C:\NSClient++ y realizamos los siguientes cambios:
- "Des-comentamos" todos los módulos situados en la sección [modules] excepto "CheckWMI.dll" y "RemoteConfiguration.dll"
- Cambiamos la contraseña en la sección [settings]
- "Des-comentamos" la opción 'allowed_hosts' en la sección [settings]. Añadimos la dirección IP del servidor Nagios.
- Nos aseguramos de que la opción 'port' en la sección [NSClient] se encuentra sin comentar y está definido a '12489' (puerto por defecto).
Arrancamos el servicio NSClient++
nsclient++ /start
Configurar Nagios
Abrimos el archivo para editarlo
vi /usr/local/nagios/etc/objects/windows.cfg
Añadimos una definición de host o editamos la del ejemplo para agregar nuestra máquina
define host{
use windows-server ; Inherit default values from a Windows server template (make sure you keep this line!)
host_name winserver
alias My Windows Server
address 192.168.1.2
}
Añadimos los servicios asociados a dicho host
define service{
use generic-service
host_name winserver
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}
En una fase inicial es suficiente con configurar los ejemplos del archivo de configuración.
Descargamos la última versión desde http://sourceforge.net/projects/nscplus
Descomprimimos el zip en C:\NSClient++
Abrimos una consola de comandos y nos situamos en la carpeta anterior, C:\NSClient++
Registramos NSClient++ como servicio de sistema
nsclient++ /install
Editamos el archivo NSC.INI situado en C:\NSClient++ y realizamos los siguientes cambios:
- "Des-comentamos" todos los módulos situados en la sección [modules] excepto "CheckWMI.dll" y "RemoteConfiguration.dll"
- Cambiamos la contraseña en la sección [settings]
- "Des-comentamos" la opción 'allowed_hosts' en la sección [settings]. Añadimos la dirección IP del servidor Nagios.
- Nos aseguramos de que la opción 'port' en la sección [NSClient] se encuentra sin comentar y está definido a '12489' (puerto por defecto).
Arrancamos el servicio NSClient++
nsclient++ /start
Configurar Nagios
Abrimos el archivo para editarlo
vi /usr/local/nagios/etc/objects/windows.cfg
Añadimos una definición de host o editamos la del ejemplo para agregar nuestra máquina
define host{
use windows-server ; Inherit default values from a Windows server template (make sure you keep this line!)
host_name winserver
alias My Windows Server
address 192.168.1.2
}
Añadimos los servicios asociados a dicho host
define service{
use generic-service
host_name winserver
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}
En una fase inicial es suficiente con configurar los ejemplos del archivo de configuración.
miércoles, 7 de mayo de 2008
Instalar Nagios en Ubuntu

Antes de nada tenemos que instalar Apache, GCC y las librerías de desarrollo GD
sudo apt-get install apache2
sudo apt-get install build-essential
sudo apt-get install libgd2-xpm-dev
En otra entrada, publiqué un proceso para impacientes obtenido de la web de apache. Aunque es cierto que en Ubuntu es más fácil hacer el apt-get que el proceso para impacientes aquí explicado...
En Ubuntu 6.10 la librería es la libgd2-dev
sudo apt-get install libgd2-dev
Para Ubuntu 7.10 la librería ha cambiado
sudo apt-get install libgd2-xpm-dev
Como root creamos una cuenta de usuario para Nagios y su correspondiente password.
sudo -s
/usr/sbin/useradd nombredeusuario
passwd nombredeusuario
Creamos el grupo ngcmd para permitir comandos externos vía web y agregamos el usuario de Nagios y el usuario de Apache al grupo.
/usr/sbin/groupadd ngcmd
/usr/sbin/usermod -G ngcmd nombredeusuario
/usr/sbin/usermod -G ngcmd www-data
Una vez descargado Nagios lo compilamos y lo instalamos
tar xzf nagios-3.0.1.tar.gz
cd nagios-3.0.1
./configure --with-command-group=ngcmd
make all
make install
make install-init
make install-config
make install-commandmode
Editamos el archivo de configuración /usr/local/nagios/etc/objects/contacts.cfg y cambiamos la dirección de correo asociada a nagiosadmin para recibir las alertas.
vi /usr/local/nagios/etc/objects/contacts.cfg
Instalamos el interface web de configuración de Nagios
make install-webconf
Creamos una cuenta de administración para el interface web
htpasswd -c /usr/local/nagios/etc/htpasswd.users nombredelusuario
Reiniciamos Apache
/etc/init.d/apache2 reload
Compilamos e instalamos los plugins
tar xzf nagios-plugins-1.4.11.tar.gz
cd nagios-plugins-1.4.11
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
Configuramos Nagios para que arranque junto al sistema
ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
Comprobamos los archivos de configuración de Nagios
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Si no se muestran errores iniciamos Nagios
/etc/init.d/nagios start
Acceso al Web Interface
Bien desde la misma máquina
http://localhost/nagios/
O desde cualquier otra máquina de la red
http://192.168.xx.xx/nagios/
Si queremos recibir notificaciones vía email de las alertas de Nagios debemos instalar mailx
sudo apt-get install mailx
Cambiamos los comandos de notificación de email en /usr/local/nagios/etc/objects/commands.cfg y cambiamos cualquier referencia a '/bin/mail' por '/usr/bin/mail'
Una vez hecho esto es necesario reiniciar Nagios
sudo /etc/init.d/nagios restart
Conectarse a Ubuntu desde Win usando VNC
Suscribirse a:
Entradas (Atom)