Windows 10: Utilidades de directorio activo

Para poder usar las utilidades de exploración del directorio activo en windows 7 y windows 10, es necesario activar RSAT ( Remote Server Administration Tools) a través de Programas y características.

rsat_windows_dominio_01

Panel de control > Programas > Programas y características > Activar o desactivar las características de windows.

rsat_windows_dominio_02Habilitamos Remote Server Administration Tools > Feature Administration Tools > AD DS and AD LDS Tools > AD DS Tools

rsat_windows_dominio_03

A través de la consola mmc (mmc.exe) añadimos el complemento de Usuarios y equipos de active directory.

rsat_windows_dominio_04

 

vmware: migración “La operación no se permite en el estado actual”

En un cluster con DRS activado (en modo agresivo) al mover una máquina da como error “La operación no se permite en el estado actual”.
vmware_esx_error_migracion001

El error sale tanto por el interfaz, como en powercli

$vm | move-VM -Datastore  $datastore -Destination $vmhost

Al analizar el propio host, su definición de vmotion aparece como “no”.

 

 

Sin embargo, el host tiene una licencia enterprise que permiten los movimientos en máquina virtual.

vmware_esx_error_migracion002

Paso 1: Reinicio en vcenter del servicio de licencias
vcenter:~ # /etc/init.d/vmware-cis-license restart
Stopping VMware CIS License Service...
Stopped VMware CIS License Service.
Starting VMware CIS License Service...
Waiting for VMware CIS License Service..................
running: PID:4108
Paso 2: Desconexión y conexión del host.

Al desconectar y conectar de nuevo el host, verifica la información de licencias y recupera la posibilidad de vmotion.

Vmware: configurar host profile con distintas tarjetas hbas

En el caso de tener licencias enterprise plus, los perfiles de servidor nos ayudan a mantener todas las configuraciones iguales de los servidores.

En nuestro caso, usamos siempre  un servidor de referencia. Cuando se hacen cambios sobre la configuración, por ejemplo, de red

  1. Configurar la nueva red en el servidor de referencia
  2. Probar
  3. Aplicar host profile en todos los servidores Esxi.

El problema empieza a aparecer cuando tenemos servidores diferentes, con distintos componentes físicos.

Desde el update 2 de vcenter 6, por algún motivo, han decidido que el idioma del teclado fija también el idioma del interfaz, lo que nos complica un poco la vida al buscar ayuda.

En nuestro caso, el error de hbas es:

Faltan dispositivos PCI 2 vmhba en su host que son requeridos por el perfil. El modelo de host puede ser diferente del host de referencia

vmware_host_profile_error_hba

En inglés, el error es:

Your host is missing 2 vmnic PCI devices required by the profile. Your host model may be different from the reference host

Está ya reportado en Vmware Knowledge Base.

En nuestro caso, hemos tenido que deshabilitar dos apartados completos de los perfiles:

  • Device alias configuration
  • Storage configuration

vmware_host_profile_error_hba_002

 

Vmware: configure host profile to match with different physical hosts

Enterprise Plus licences adds host profiling as a way to keep hosts settings managed.

Since writing from scratch host profiles is hard, we use as reference one of our hosts.

Every time we have to changing a setting, for example a new portgroup:

  1. Configure new portgroup
  2. Test
  3. Update host profile and apply to other hosts in the cluster.

This works great as long as all our servers hardware are the same.

As our Emulex Hbas are not the same model, we are having this error:

 

vmware_host_profile_error_hba

Your host is missing 2 vmnic PCI devices required by the profile. Your host model may be different from the reference host

vmware_host_profile_error_hba

To avoid this issue, we have disabled two items in host profiles:

  • Device alias configuration
  • Storage configuration

vmware_host_profile_error_hba_002

More in Vmware Knowledge Base

R: Trabajando con cadenas de texto

nchart

La función Length no funciona con cadenas de texto. Devuelve una longitud, pero no es la del texto que contiene.

texto <- "¡Hola Mundo!"

nchar(texto)
[1] 12

substring

substring(texto,2,14)

strsplit

 strsplit("Me/gusta/programar/en/R","/")
[[1]]
[1] "Me"        "gusta"     "programar" "en"        "R"

sprintf

Misma sintáxis que en C

 sprintf("El cuadrado de %d es %d", i, i^2)

chartr() para sustituir caracteres en cadenas

Búsqueda con expresiones regulares

patron <- "Trabajador(e|a)s"

grep (patron,profesiones)

Otra opción es usar ?regexpr

 

R: functions

Defining a function in R, looks like

 mynewsumfunction <- function(x,y = 34){
  x + y
 }

Parameters can have a default value.
If parameters are strings  you can use function paste

paste(c("The", "quick", "brown", "fox"))
[1] "The"  "quick" "brown" "fox"

Ellipsis allows to declare a variable number of parameters in a function.

> myhist <- function(x, border="blue", ...){
+ 	hist(x, border=border, ...)
+ }
> set.seed(5)
> myhist(rnorm(1000), breaks=30)
> set.seed(5)
> myhist(rnorm(1000))  

Function prototypes can be checked with args function:

args(mean)
function (x, ...)
Environments:

Every function and symbol has to be defined in an environment:

  • global
  • packages loaded
  • package base
search (myfunction)

Functions can be defined within other functions.

environment(myfunction)

Getting started with gitlab

Installation for Debian 8

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo apt-get install gitlab-ce

sudo gitlab-ctl reconfigure

https://about.gitlab.com/downloads/#debian8

Restarting gitlab

To restart web service

gitlab-ctl restart
ok: run: gitlab-workhorse: (pid 29291) 0s
ok: run: logrotate: (pid 29299) 1s
ok: run: nginx: (pid 29305) 0s
ok: run: postgresql: (pid 29313) 0s
ok: run: redis: (pid 29327) 1s
ok: run: sidekiq: (pid 29331) 0s
ok: run: unicorn: (pid 29336) 1s

Reconfigure gitlab settings

La configuración de gitlab se guarda en un archivo .yml, que se genera a través de :

emacs /etc/gitlab/gitlab.rb
sudo gitlab-ctl reconfigure

To locate configuration files in our system

find / -name gitlab.rb
find / -name gitlab.yml

Logging

Gitlab logs are separated in three files: application, sidekiq and production

tail -f /var/log/gitlab/gitlab-rails/production.log
tail -f /var/log/gitlab/gitlab-rails/application.log
tail -f /var/log/gitlab/gitlab-rails/sidekiq.log

Code highlighting

For highlighting source code, Gitlab uses Rouge module.

To know whether a language will be coloured or not, they have this awesome website where you can actually test colouring different code snippets.

Available grammars are in Github.

Backup de correo pst

Los archivos pst de correo en outlook se ubican en

/cygdrive/c/Users/myuser/AppData/Local/Microsoft/Outlook/archive.pst

En mi caso, al tener más de 4 GB el archivo, no es posible hacer un backup a un disco duro Fat32.

Vamos a usar cygwin y tar, para hacer una copia del correo, separada en archivos de 1 GB:

CORREO=/cygdrive/c/Users/myuser/AppData/Local/Microsoft/Outlook/archive.pst

tar cz $CORREO  | split -b 1024MiB - $CORREO_bkp

Para recomponer:

cat myfiles_split.tgz_* | tar xz

R: Plots and graphs

Plotting in R is extremely easy.

plot (1:21)

rstudio_plotting_000

plot (1:8, main="TESTING",xlab="x",ylab="y")

rstudio_plotting_001

points(c(1,5),c(4,2), col="green")

rstudio_plotting_002

abline(h=3,col="red",lty=2)

rstudio_plotting_003

abline(h=1,col="yellow",lty=2)

rstudio_plotting_004

grid(col="purple")

rstudio_plotting_005

hist (1:21,col="orange")

rstudio_plotting_006

lines(c(2,4),c(5,3),col="blue")

rstudio_plotting_007

abline(h=3,col="red",lty=2)

Exporting and importing graphs

dev.copy(png,'myplot.png')
dev.off()

To list existing colors

> colors()
  [1] "white"                "aliceblue"            "antiquewhite"         "antiquewhite1"       
  [5] "antiquewhite2"        "antiquewhite3"        "antiquewhite4"        "aquamarine"          
  [9] "aquamarine1"          "aquamarine2"          "aquamarine3"          "aquamarine4"         
 [13] "azure"                "azure1"               "azure2"               "azure3"              
(...)
"violetred2"           "violetred3"          
[645] "violetred4"           "wheat"                "wheat1"               "wheat2"              
[649] "wheat3"               "wheat4"               "whitesmoke"           "yellow"              
[653] "yellow1"              "yellow2"              "yellow3"              "yellow4"             
[657] "yellowgreen"

Global changes for styles and colors

Adding texts to plots

text(11,11,"Regular text")

text(11,11, "Bigger text", cex=2)

text(5,5, "serif text", family="serif")

text(3,3 "mono text", family="mono")

text(7,7 "Sans text", family="sans")

 

Mathematic notation

demo(plotmath)

draw.plotmath.cell(expression(x != y), i, nr); i <- i + 1

> draw.plotmath.cell(expression(x < y), i, nr); i <- i + 1

> draw.plotmath.cell(expression(x <= y), i, nr); i <- i + 1

> draw.plotmath.cell(expression(x > y), i, nr); i <- i + 1

> draw.plotmath.cell(expression(x >= y), i, nr); i <- i + 1

> draw.plotmath.cell(expression(x %~~% y), i, nr); i <- i + 1

> draw.plotmath.cell(expression(x %=~% y), i, nr); i <- i + 1

> draw.plotmath.cell(expression(x %==% y), i, nr); i <- i + 1

> draw.plotmath.cell(expression(x %prop% y), i, nr); i <- i + 1

> draw.plotmath.cell(expression(x %~% y), i, nr); i <- i + 1

 

Installing Dataprotector 9 Agents on Debian 8

For some reason, dataprotector agents are released as an ISO image, with a +3000 lines shell script omnisetup.sh.

sudo ./omnisetup.sh -server myserver.myorg.es -install da

This lengthy script install dataprotector clients or server in several architectures:

  • osf1

  • hp-ux

  • SunOs and Solaris

  • AIX,

  • Linux x86, linux ia64

  • sco_sv

  • Darwin

  • PowerPC

For linux, it relays con rpm configuration. For Debian, the way to go would be alien.

Packages needed for Dataprotector agents (DA):

The only packages that are needed for the agents are:

  • OB2-TS-CORE-A.09.00-1.x86_64

  • OB2-CORE-A.09.00-1.x86_64

  • OB2-DA-A.09.00-1.x86_64

So, our first and naive aproach was a conversion with Alien and install them via dpkg -i.

for RPM in *.rpm; do sudo alien -c -k -d --fixperms $RPM; done

This led to an error as this three packages couldn’t be installed because we lacked some util called omnicc.

At this point, I tried running omnicc with bash -x, so that I could see what the long omnisetup was trying to do in my Debian machine.

bash -x ./omnisetup.sh -server myserver.myorg.es -install da

And then I noticed that, though only the above packages were installed, some others were uncompressed and used:

rpm2cpio /usr/local/share/Software_HP_DP_9.00_for_Linux_TD586-15021/linux_x86_64/DP_DEPOT/OB2-CORE-IS-A.09.00-1.x86_64.rpm 

cpio -id ./opt/omni/databases/utils/gpl/x86_64/linux-x86-64/utils.tar

cp ./opt/omni/databases/utils/gpl/x86_64/linux-x86-64/utils.tar .
(...)
rpm2cpio /usr/local/share/Software_HP_DP_9.00_for_Linux_TD586-15021/linux_x86_64/DP_DEPOT/OB2-TS-CFP-A.09.00-1.x86_64.rpm

cpio -id ./opt/omni/databases/vendor/ts_core/gpl/x86_64/linux-x86-64/A.09.00/packet.Z

PacketFullPath=/tmp/omni_tmp/opt/omni/databases/vendor/ts_core
/gpl/x86_64/linux-x86-64/A.09.00/packet.Z

(...)

rpm2cpio /usr/local/share/Software_HP_DP_9.00_for_Linux_TD586-15021/linux_x86_64/DP_DEPOT/OB2-DAP-A.09.00-1.x86_64.rpm

cpio -id ./opt/omni/databases/vendor/da/gpl/x86_64/linux-x86-64/A.09.00/packet.Z

PacketFullPath=/tmp/omni_tmp/opt/omni/databases/vendor/da/gpl/x86_64/linux-x86-64/A.09.00/packet.Z

(...)

At this point, I decided to stick to rpm installation, and use the omnisetup.sh script.

These are the files from the ISO image that we need to distribute to our Debian machines:

linux_x86_64 
│   ├── DP_DEPOT
│   │   ├── gpg-hpPublicKey.pub
│   │   ├── OB2-CFP-A.09.00-1.x86_64.rpm
│   │   ├── OB2-CORE-IS-A.09.00-1.x86_64.rpm
│   │   ├── OB2-DA-A.09.00-1.x86_64.rpm
│   │   ├── OB2-DAP-A.09.00-1.x86_64.rpm
│   │   ├── OB2-TS-CFP-A.09.00-1.x86_64.rpm
│   │   ├── OB2-TS-CORE-A.09.00-1.x86_64.rpm
│   │   └── OB2-TS-CS-A.09.00-1.x86_64.rpm
│   ├── scripts_linux_x86_64
│   │   ├── verify_gpg_lnx.sh
│   │   └── verify_gpg_lnx.sh.sig
│   └── SIG
│   └── DP_DEPOT
│   ├── OB2-CFP-A.09.00-1.x86_64.rpm.sig
│   ├── OB2-CORE-IS-A.09.00-1.x86_64.rpm.sig
│   ├── OB2-DA-A.09.00-1.x86_64.rpm.sig
│   ├── OB2-DAP-A.09.00-1.x86_64.rpm.sig
│   ├── OB2-TS-CFP-A.09.00-1.x86_64.rpm.sig
│   ├── OB2-TS-CORE-A.09.00-1.x86_64.rpm.sig
│   └── OB2-TS-CS-A.09.00-1.x86_64.rpm.sig
├── LOCAL_INSTALL
│   └── omnisetup.sh
├── Readme.txt

Manual installation:

apt-get install -y liblua5.1-0 xinetd rpm2cpio rpm 
sudo ./omnisetup.sh -server myserver.myorg.es -install da

Reconfigure xinetd to serve omni

cat /etc/xinetd.d/dataprotector 

omni stream tcp nowait root /opt/omni/lbin/inet inet -log /var/opt/omni/log/inet.log

Puppet installation

I am proud to present my own dataprotectoragent puppet module to avoid manual installation of this agent

puppet module install esterniclos-dataprotector agent

class {"dataprotectoragent":
      dataprotectorserver => "dataprotector.my.com",
    }

Available from

Troubleshooting

During this project, I encountered The package needs to be reinstalled, but I can’t find an archive for it error, and, luckily,  IhaveaPC awesome tutorial to get rid of it.