miércoles, 26 de febrero de 2014

Ver Versión de VMtools en Unix

Buscamos dentro del perl de las tools la cadena buildNr:

# cat /usr/bin/vmware-config-tools.pl |grep buildNr
  my $buildNr;
  $buildNr = 'aca aparece la version';


miércoles, 19 de febrero de 2014

Instalar VNC Server en Oracle Linux Server

Instalamos tigervnc-server:

# yum install tigervnc-server
Loaded plugins: refresh-packagekit, security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package tigervnc-server.x86_64 0:1.1.0-8.el6_5 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
 Package             Arch       Version             Repository             Size
================================================================================
Installing:
 tigervnc-server     x86_64     1.1.0-8.el6_5       public_ol6_latest     1.1 M
Transaction Summary
================================================================================
Install       1 Package(s)
Total download size: 1.1 M
Installed size: 2.9 M
Is this ok [y/N]: y ENTER
Downloading Packages:
tigervnc-server-1.1.0-8.el6_5.x86_64.rpm                 | 1.1 MB     00:03
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : tigervnc-server-1.1.0-8.el6_5.x86_64                         1/1
  Verifying  : tigervnc-server-1.1.0-8.el6_5.x86_64                         1/1
Installed:
  tigervnc-server.x86_64 0:1.1.0-8.el6_5
Complete!


Editamos la config y especificamos el usuario, en este caso root:

# vi /etc/sysconfig/vncservers
VNCSERVERS="2:root"
VNCSERVERARGS[2]="-geometry 1280x1024 -nolisten tcp -localhost"


Especificamos el usuario de root para la conexión de VNC:

# vncpasswd
Password: ponemos_el_passVerify: ponemos_el_pass


Agregamos para que inicie cuando se reinicie el equipo:

# chkconfig vncserver on


Iniciamos el servicio:

# service vncserver start
Starting VNC server: 2:root xauth:  creating new authority file /root/.Xauthority
xauth: (stdin):1:  bad display name "MISERVER:2" in "add" command
New 'MISERVER:2 (root)' desktop is MISERVER:2
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/MISERVER:2.log
                                                           [  OK  ]


Deshabilitamos el firewall:

# iptables -F


Lo habilitamos en la interface gráfica:




lunes, 17 de febrero de 2014

LVM (Logical Volume Manager)

Creamos las particiones de cada disco con fdisk ahora que lo vemos (ya está explicado en este otro enlace: http://www.redes-seguridad.com.ar/2013/05/mover-el-var-otro-disco.html)

# fdisk /dev/sdf
# fdisk /dev/sdg


Creamos el Volumen Físico (PV) especificando las 2 particiones de ambos discos:

# pvcreate /dev/sdf1 /dev/sdg1
  Physical volume "/dev/sdf1" successfully created
  Physical volume "/dev/sdg1" successfully created


Escanemos los PV:

# pvscan
  PV /dev/sdf1                      lvm2 [300.00 GiB]
  PV /dev/sdg1                      lvm2 [300.00 GiB]
  Total: 2 [599.99 GiB] / in use: 0 [0   ] / in no VG: 2 [599.99 GiB]


Creamos el Volumen Group (VG) especificando las particiones creadas:

# vgcreate VG-DATOS /dev/sdf1 /dev/sdg1
  Volume group "VG-DATOS" successfully created


Verificamos el VG:

# vgdisplay
  --- Volume group ---
  VG Name               VG-DATOS
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               599.98 GiB
  PE Size               4.00 MiB
  Total PE              153596
  Alloc PE / Size       0 / 0
  Free  PE / Size       153596 / 599.98 GiB
  VG UUID               JacDGH-3VEI-7TMP-bg83-uW6z-HuJS-uLjhtD


Creamos el Volumen Lógico (LV):

# lvcreate -l 100%FREE -n LV-DATOS DATOS-VG
  Logical volume "LV-DATOS" created


Formateamos el LV con mkfs en ext4:

# mkfs.ext4 /dev/DATOS-VG/LV-DATOS


Listamos los LV:

# lvs
  LV             VG          Attr       LSize   Pool Origin Data%  Move Log Cpy%Sync Convert
  LV-DATOS DATOS-VG -wi-a----- 599.98g


Verificamos el ID para montarlo en el fstab:

# blkid
/dev/mapper/DATOS--LV--DATOS--LV: UUID="c89de210-52de-4005-8d10-9b4676e4d97d" TYPE="ext4" 


Creamos el punto de montaje, editamos el fstab y lo montamos:

# mkdir /datos
# vi /etc/fstab
UUID=c89de210-52de-4005-8d10-9b4676e4d97d /datos                  ext4    defaults        1 2
# mount /datos

Agregar disco a Linux que no lo veía con el fdisk

Al agregar un nuevo disco, ejecutaba "fdisk -l" y no veía los discos, para no reiniciar el S.O. ejecuté lo siguiente:

# ls -ltr /sys/class/scsi_host
total 0
lrwxrwxrwx. 1 root root 0 Feb 12 11:59 host2 -> ../../devices/pci0000:00/0000:00:10.0/host2/scsi_host/host2
lrwxrwxrwx. 1 root root 0 Feb 12 11:59 host1 -> ../../devices/pci0000:00/0000:00:07.1/ata2/host1/scsi_host/host1
lrwxrwxrwx. 1 root root 0 Feb 12 11:59 host0 -> ../../devices/pci0000:00/0000:00:07.1/ata1/host0/scsi_host/host0


Por cada host que nos devuelve el comando previo se ejecuta lo siguiente:

# echo "- - -" > /sys/class/scsi_host/host0/scan
# echo "- - -" > /sys/class/scsi_host/host1/scan
# echo "- - -" > /sys/class/scsi_host/host2/scan

jueves, 13 de febrero de 2014

Agregar Usuarios de una OU a un grupo en Active Directory

Utilizamos el dsquery para obtener el listado y luego el dsmod para modificarlo:

C:\Users\>dsquery user -startnode "ou=Ventas,ou=Users,dc=mi,dc=dominio,dc=com" | dsmod group "cn=Ventas,ou=groups,dc=mi,dc=dominio,dc=com" -addmbr

lunes, 10 de febrero de 2014

Default Gateway on ESXi

~ # esxcli network ip route ipv4 list
Network        Netmask        Gateway          Interface  Source
-------------  -------------  ---------------  ---------  ------
default         0.0.0.0        192.168.0.1   vmk0       MANUAL
192.168.0.0   255.255.255.0  0.0.0.0          vmk0       MANUAL
~ #

martes, 28 de enero de 2014

Monitoring IBM TS3100 Tape Library with Nagios



Descargué el "check_ibm_ts_tape.pl" del siguiente enlace: http://www.claudiokuenzler.com/nagios-plugins/check_ibm_ts_tape.php en la ruta donde guardo los scripts de nagios (en mi caso /ruta-nagios/libexec):

# wget http://www.claudiokuenzler.com/nagios-plugins/check_ibm_ts_tape.pl
--2014-01-28 17:06:08--  http://www.claudiokuenzler.com/nagios-plugins/check_ibm_ts_tape.pl
Resolving www.claudiokuenzler.com... 144.76.83.23
Connecting to www.claudiokuenzler.com|144.76.83.23|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7078 (6.9K) [text/x-perl]
Saving to: `check_ibm_ts_tape.pl'
100%[=======================================================================================================================================>] 7,078       30.9K/s   in 0.2s
2014-01-28 17:06:10 (30.9 KB/s) - `check_ibm_ts_tape.pl' saved [7078/7078]
#


Damos permisos de ejecución:


# chmod a+x check_ibm_ts_tape.pl


Lo ejecutamos sin parámetros y nos muestra que library's están disponibles:


# ./check_ibm_ts_tape.pl
Model must be either ts3100 or ts3200.


Si le damos --help nos muestra la ayuda:


# ./check_ibm_ts_tape.pl --help
check_ibm_ts_tape.pl (c) 2012 Claudio Kuenzler (published under GPL License)
Version: 20120901
Usage: ./check_ibm_ts_tape.pl -H host [-C community] -m model -t checktype
Options:
-H      Hostname or IP address of tape library.
-C      SNMP community name (if not set, public will be used).
-m      Model of the tape library. Must be either ts3100 or ts3200.
-t      Type to check. See below for valid types.
--help  Show this help/usage.
Check Types:
info -> Show basic information of the tape library (hostname, serial number, etc)
status -> Checks the current status and outputs error codes if status is not ok
clean -> Checks all drives of tape library if cleaning is required



Ejecutamos el comando completo (Donde 192.168.0.100 es la ip de la Library, la Comunidad la especificamos con el -C, el modelo con el -m y lo que deseamos chequear con el -t, en este caso uso el info):

# ./check_ibm_ts_tape.pl -H 192.168.0.100 -C Comunidad -m ts3100 -t info
server.dominio (IBM TS3100) - Product-No: XXXX-TL - S/N: XXXXXXXX - running on Firmware X.XX


Ejecutamos el mismo comando, pero ahora con el check de status y luego el de clean:


# ./check_ibm_ts_tape.pl -H 192.168.0.100 -C Comunidad -m ts3100 -t info
ts3100 WARNING - Current status is: non-critical - No error (error code: 0) 
# ./check_ibm_ts_tape.pl -H 192.168.0.100 -C Comunidad -m ts3100 -t clean
ts3100 WARNING - 1 tape drive needs to be cleaned


Editamos el commands.cfg del nagios y agregamos lo siguiente:

# vi /ruta-del-nagios/commands.cfg
define command{
command_name check_library
command_line $USER1$/check_ibm_ts_tape.pl -H $HOSTADDRESS$ -C Comunidad -m ts3100 -t $ARG1$
}


Editamos el hosts.cfg y el services.cfg de la ruta del nagios y agregamos lo siguiente:

# vi /ruta-del-nagios/hosts.cfg
define host{
        host_name         Tape_Library
        alias                   Tape_Library
        address              192.168.0.100
        }
# vi /ruta-del-nagios/services.cfg
define service{
use                             generic-service,srv-pnp
host_name                  Tape_Library
service_description      Clean
check_command         check_library!clean
}
define service{
use                             generic-service,srv-pnp
host_name                  Tape_Library
service_description      Info
check_command         check_library!info
}
define service{
use                             generic-service,srv-pnp
host_name                  Tape_Library
service_description      Status
check_command         check_library!status
}


Verificamos la configuración del nagios antes de reiniciarlo:

#/ruta-del-nagios/bin/nagios -v /ruta-del-nagios/etc/nagios.cfg


Si devuelve 0 warnings y 0 errors reiniciamos el servicio con:


# /etc/init.d/nagios reload