Archive for the 'sysadmin' Category

Kickstart ESXi 4.1

No me apetece cambiar todos los < y >, así que se verá regular :P

#########################################
# ESXi 4.1 Kickstart configuration #
#########################################

# Accept User Agreement
accepteula

# Root password
rootpw –iscrypted PASSWORD

# Disk autopartition
# TIP: Maybe needs some tunning
autopart –firstdisk –overwritevmfs

# Installation files
install url http://URL/4.1/

# Network configuration (install)
network –bootproto=dhcp –device=vmnic0

# Post-configuration tasks
# TIP: It runs in level 998 because is the latest level without root password
# It allow to run high privileges commands without entering the root password
%firstboot –unsupported –interpreter=busybox –level=998

# Enable remote administation
vim-cmd hostsvc/enable_remote_tsm
vim-cmd hostsvc/start_remote_tsm

# Enable local administration
vim-cmd hostsvc/enable_local_tsm
vim-cmd hostsvc/start_local_tsm

# NOTE:
# Enabling administration, shows a warning in vCenter
# In 4.1, it disappears by restarting the hostd agent:
# http://www.vcritical.com/2011/02/get-rid-of-those-esxi-tech-support-mode-warnings/
# In 5, there is an advanced parameter to ignore this:
# http://www.yellow-bricks.com/2011/07/21/esxi-5-suppressing-the-localremote-shell-warning/
# So, uncomment the next line, in 5 ;)
# esxcfg-advopt -s 1 /UserVars/SuppressShellWarning

# Syslog stuff
vim-cmd hostsvc/advopt/update Syslog.Remote.Hostname string
vim-cmd hostsvc/advopt/update Syslog.Remote.Port int 514
# Don’t know if it’s the datastore path of the server, so, disabled
#vim-cmd hostsvc/advopt/update Syslog.Remote.DatastorePath string “[datastoreName] /logfiles/hostName.log”

# Rename the local datastore
vim-cmd hostsvc/datastore/rename datastore1 “$(hostname -s)-local-storage-1″

# Configure ntp
echo “server NTPSERVER” >> /etc/ntp.conf
chkconfig ntpd on

# Configure snmpd
cat > /tmp/snmpd.xml << __SNMP__

COMMUNITIES
true
163 TARGETS

__SNMP__
cp /tmp/snmp.conf /etc/vmware/snmp.xml

# Configure DNS
cat > /etc/resolv.conf << __DNS__
search DOMAIN
nameserver DNS1
nameserver DNS2
__DNS__

# Configure depth queue
# LPFC820 (G7)
if esxcfg-module -l|grep lpfc820 ; then
/usr/sbin/esxcfg-module -s “lpfc0_lun_queue_depth=64 lpfc1_lun_queue_depth=64 lpfc2_lun_queue_depth=64 lpfc3_lun_queue_depth=64 lpfc4_lun_queue_depth=64 lpfc5_lun_queue_depth=64″ lpfc820
fi
# Qlogic
if esxcfg-module -l|grep ql2 ; then
/usr/sbin/esxcfg-module -s “ql2xmaxqdepth=64″ qla2xxx
fi
# LPFC740
if esxcfg-module -l|grep lpfc_740 ; then
/usr/sbin/esxcfg-module -s “lpfc0_lun_queue_depth=64 lpfc1_lun_queue_depth=64 lpfc2_lun_queue_depth=64 lpfc3_lun_queue_depth=64 lpfc4_lun_queue_depth=64 lpfc5_lun_queue_depth=64″ lpfc_740
fi

# Depth Queue
vim-cmd hostsvc/advopt/update Disk.SchedNumReqOutstanding long 64

# Lun Reset
/usr/sbin/esxcfg-advcfg -s 1 /Disk/UseLunReset
/usr/sbin/esxcfg-advcfg -s 0 /Disk/UseDeviceReset

#####################
# Check this in 4.1
#/usr/bin/vimsh -n -e “hostsvc/advopt/update Misc.RunningVCpuLimit int 192″
#sed -i -e ‘s!^!\t450\n\t400\n!g’ $CONFIG
#/usr/sbin/esxcfg-boot -b
#####################

# Create vSwitches
/usr/sbin/esxcfg-vswitch -L vmnic0 vSwitch0
/usr/sbin/esxcfg-vswitch -L vmnic1 vSwitch1
/usr/sbin/esxcfg-vswitch -L vmnic2 vSwitch2
/usr/sbin/esxcfg-vswitch -L vmnic3 vSwitch3
/usr/sbin/esxcfg-vswitch -L vmnic4 vSwitch4
/usr/sbin/esxcfg-vswitch -L vmnic5 vSwitch5
/usr/sbin/esxcfg-vswitch -L vmnic6 vSwitch6

# Interactive network configuration
chvt 1
exec < /dev/tty1 > /dev/tty1
clear

# Check if the hostname ends in
DOMAIN=”.”
nombre_host=”"

echo $nombre_host | grep -q $DOMAIN
RETVAL=$?

echo “”
while [ $RETVAL -ne 0 ]
do
read -p “Introduzca el nombre de host con FQDN: ” nombre_host
echo $nombre_host | grep -q $DOMAIN
RETVAL=$?
done

# Function to check if the IP is valid
valid_dotted_quad()
{
ERROR=0
oldIFS=$IFS
IFS=.
set -f
set — $1
if [ $# -eq 4 ]
then
for seg
do
case $seg in
“”|*[!0-9]*) ERROR=1;break ;; ## Segment empty or non-numeric char
*) [ $seg -gt 255 ] && ERROR=2 ;;
esac
done
else
ERROR=3 ## Not 4 segments
fi
IFS=$oldIFS
set +f
return $ERROR
}
# END

direccion_ip=”"

valid_dotted_quad $direccion_ip
RETVAL=$?

while [ $RETVAL -ne 0 ]
do
read -p “Introduzca la IP: ” direccion_ip
valid_dotted_quad $direccion_ip
RETVAL=$?
done

direccion_gateway=”"

valid_dotted_quad $direccion_gateway
RETVAL=$?

while [ $RETVAL -ne 0 ]
do
read -p “Introduzca el gateway: ” direccion_gateway
valid_dotted_quad $direccion_gateway
RETVAL=$?
done

unset sw

chvt 1
exec < /dev/tty1 > /dev/tty1

# Set IP, hostname, gateway with the interactive parameters
esxcfg-vmknic -i $direccion_ip -n 255.255.255.0 “Management Network”
esxcfg-advcfg -s $nombre_host /Misc/HostName
esxcfg-route -a default $direccion_gateway

# Configure /etc/hosts
echo “$direccion_ip $nombre_host $nombre_host” >> /etc/hosts

# Configure hostsvc to allow vmotion
# TIP: Don’t know if doesn’t needed anymore
cat << EOF > /etc/vmware/hostd/hostsvc.xml

normal

Vmotion

EOF

/usr/sbin/esxcfg-advcfg -s 1 /Migrate/Enabled

# 800 Mb Service Console
# TIP: Don’t needed in ESXi?
#sed -i -e ‘s/\/boot\/memSize\ =\ “[0-9][0-9][0-9]“/\/boot\/memSize\ =\ “800″/1′ /etc/vmware/esx.conf
#esxcfg-boot -g
#esxcfg-boot -b
#sed -i -e ‘s/^.*uppermem.*/uppermem 819200/g’ -e ‘s/mem=.*M/mem=800M/g’ /boot/grub/grub.conf

# VMimages and some other network file shares stuff
#mkdir -p /vmimages/isos

#echo “:/isos /vmimages/isos nfs soft,timeo=20,rsize=8192,wsize=8192 0 0″ >> /etc/fstab

# MOTD
MOTD=”Esta maquina es propiedad de PEPITO y cualquier uso debe estar autorizado por el departamento correspondiente. Cualquier otro uso sera perseguido y castigado de acuerdo a la legislacion vigente. Cualquier actividad realizada en, desde o hacia este sistema esta sujeta a monitorizacion sin previo aviso.”
echo $MOTD > /etc/motd
chmod 644 /etc/motd

# Enhace the prompt to show hostname in red
echo “export PS1=\”[\u@\e[31;1m\h\e[0m:\w]\\\\\$ \”" >> /etc/profile

# Some cron stuff
# TIP: Test it!
# http://www.jules.fm/Logbook/files/add_cron_job_vmware.html

cat << EOF >/tmp/crontab.root
# Run “X” script
30 5 3 * * /root/X
EOF

# Add cron stuff to crontab
crontab /tmp/crontab.root
rm /tmp/crontab.root

# Reboot/shutdown confirmation
# It doesn’t work, find some other solution
#cat << EOF >/usr/local/bin/confirm
##!/bin/bash
#prompt()
#{
# while true
# do
# echo -n “\$* s/n? ”
# read reply
# if [ "\$reply" = s -o "\$reply" = S ]
# then
# return 0
# elif [ "\$reply" = n -o "\$reply" = N ]
# then
# echo “Accion cancelada”
# exit 1
# else
# echo “Por favor, introduce ‘s’ o ‘n’”
# fi
# done
#}
#
#echo “Se va a realizar \$1″
#if prompt “Esta seguro de continuar”
#then
# prompt “Confirmelo por favor”
# \$@
#fi
#EOF
#
#chmod 755 /usr/local/bin/confirm
#
#echo “alias reboot=\”/usr/local/bin/confirm reboot\”" >> /etc/bashrc
#echo “alias shutdown=\”/usr/local/bin/confirm shutdown\”" >> /etc/bashrc
#echo “alias init=\”/usr/local/bin/confirm init\”" >> /etc/bashrc
#echo “alias halt=\”/usr/local/bin/confirm halt\”" >> /etc/bashrc

# Shell timeout after 5 min. inactivity
esxcfg-advcfg -s 300 /UserVars/TSMTimeOut

# Remove unused Port Groups
esxcfg-vswitch -D “VM Network” vSwitch0
esxcfg-vswitch -D “Service Console” vSwitch0

echo “ssh stream tcp nowait root /sbin/dropbearmulti dropbear ++min=0,swap,group=shell -i -K60″ >> /etc/inetd.conf
echo “ssh stream tcp6 nowait root /sbin/dropbearmulti dropbear ++min=0,swap,group=shell -i -K60″ >> /etc/inetd.conf

# Reboot
reboot

Post to Twitter Post to Facebook Send Gmail Post to LinkedIn

No Comments »

minWi on diciembre 1st 2011 in sysadmin, VMware

Kickstart RHEL6

No se ven bien los < y > :P
# Instalacion modo texto
text
install
skipx

# URL de instalacion
url –url http:///RedHat/6/Server
# Repositorio
repo –name=RHEL-6 –baseurl=http:///RedHat/6/Server
repo –name=Extras –baseurl=http:///extras

# Configuracion general
firstboot –disable
lang es_ES.UTF-8
keyboard es
rootpw –iscrypted firewall –disabled
authconfig –enableshadow –enablemd5
key –skip
selinux –disabled
timezone –utc Europe/Madrid

# Particionamiento con LVM
clearpart –all –initlabel
#zerombr yes
bootloader –location=mbr –md5pass=$1$glLthZeF$u9wREDqB6/O0WYOcZqvnJ.
part /boot –fstype ext3 –size=100 –asprimary
part pv.00 –size=1 –grow –asprimary
volgroup vg00 pv.00
logvol / –fstype ext3 –name=lvroot –vgname=vg00 –size=1024 –grow
logvol swap –fstype swap –name=lvswap –vgname=vg00 –size=512 –grow –maxsize=2048
reboot

# Paquetes
#%packages –resolvedeps
%packages

@core
@base
ntp
kernel-devel
gcc
#dkms-open-vm-tools

%pre
#!/bin/sh
chvt 3
exec < /dev/tty3 > /dev/tty3
clear
echo “- – - – Configuracion de red – - – - ”
echo -en “Introduzca direccion IP: ”
read ip

echo -en “Introduzca hostname: ”
read hostname

chvt 1
exec < /dev/tty1 > /dev/tty1

gateway=`echo $ip | cut -d. -f1,2,3`.254
netmask=
nameserver=

line=”network –bootproto static –ip $ip –netmask $netmask –hostname $hostname –gateway $gateway –nameserver $nameserver”
ks=”/tmp/ks.cfg”
sed -e “/^network/s/^network.*/$line/” $ks > ${ks}.tmp && mv ${ks}.tmp $ks
sed -e “s/ip_tag/$ip/g” $ks > ${ks}.tmp && mv ${ks}.tmp $ks
sed -e “s/gw_tag/$gateway/g” $ks > ${ks}.tmp && mv ${ks}.tmp $ks
sed -e “s/hostname_tag/$hostname/g” $ks > ${ks}.tmp && mv ${ks}.tmp $ks

%post
#!/bin/bash
chvt 3
exec < /dev/tty3 > /dev/tty3
# Banner y motd
MOTD=”Esta maquina es propiedad de y cualquier uso debe estar autorizado por el departamento de correspondiente. Cualquier otro uso sera perseguido y castigado de acuerdo a la legislacion vigente. Cualquier actividad realizada en, desde o hacia este sistema esta sujeta a monitorizacion sin previo aviso.”
echo $MOTD > /etc/motd
chmod 644 /etc/motd

chvt 1
exec < /dev/tty1 > /dev/tty1

IFACE=eth0
IFCFG_ETH0=/etc/sysconfig/network-scripts/ifcfg-eth0
NETWORK=/etc/sysconfig/network
DNS1=
DNS2=
DOMAIN=
NETMASK=
GATEWAY=gw_tag
IP=ip_tag
HOSTNAME=hostname_tag

echo “DEVICE=$IFACE” > $IFCFG_ETH0
echo “BOOTPROTO=static” >> $IFCFG_ETH0
echo “IPADDR=$IP” >> $IFCFG_ETH0
echo “NETMASK=$NETMASK” >> $IFCFG_ETH0
echo “GATEWAY=$GATEWAY” >> $IFCFG_ETH0
echo “ONBOOT=yes” >> $IFCFG_ETH0

echo “NETWORKING=yes”> $NETWORK
echo “HOSTNAME=$HOSTNAME.$DOMAIN” >> $NETWORK

echo “search $DOMAIN” > /etc/resolv.conf
echo “nameserver $DNS1″ >> /etc/resolv.conf
echo “nameserver $DNS2″ >> /etc/resolv.conf

echo “127.0.0.1 localhost.localdomain localhost” > /etc/hosts
echo “127.0.0.1 $HOSTNAME.$DOMAIN $HOSTNAME” >> /etc/hosts

# Script de sincronizacion de ntp
NTPSERVER=
echo “tinker panic 0″ > /etc/ntp.conf
echo “restrict 127.0.0.1″ >> /etc/ntp.conf
echo “restrict default kod nomodify notrap” >> /etc/ntp.conf
echo “server $NTPSERVER” >> /etc/ntp.conf
echo “driftfile /var/lib/ntp/drift” >> /etc/ntp.conf

echo “$NTPSERVER” > /etc/ntp/step-tickers

chkconfig ntpd on

# Comprimir los logs de logrotate
echo “compress” >> /etc/logrotate.conf

# Repositorios locales
BASE=http:///RedHat/repos/RHEL-6.repo
EXTRAS=http:///RedHat/repos/Extras.repo

rm -f /etc/yum.repos.d/*.repo
wget $BASE -P /etc/yum.repos.d/
wget $EXTRAS -P /etc/yum.repos.d/

RPMKEY=http:///centos/RPM-GPG-KEY-CentOS-5
wget $RPMKEY -P /etc/pki/rpm-gpg/

# Deshabilitar servicios innecesarios al arranque
SERVICIOS=”bluetooth cups gpm ip6tables iptables sendmail smartd”
for i in $SERVICIOS
do
chkconfig $i off
done

# Activar el timeout de la shell despues de 5 minutos de inactividad
echo “TMOUT=300″ >> /etc/bashrc
echo “readonly TMOUT” >> /etc/bashrc
echo “export TMOUT” >> /etc/bashrc

# Instalar VMTools
# Q&D
wget http:///vmtools/vmtools.tar.gz
tar xzvf vmtools.tar.gz
vmware-tools-distrib/vmware-install.pl –default
rm -f vmtools.tar.gz
rm -Rf vmware-tools-distrib/

# Actualizar paquetes
#yum -y update
#yum clean packages

# Confirmacion para reiniciar/apagar el equipo

cat << EOF >/usr/local/bin/confirm
#!/bin/bash
prompt()
{
while true
do
echo -n “\$* s/n? ”
read reply
if [ "\$reply" = s -o "\$reply" = S ]
then
return 0
elif [ "\$reply" = n -o "\$reply" = N ]
then
echo “Accion cancelada”
exit 1
else
echo “Por favor, introduce ‘s’ o ‘n’”
fi
done
}

echo “Se va a realizar \$1″
prompt “Esta seguro?”
\$@
EOF

chmod 755 /usr/local/bin/confirm

echo “alias reboot=\”/usr/local/bin/confirm reboot\”" >> /etc/bashrc
echo “alias shutdown=\”/usr/local/bin/confirm shutdown\”" >> /etc/bashrc
echo “alias init=\”/usr/local/bin/confirm init\”" >> /etc/bashrc
echo “alias halt=\”/usr/local/bin/confirm halt\”" >> /etc/bashrc

# Prevenir reinicios accidentales por pulsar ctrl+alt+supr
#sed -i ‘s!^ca::.*!ca::ctrlaltdel:/bin/echo “CTRL + ALT + SUPR is disabled”!g’ /etc/inittab

Post to Twitter Post to Facebook Send Gmail Post to LinkedIn

No Comments »

minWi on diciembre 1st 2011 in CentOS, sysadmin

Añadir drivers al instalador de ESXi

Presupongo que perderás soporte, pero puede ser útil para entornos de lab:

http://www.ntpro.nl/blog/archives/1602-Injecting-drivers-into-the-ESXI-installer.html

Post to Twitter Post to Facebook Send Gmail Post to LinkedIn

No Comments »

minWi on septiembre 28th 2011 in sysadmin, VMware

Parches de VMware

En esta página -> http://www.vmware.com/patchmgr/findPatch.portal se encuentran todos los parches de los productos de VMware.

Además permite buscar por versiones y/o grado de “severidad”, con lo cual viene bastante bien tenerla “a mano”.

Post to Twitter Post to Facebook Send Gmail Post to LinkedIn

No Comments »

minWi on septiembre 28th 2011 in sysadmin, VMware

Solución a “ambiguous target” en scp

Cuando alguna de las rutas (origen o destino) del comando scp contiene espacios en blanco (aun “escapandolos” con la barra invertida \), falla mostrando el error “ambiguous target”.

scp <ruta_fichero_origen> <usuario>@<host_destino>:<ruta_con_espacios\ escapados>
scp: ambiguous target

La solución es entrecomillar:

scp <ruta_fichero_origen> <usuario>@<host_destino>:"<ruta_con_espacios\ escapados>"

Post to Twitter Post to Facebook Send Gmail Post to LinkedIn

No Comments »

minWi on septiembre 27th 2011 in Linux, sysadmin

Integración de IT PAM y Webform de Drupal

Después de haberme pegado bastante con ello, lo dejo aquí por si vale para alguien en el futuro, y le ahorro algún disgusto :)

NOTA: Tengo poca idea de PHP, SOAP, WSDL, etc., pero creo que al final no me ha quedado del todo mal….

PROBLEMA:

Se quiere integrar un formulario de Drupal (alta de nueva máquina virtual), con un proceso de IT PAM, que crea la máquina virtual, da el alta en la CMDB, etc.

El problema viene en como notificar al IT PAM que hay un nuevo formulario. La primera idea, es crear un proceso que cada X tiempo, verifique si hay un formulario nuevo en base de datos, y si lo hay, procesarlo. Obviamente este comportamiento es un poco “chapucero” y nada elegante.

Investigando un poco el tema, hemos averiguado que IT PAM tiene un servicio web que puede ser consumido, enviandole la petición adecuada, usuario, proceso a desencadenar, etc.

Este servicio web se puede consultar en

http://<itpamhost>:8080/itpam/soap

con ?wsdl al final, para ver el xml.

Se probó a consumir el servicio web utilizando curl, funcionando de manera satisfactoria, creando un xml como este:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:itp="http://www.ca.com/itpam">
   <soapenv:Header/>
   <soapenv:Body>
      <itp:executeStartRequest>
         <itp:auth>
            <itp:user>USUARIO</itp:user>
            <itp:password>PASSWORD</itp:password>
         </itp:auth>
          <itp:objLocation>
            <itp:name>NOMBRE_PROCESO</itp:name>
            <itp:path>PATH_PROCESO</itp:path>
         </itp:objLocation>
       </itp:executeStartRequest>
   </soapenv:Body>
</soapenv:Envelope>

Sin embargo, consumirlo con curl tenía los mismos problemas que el anterior supuesto (habría que comprobar de alguna manera que ha sido actualizada la base de datos), y ejecutar un proceso con un trigger de mysql no es nada recomendable (problemas de seguridad, locking,…)

SOLUCION:

Se creó un fichero .php que realizaba el proceso “manualmente” de manera correcta:

<?php
      // include soap file
      require_once('nusoap/nusoap.php');

      // set end point
      $endpoint = "http://<ITPAMHOST>:8080/itpam/soap";

      // create client
      $client = new nusoap_client($endpoint);

      if ( $client->getError() ) {
        print "Soap Constructor Error: ";
        print_r($client->getError());
      }

      // Human readable
      $request = <<<HEREDOC
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:itp="http://www.ca.com/itpam">
   <soapenv:Header/>
   <soapenv:Body>
      <itp:executeStartRequest>
         <itp:auth>
            <itp:user>USUARIO</itp:user>
            <itp:password>PASSWORD</itp:password>
         </itp:auth>
         <itp:objLocation>
            <itp:name>NOMBRE_PROCESO</itp:name>
            <itp:path>PATH_PROCESO</itp:path>
         </itp:objLocation>
      </itp:executeStartRequest>
   </soapenv:Body>
</soapenv:Envelope>
HEREDOC;

      $msg     = $client->serializeEnvelope($request, '', array(), 'document', 'encoded', '');
      $result  = $client->send($msg,"executeStartRequest");

      if ( $client->fault ) { //soap_fault
        print "Soap Fault :";
        print_r($client->fault->faultcode);
        print_r($client->fault->faultstring);
      }
      elseif ( $client->getError() ) {
        print "Soap Error :";
        print_r($client->getError());
      }
      else {
        print "Result: ";
        print_r($result);
      }

?>

Aprovechando que Drupal es opensource, y teniendo el codigo, se intentó modificar parte del codigo del modulo encargado de la gestión de modulos (webform), sin exito.

Investigando un poco más, se vió que el modulo Webform, tiene una API, que permite ejecutar “cosas” en distintos puntos del proceso (antes de entrar en base de datos, al actualizar, etc.)

Por lo tanto, solo quedaba encontrar como utilizar esa característica para nuestros propositos.

La solución más elegante (y la que se ha usado), es crear un modulo de Drupal nuevo, llamado “itpam”, que utiliza el “hook” _webform_submission_insert cuyo contenido es:

itpam/itpam.info:

; $Id: $
name = ITPAM
description = "Module for notify IT PAM"
package = Administration
core = 6.x
php = 5.1

itpam/itpam.module:


<?php
function itpam_webform_submission_insert ($node, $submission){

if ($node->nid == 104){

      // include soap file
      require_once('nusoap/nusoap.php');

      // set end point
      $endpoint = "http://itpamhost:8080/itpam/soap";

      // create client
      $client = new nusoap_client($endpoint);

      if ( $client->getError() ) {
        print "Soap Constructor Error: ";
        print_r($client->getError());
      }

      // Human readable
      $request = <<<HEREDOC
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:itp="http://www.ca.com/itpam">
   <soapenv:Header/>
   <soapenv:Body>
      <itp:executeStartRequest>
         <itp:auth>
            <itp:user>USUARIO</itp:user>
            <itp:password>PASSWORD</itp:password>
         </itp:auth>
         <itp:objLocation>
            <itp:name>NOMBRE_PROCESO</itp:name>
            <itp:path>PATH_PROCESO/</itp:path>
         </itp:objLocation>
      </itp:executeStartRequest>
   </soapenv:Body>
</soapenv:Envelope>
HEREDOC;

      $msg     = $client->serializeEnvelope($request, '', array(), 'document', 'encoded', '');
      $result  = $client->send($msg,"executeStartRequest");

      if ( $client->fault ) { //soap_fault
        print "Soap Fault :";
        print_r($client->fault->faultcode);
        print_r($client->fault->faultstring);
      }
      elseif ( $client->getError() ) {
        print "Soap Error :";
        print_r($client->getError());
      }
      else {
        print "Result: ";
        print_r($result);
      }
}
}
?>

Este modulo se activa cuando se inserta un registro nuevo en la base de datos (se ha añadido el chequeo $node->nid == 104, que es el correspondiente en este caso, al alta de máquina virtual)

Una vez creado el modulo, y con los permisos adecuados, se activa el modulo desde la interfaz de administración de Drupal, é voilá!

PD.- Falta cambiar un par de detalles, pero como “guia” vale :)

Post to Twitter Post to Facebook Send Gmail Post to LinkedIn

No Comments »

minWi on septiembre 23rd 2011 in programación, sysadmin

Redimensionar lv

Quick tip:

  • Hacer backup
  • Desmontar
  • Pasar fsck
  • Redimensionar sistema de ficheros
  • Redimensionar lv
  • Pasar fsck
  • Montar

Ojo, porque se pueden perder datos… por eso lo del backup! :D

Post to Twitter Post to Facebook Send Gmail Post to LinkedIn

No Comments »

minWi on mayo 7th 2009 in Linux, sysadmin

CentOS 5.3 *almost* out

La gente de CentOS ya tiene preparada la versión 5.3 de la “hermana” de RHEL.

De momento no hay anuncio oficial ni dia de salida, pero sin embargo, en el foro, se han dejado caer ya los torrents, que no estan completos (96%, creo), y en el momento en que sea oficial, se completarán :D

Asi que yo, de momento, ya estoy descargando todas las versiones, aunque solo sea por ayudar con un poquito de ancho de banda :)

Los links de los torrents:

http://www.karan.org/mock/5.3/CentOS-5.3-i386-bin-1to6.torrent
http://www.karan.org/mock/5.3/CentOS-5.3-i386-bin-DVD.torrent
http://www.karan.org/mock/5.3/CentOS-5.3-x86_64-bin-1to7.torrent
http://www.karan.org/mock/5.3/CentOS-5.3-x86_64-bin-DVD.torrent

Post to Twitter Post to Facebook Send Gmail Post to LinkedIn

No Comments »

minWi on marzo 31st 2009 in CentOS, Linux, sysadmin

Eliminar modulos antes de suspender en linux

Un miniapunte:
Si hay que “bajar” un modulo antes de suspender el equipo (por ejemplo, un iBook G4 con OpenSUSE), hay que añadir la siguiente linea al fichero /etc/pm/config.d/unload_modules (el nombre unload_modules es opcional):
SUSPEND_MODULES=”nombredelmodulo”
Por ejemplo, el modulo b43 del airport extreme

Post to Twitter Post to Facebook Send Gmail Post to LinkedIn

No Comments »

minWi on junio 25th 2008 in Linux, opensuse, sysadmin

Mac OS X 10.5.2 + NAS + Time Machine = funciona! :D

Recientemente he comprado una NAS, concretamente una CH3SNAS, y dos discos duros Maxtor SATAII de 500 Gb con 32 Mb de buffer, y la configuración que he dejado ha sido en RAID1 (seguridad ante todo :D )
Para hacerla funcionar con time machine, ha sido un poco más costoso que poner una linea en el terminal… los pasos necesarios son:

  1.  Desde la terminal, poner: defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
  2. Crear una imagen de disco EN LOCAL, con el nombre del mac, guion bajo, dirección mac de la interfaz en0 (p.ej minWimac_00112233445566). El formato de la imagen tiene que ser el siguiente:
        Mac OS Plus (con registro)
        Sin encriptación
        Sin mapa de particiones
        Imagen de disco de paquete dinámico
  3. Copiarla a la raiz del volumen de la NAS
  4. Configurar time machine :D
  5. Por cierto!, el CH3SNAS, tiene un firmware basado en linux… y adivinad que… es totalmente “hackeable” :D Yo ya tengo activado el acceso telnet a la NAS, y además, haciendo uso del puerto usb, puedo montar mi viejo disco duro usb a la NAS :D INCREIBLE!!!

    Post to Twitter Post to Facebook Send Gmail Post to LinkedIn

6 Comments »

minWi on marzo 30th 2008 in backup, Howtos, Linux, sysadmin

  • RSS
  • Facebook
  • Google+
  • LinkedIn
  • Twitter
  • Picasa
  • Flickr
  • YouTube