Another simple but great directive. (Apache)
Wednesday, 11 January 2012
Thursday, 5 January 2012
Uninstall McAfee EPolicy agent
(From McAfee Forums)
Uninstall ePolicy Orchestor agent
All actions logged in as local administrator or user with admin rights.
1) Find the install location of CMA/EPO agent, usually one of:
c:\epoagent
c:\program files\mcafee\common framework
c:\program files\network associates\common framework
2) start/run browse to install folder
3) select frminst.exe and return to run box
4) add following switch to end of frminst.exe " /forceuninstall"
This gives "%install location%\frminst.exe" /forceuninstall
5) this should now uninstall the CMA/EPO agent
Wednesday, 4 January 2012
A very ugly script to collect Red Hat servers information
In development. The idea is parsing the fields to create a comma separated file.
######### hostname
echo "\"`hostname -s`\";"
######### dominio
echo "\"`hostname -d`\";"
######### ip1
echo "\"`ip addr show|grep inet|grep -v inet6|grep -v 127.0.0.1|awk '{print $2}'|head -1`\";"
######### ip2
echo "\"`ip addr show|grep inet|grep -v inet6|grep -v 127.0.0.1|awk '{print $2}'|tail -1`\";"
######### ha net?
if [ -f /proc/net/bond/bonding ];
then
echo "\"si\";"
else
echo "\"no\";"
fi
######### tipo
if [ $(dmidecode|grep Manufacturer|head -1|awk '{print $2}') == "VMware," ];
then
echo "\"virtual\";"
else
echo "\"fisico\";"
fi
######### fabricante
echo "\"`dmidecode|grep Manufacturer|head -1|awk -F: '{print $2}'|sed -e 's/^[ \t]*//'`\";"
######### modelo
echo "\"`dmidecode |grep 'Product Name'|head -1|awk -F: '{print $NF}'|sed -e 's/^[ \t]*//'`\";"
######### serie
echo "\"`dmidecode |grep 'Serial Number'|head -1 |awk -F: '{print $NF}'|sed -e 's/^[ \t]*//'`\";"
######### bits arquitectura
echo "\"`dmidecode |grep 'Core Enabled' -n3|tail -1|awk '{print $2}'|awk -F- '{print $1}'|sed -e 's/^[ \t]*//'`\";"
######### tipo so
echo "\"`uname -s`\";"
######### so
echo "\"`lsb_release -i|awk '{print $3}'`\";"
######### version so
echo "\"`lsb_release -r|awk '{print $2}'`\";"
######### kernel
echo "\"`uname -r`\";"
######### bits so
if [ `uname -m` == "i686" ];
then
echo "\"32\";";
else echo "\"64\";";
fi
######### ram (Mb)
echo "\"`free -m|grep Mem|awk '{print $2}'`\";"
######### swap
echo "\"`free -m|grep Swap|awk '{print $2}'`\";"
######### cpu
echo "\"`cat /proc/cpuinfo |grep 'model name'|head -1|awk -F: '{print $2}'`\";"
######### nucleos
echo "\"`cat /proc/cpuinfo |grep 'model name'|wc -l`\";"
######### hora
echo "\"`date`\";"
######### tipo hora
echo "\"`ps aux |grep ntp|grep -v grep > /dev/null ; if [ $? == "0" ];then echo "ntp"; else echo "local"; fi`\";"
######### tz archivo
echo "\"`ls -l /etc/localtime| awk -F/ '{print $NF}'`\";"
######### tz date
echo "\"`date +%Z`\";"
######### srv. ntp
if [ `grep server /etc/ntp.conf |grep -v "#"|awk '{print $2}'|grep "165.182.219.198" > /dev/null; echo $?` == 0
];then
if [ `grep server /etc/ntp.conf |grep -v "#"|awk '{print $2}'|wc -l` == 1 ]; then
echo "ntp_server_ip";
else
echo "++ ntp_server_ip";
fi;
else
echo "not company";
fi
######### sync. ntp
if [ `ntpq -p>/dev/null; echo $?` == 0 ];
then
echo "\"ok\";";
else echo "\"nok\";";
fi
######### ag. respaldo instalados
if [ `rpm -q TIVsm-BA->/dev/null;echo $?` == 0 ];
then
echo "\"tivoli\";";
else
if [ `rpm -q BABcmagt>/dev/null; echo $?` == 0 ];
then
echo "\"brightstor\";";
else
echo "\"no instalado\";";
fi
fi
######### estado ag. respaldo
if [ `rpm -q TIVsm-BA->/dev/null;echo $?` == 0 ];
then
if [ "$(pidof dsmc)" ] && [ `netstat -putan |grep ":1501" > /dev/null;echo $?` == 0 ];
then
echo "\"ok\";";
else
echo "\"nok\";";
fi
else
if [ `rpm -q BABcmagt>/dev/null; echo $?` == 0 ];
then
if [ "$(pidof caagentd)" ] && [ `netstat -putan |grep tcp|grep ":6051" > /dev/null;
echo $?` == 0 ];
then
echo "\"ok\";";
else
echo "\"nok\";";
fi
fi
fi
######### ag. monitoreo
if [ -f /etc/init.d/zabbix_agentd ];
then
echo "\"zabbix\";";
else
echo "\"no instalado\";";
fi
######### estado ag. monitoreo
if [ "$(pidof zabbix_agentd)" ];
then
echo "\"ok\";";
else
echo "\"nok\";";
fi
######### hd total
echo "\"`vgdisplay --units g|grep -v failed|grep 'VG Size'|awk '{print $(NF-1)}'|awk '{sum+=$1} END {print sum}'|
tail -1`\";"
######### hd asignado
echo "\"`vgdisplay --units g|grep -v failed|grep 'Alloc PE'|awk '{print $(NF-1)}'|awk '{sum+=$1} END {print sum}'|
tail -1`\";"
######### hd asignable
echo "\"`vgdisplay --units g|grep -v failed|grep 'Free PE'|awk '{print $(NF-1)}'|awk '{sum+=$1} END {print sum}'|
tail -1`\";"
######### hostname
echo "\"`hostname -s`\";"
######### dominio
echo "\"`hostname -d`\";"
######### ip1
echo "\"`ip addr show|grep inet|grep -v inet6|grep -v 127.0.0.1|awk '{print $2}'|head -1`\";"
######### ip2
echo "\"`ip addr show|grep inet|grep -v inet6|grep -v 127.0.0.1|awk '{print $2}'|tail -1`\";"
######### ha net?
if [ -f /proc/net/bond/bonding ];
then
echo "\"si\";"
else
echo "\"no\";"
fi
######### tipo
if [ $(dmidecode|grep Manufacturer|head -1|awk '{print $2}') == "VMware," ];
then
echo "\"virtual\";"
else
echo "\"fisico\";"
fi
######### fabricante
echo "\"`dmidecode|grep Manufacturer|head -1|awk -F: '{print $2}'|sed -e 's/^[ \t]*//'`\";"
######### modelo
echo "\"`dmidecode |grep 'Product Name'|head -1|awk -F: '{print $NF}'|sed -e 's/^[ \t]*//'`\";"
######### serie
echo "\"`dmidecode |grep 'Serial Number'|head -1 |awk -F: '{print $NF}'|sed -e 's/^[ \t]*//'`\";"
######### bits arquitectura
echo "\"`dmidecode |grep 'Core Enabled' -n3|tail -1|awk '{print $2}'|awk -F- '{print $1}'|sed -e 's/^[ \t]*//'`\";"
######### tipo so
echo "\"`uname -s`\";"
######### so
echo "\"`lsb_release -i|awk '{print $3}'`\";"
######### version so
echo "\"`lsb_release -r|awk '{print $2}'`\";"
######### kernel
echo "\"`uname -r`\";"
######### bits so
if [ `uname -m` == "i686" ];
then
echo "\"32\";";
else echo "\"64\";";
fi
######### ram (Mb)
echo "\"`free -m|grep Mem|awk '{print $2}'`\";"
######### swap
echo "\"`free -m|grep Swap|awk '{print $2}'`\";"
######### cpu
echo "\"`cat /proc/cpuinfo |grep 'model name'|head -1|awk -F: '{print $2}'`\";"
######### nucleos
echo "\"`cat /proc/cpuinfo |grep 'model name'|wc -l`\";"
######### hora
echo "\"`date`\";"
######### tipo hora
echo "\"`ps aux |grep ntp|grep -v grep > /dev/null ; if [ $? == "0" ];then echo "ntp"; else echo "local"; fi`\";"
######### tz archivo
echo "\"`ls -l /etc/localtime| awk -F/ '{print $NF}'`\";"
######### tz date
echo "\"`date +%Z`\";"
######### srv. ntp
if [ `grep server /etc/ntp.conf |grep -v "#"|awk '{print $2}'|grep "165.182.219.198" > /dev/null; echo $?` == 0
];then
if [ `grep server /etc/ntp.conf |grep -v "#"|awk '{print $2}'|wc -l` == 1 ]; then
echo "ntp_server_ip";
else
echo "++ ntp_server_ip";
fi;
else
echo "not company";
fi
######### sync. ntp
if [ `ntpq -p>/dev/null; echo $?` == 0 ];
then
echo "\"ok\";";
else echo "\"nok\";";
fi
######### ag. respaldo instalados
if [ `rpm -q TIVsm-BA->/dev/null;echo $?` == 0 ];
then
echo "\"tivoli\";";
else
if [ `rpm -q BABcmagt>/dev/null; echo $?` == 0 ];
then
echo "\"brightstor\";";
else
echo "\"no instalado\";";
fi
fi
######### estado ag. respaldo
if [ `rpm -q TIVsm-BA->/dev/null;echo $?` == 0 ];
then
if [ "$(pidof dsmc)" ] && [ `netstat -putan |grep ":1501" > /dev/null;echo $?` == 0 ];
then
echo "\"ok\";";
else
echo "\"nok\";";
fi
else
if [ `rpm -q BABcmagt>/dev/null; echo $?` == 0 ];
then
if [ "$(pidof caagentd)" ] && [ `netstat -putan |grep tcp|grep ":6051" > /dev/null;
echo $?` == 0 ];
then
echo "\"ok\";";
else
echo "\"nok\";";
fi
fi
fi
######### ag. monitoreo
if [ -f /etc/init.d/zabbix_agentd ];
then
echo "\"zabbix\";";
else
echo "\"no instalado\";";
fi
######### estado ag. monitoreo
if [ "$(pidof zabbix_agentd)" ];
then
echo "\"ok\";";
else
echo "\"nok\";";
fi
######### hd total
echo "\"`vgdisplay --units g|grep -v failed|grep 'VG Size'|awk '{print $(NF-1)}'|awk '{sum+=$1} END {print sum}'|
tail -1`\";"
######### hd asignado
echo "\"`vgdisplay --units g|grep -v failed|grep 'Alloc PE'|awk '{print $(NF-1)}'|awk '{sum+=$1} END {print sum}'|
tail -1`\";"
######### hd asignable
echo "\"`vgdisplay --units g|grep -v failed|grep 'Free PE'|awk '{print $(NF-1)}'|awk '{sum+=$1} END {print sum}'|
tail -1`\";"
A nice one liner to replicate the directories owner and groups
find . -type d|awk '{print "ls -ld "$1}'|ksh|awk '{print "chown "$3"."$4" "$9}'
Saturday, 8 October 2011
Creación de archivo parche localtime o ¿Qué hacer cuando al gobierno se le ocurre cambiar el cambio de hora?
Al revisar la configuración estándar de los archivos de hora local (en adelante /etc/localtime) se puede ver que a las 00:00 del 09 de septiembre se adelantará una hora, cambio que ya no es válido según las modificaciones de la autoridad oficial (en rojo):
[root@CentOS ~]# zdump -v /etc/localtime |grep 2011
/etc/localtime Sun Mar 13 02:59:59 2011 UTC = Sat Mar 12 23:59:59 2011 CLST isdst=1 gmtoff=-10800
/etc/localtime Sun Mar 13 03:00:00 2011 UTC = Sat Mar 12 23:00:00 2011 CLT isdst=0 gmtoff=-14400
/etc/localtime Sun Oct 9 03:59:59 2011 UTC = Sat Oct 8 23:59:59 2011 CLT isdst=0 gmtoff=-14400
/etc/localtime Sun Oct 9 04:00:00 2011 UTC = Sun Oct 9 01:00:00 2011 CLST isdst=1 gmtoff=-10800
Para evitar este cambio, es necesario crear un archivo /etc/localtime que no contenga el evento. Esto se debe hacer mediante el siguiente procedimiento:
Respaldo del archivo /etc/localtime actualmente en uso:
[root@CentOS etc]# cp /etc/localtime /etc/localtime.20111006.ffg.bak
Se debe observar que en algunos sistemas, /etc/localtime es un link simbólico hacia otra ruta en el disco. En estos casos, se debe respaldar el archivo destino del link.
Descargar una definición modificable del archivo tzdata desde http://www.iana.org/time-zones (data)
Una vez descargado el archivo, descomprimir y desempaquetar:
[root@CentOS ntp]# tar -zxvf tzdata2011k.tar.gz
Editamos el archivo southamerica:
[root@CentOS ntp]# vi southamerica
Dentro del archivo, buscamos en las reglas para Chile los eventos relativos a la fecha en cuestión:
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Chile 2011 only - Aug Sun>=16 4:00u 1:00 S
Rule Chile 2012 max - Oct Sun>=9 4:00u 1:00 S
Rule Chile 2011 only - May Sun>=2 3:00u 0 -
Rule Chile 2012 max - Mar Sun>=9 3:00u 0 -
Según el archivo sobre el que estamos trabajando, aparentemente el cambio de hora del 09 de octubre de 2011 ya no está considerado, por lo que procedemos a compilar el archivo usando zic:
[root@CentOS ntp]# zic southamerica
[root@CentOS ntp]# zic backward
El archivo southamerica contiene las reglas para crear el localtime, y el archivo backward la información relativa a los cambios de nombre de zona horaria en Linux/Unix.
Comprobamos que la compilación contenga solamente los eventos registrados para el año 2011:
[root@CentOS ntp]# zdump -v /usr/share/zoneinfo/Chile/Continental |grep 2011
/usr/share/zoneinfo/Chile/Continental Sun May 8 02:59:59 2011 UTC = Sat May 7 23:59:59 2011 CLST isdst=1 gmtoff=-10800
/usr/share/zoneinfo/Chile/Continental Sun May 8 03:00:00 2011 UTC = Sat May 7 23:00:00 2011 CLT isdst=0 gmtoff=-14400
/usr/share/zoneinfo/Chile/Continental Sun Aug 21 03:59:59 2011 UTC = Sat Aug 20 23:59:59 2011 CLT isdst=0 gmtoff=-14400
/usr/share/zoneinfo/Chile/Continental Sun Aug 21 04:00:00 2011 UTC = Sun Aug 21 01:00:00 2011 CLST isdst=1 gmtoff=-10800
Podemos ver que ya no existe ningún evento para lo que resta de 2011. Además revisamos los eventos para 2012:
[root@CentOS ntp]# zdump -v /usr/share/zoneinfo/Chile/Continental |grep 2012
/usr/share/zoneinfo/Chile/Continental Sun Mar 11 02:59:59 2012 UTC = Sat Mar 10 23:59:59 2012 CLST isdst=1 gmtoff=-10800
/usr/share/zoneinfo/Chile/Continental Sun Mar 11 03:00:00 2012 UTC = Sat Mar 10 23:00:00 2012 CLT isdst=0 gmtoff=-14400
/usr/share/zoneinfo/Chile/Continental Sun Oct 14 03:59:59 2012 UTC = Sat Oct 13 23:59:59 2012 CLT isdst=0 gmtoff=-14400
/usr/share/zoneinfo/Chile/Continental Sun Oct 14 04:00:00 2012 UTC = Sun Oct 14 01:00:00 2012 CLST isdst=1 gmtoff=-10800
Así, en este nuevo archivo localtime no aparece el evento del 09/10/2011 y se establece el siguiente evento para el 10 de marzo de 2012.
Subscribe to:
Posts (Atom)