Es una herramienta para monitorea un servidor de correo. En ocasiones es necesario migrar dicho servicio entre servidores, sin perder el historico actual, para eso:
1) Instala mailgraph
apt-get install rrdtool mailgraph
2) Configura mailgraph
less /etc/default/mailgraph
3) Define los valores correctos para $rrd, $rrd_virus, $tmp_dir en /usr/lib/cgi-bin/mailgraph.cgi
4) Exporta/importa los archivos rrd:
= Si estas migrando entre iguales arquitecturas con que pongas los archivos mailgraph.rrd y mailgraph_virus.rrd en la ruta correcta.
= Si la migracion es entre diferentes arquitecturas usa:
1. Exportar la base
# rrdtool dump archivo(s).rrd > respaldo.xml
2.Importar la base
# rrdtool restore respaldo.xml
Nota: Este procedimiento esta muy enfocado a que el servidor a donde se migrara la base de mailgraph sea un Debian, sin embargo en terminos generales solo variara el metodo de instalacion.
martes, 22 de abril de 2008
Script de perl para pruebas del servidor de correo....
Script para pruebas de recepcion de correo, normalmente lo uso para pruebas de stress
=====================================================================================
#!/usr/bin/perl
use MIME::Lite;
$to = $ARGV[0];
$msg = new MIME::Lite
From =>'midir@dominioorigen',
To =>$to,
Subject =>'Mail para prueba de stress',
Type =>'multipart/mixed';
attach $msg
Type =>'TEXT',
Data =>"
Aqui cualquier mensaje
";
$msg->send;
Script para probar que esta detectando correctamente correo spam
================================================================
#!/usr/bin/perl
use MIME::Lite;
$to = $ARGV[0];
$msg = new MIME::Lite
From =>'direccion@dominioorigen',
To =>$to,
Subject =>'Prueba para spam',
Type =>'multipart/mixed';
attach $msg
Type =>'TEXT',
Data =>"
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
";
$msg->send;
Script para probar que esta detectando correctamente correo con un adjunto con virus (clamav)
=============================================================================================
!/usr/bin/perl
use MIME::Lite;
$to = $ARGV[0];
### Adjust subject and body message
my $subject = 'A message with 2 parts ...';
my $message_body = "Here's the attachment file(s) you wanted";
### Adjust the filenames
my $my_file = '/home/marce/clam.cab';
### Create the multipart container
$msg = MIME::Lite->new (
From => 'midir@dominoorigen',
To => $to,
Subject => $subject,
Type =>'multipart/mixed'
) or die "Error creating multipart container: $!\n";
### Add the text message part
$msg->attach (
Type => 'TEXT',
Data => $message_body
) or die "Error adding the text message part: $!\n";
### Add the file
$msg->attach (
Type => 'image/gif',
Path => $my_file,
# Filename => $your_file_gif,
Disposition => 'attachment'
) or die "Error adding $file_gif: $!\n";
### Send the Message
MIME::Lite->send('smtp', $mail_host, Timeout=>60);
$msg->send;
NOTA:
En todos estos script se envia por argumento la direccion a quien sera enviado el mail.
=====================================================================================
#!/usr/bin/perl
use MIME::Lite;
$to = $ARGV[0];
$msg = new MIME::Lite
From =>'midir@dominioorigen',
To =>$to,
Subject =>'Mail para prueba de stress',
Type =>'multipart/mixed';
attach $msg
Type =>'TEXT',
Data =>"
Aqui cualquier mensaje
";
$msg->send;
Script para probar que esta detectando correctamente correo spam
================================================================
#!/usr/bin/perl
use MIME::Lite;
$to = $ARGV[0];
$msg = new MIME::Lite
From =>'direccion@dominioorigen',
To =>$to,
Subject =>'Prueba para spam',
Type =>'multipart/mixed';
attach $msg
Type =>'TEXT',
Data =>"
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
";
$msg->send;
Script para probar que esta detectando correctamente correo con un adjunto con virus (clamav)
=============================================================================================
!/usr/bin/perl
use MIME::Lite;
$to = $ARGV[0];
### Adjust subject and body message
my $subject = 'A message with 2 parts ...';
my $message_body = "Here's the attachment file(s) you wanted";
### Adjust the filenames
my $my_file = '/home/marce/clam.cab';
### Create the multipart container
$msg = MIME::Lite->new (
From => 'midir@dominoorigen',
To => $to,
Subject => $subject,
Type =>'multipart/mixed'
) or die "Error creating multipart container: $!\n";
### Add the text message part
$msg->attach (
Type => 'TEXT',
Data => $message_body
) or die "Error adding the text message part: $!\n";
### Add the file
$msg->attach (
Type => 'image/gif',
Path => $my_file,
# Filename => $your_file_gif,
Disposition => 'attachment'
) or die "Error adding $file_gif: $!\n";
### Send the Message
MIME::Lite->send('smtp', $mail_host, Timeout=>60);
$msg->send;
NOTA:
En todos estos script se envia por argumento la direccion a quien sera enviado el mail.
jueves, 17 de abril de 2008
Saber informacion de la configuracion de un sistema
AIX:
prtconf
lscfg
IRIX:
hinv - hardware -
chkconfig - software -
MAC OS:
system_profiler
SOLARIS:
prtconf
sysdef
LINUX:
/usr/sbin/lshw
por comandos separados:
uname - Version SO, arquitectura, nombre del host
free - memoria
/proc/cpuinfo - procesador
prtconf
lscfg
IRIX:
hinv - hardware -
chkconfig - software -
MAC OS:
system_profiler
SOLARIS:
prtconf
sysdef
LINUX:
/usr/sbin/lshw
por comandos separados:
uname - Version SO, arquitectura, nombre del host
free - memoria
/proc/cpuinfo - procesador
martes, 4 de marzo de 2008
Sony Vaio VGN-CR160F con Debian lenny/sid
Para actualizar de Etch a Lenny en Sony Vaio VGN-CR160F.
1) apt-get update
2) apt-get dist-upgrade
3) El sistema ya no levanta debido a que no se carga el modulo para el disco duro. Manda como el mensaje de error siguiente:
Begin: Waiting for root filesystem...
Done.
WARNING boot device may be renamed. Try root = /dev/hda3
ALERT! /dev/hda3 does not exist. Dropping to a shell!
Check your root= boot argument (cat /proc/cmdline)
Check for missing modules (cat /proc/modules), or device files (ls /dev)
BusyBox v1.01 (Debian 1:1.01-4) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
/bin/sh: can't access tty; job control turned off
/ #
4) En el shell ejecutar: modprobe ide-disk; modprobe ide-generic; exit
5) Cargando los modulos anteriores el sistema termina de arrancar. Pero es necesario que esos modulos sean cargados siempre:
a) agregar al archivo /etc/initramfs-tools/modules, las lineas ide-generic e ide-disk
b) mkinitramfs -v -o /boot/initrd.img-2.6.22.14 2.6.22.14
6) Reiniciar
Recapitulando:
* video: Es necesario xserver-xorg-video-intel, aunque ya no asi el paquete 915resolution.
* sonido: Paquetes alsa* a versiones 1.0.15-2 o superiores.
* La interfaz Ethernet: Modulo r8169.
* Red inalambrica: Modulo mac80211, iwlwifi-4965
* motioeye: Modulo r5u870-0
1) apt-get update
2) apt-get dist-upgrade
3) El sistema ya no levanta debido a que no se carga el modulo para el disco duro. Manda como el mensaje de error siguiente:
Begin: Waiting for root filesystem...
Done.
WARNING boot device may be renamed. Try root = /dev/hda3
ALERT! /dev/hda3 does not exist. Dropping to a shell!
Check your root= boot argument (cat /proc/cmdline)
Check for missing modules (cat /proc/modules), or device files (ls /dev)
BusyBox v1.01 (Debian 1:1.01-4) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
/bin/sh: can't access tty; job control turned off
/ #
4) En el shell ejecutar: modprobe ide-disk; modprobe ide-generic; exit
5) Cargando los modulos anteriores el sistema termina de arrancar. Pero es necesario que esos modulos sean cargados siempre:
a) agregar al archivo /etc/initramfs-tools/modules, las lineas ide-generic e ide-disk
b) mkinitramfs -v -o /boot/initrd.img-2.6.22.14 2.6.22.14
6) Reiniciar
Recapitulando:
* video: Es necesario xserver-xorg-video-intel, aunque ya no asi el paquete 915resolution.
* sonido: Paquetes alsa* a versiones 1.0.15-2 o superiores.
* La interfaz Ethernet: Modulo r8169.
* Red inalambrica: Modulo mac80211, iwlwifi-4965
* motioeye: Modulo r5u870-0
jueves, 21 de febrero de 2008
Eliminar de un nombre de archivo la extension..
#!/usr/bin/perl
#
# Eliminar de la cadena de nombre de un archivo
# la extension.
# El argumento es pasado en la linea de comando.
#############
@allwords = split(/\./, $ARGV[0]);
$ext = pop(@allwords);
foreach $item ( @allwords ){
print $item.".";
}
print "\n";
#
# Eliminar de la cadena de nombre de un archivo
# la extension.
# El argumento es pasado en la linea de comando.
#############
@allwords = split(/\./, $ARGV[0]);
$ext = pop(@allwords);
foreach $item ( @allwords ){
print $item.".";
}
print "\n";
lunes, 18 de febrero de 2008
Este link...
Learn 10 good UNIX usage habits
http://www-128.ibm.com/developerworks/aix/library/au-badunixhabits.html
http://www.ibm.com/developerworks/aix/library/au-unixtips/?ca=dgr-lnxw13goodunixhabits&S_TACT=105AGX59&S_CMP=GR
Comandos
http://cb.vu/unixtoolbox.xhtml
http://www.oreillynet.com/linux/cmd/
Referencias
http://www.unix.org.ua/orelly/
http://bhami.com/rosetta.html
Redes sociales
http://systemadmin.es/
http://houseofsysadmins.ning.com/
Interesante
http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
http://www-128.ibm.com/developerworks/aix/library/au-badunixhabits.html
http://www.ibm.com/developerworks/aix/library/au-unixtips/?ca=dgr-lnxw13goodunixhabits&S_TACT=105AGX59&S_CMP=GR
Comandos
http://cb.vu/unixtoolbox.xhtml
http://www.oreillynet.com/linux/cmd/
Referencias
http://www.unix.org.ua/orelly/
http://bhami.com/rosetta.html
Redes sociales
http://systemadmin.es/
http://houseofsysadmins.ning.com/
Interesante
http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
jueves, 17 de enero de 2008
Fecha formato unix a otro formato
#!/usr/bin/perl
#####################################
# Traduce de una fecha formato
# unix a fecha AAMMDDHHMMSS
#
#######################
print " Para salir escriba no \n";
while ( 1 ){
print " Introduce : ";
chomp($ARCH=);
if ( lc($ARCH) =~ /no/){
exit;
}
@timeData = localtime($ARCH);
#print " @timeData \n";
#Seconds,Minutes,Hours,Day,Months,years (since 1900),days( since sunday), Number of days since the start of the yer,Whether or not daylight savings is active
if (($timeData[5]-100)>=0 && ($timeData[5]-100)<=9){
print "0".($timeData[5]-100);
}
else{
print ($timeData[5]-100);
}
if (($timeData[4]+1)>=0 && ($timeData[4]+1)<=9){
print "0".($timeData[4]+1);
}
else{
print ($timeData[4]+1);
}
if (($timeData[3])>=0 && ($timeData[3])<=9){
print "0$timeData[3]";
}
else{
print "$timeData[3]";
}
if ($timeData[2]>=0 && $timeData[2]<=9){
print "0$timeData[2]";
}
else{
print "$timeData[2]";
}
if ($timeData[1]>=0 && $timeData[1]<=9){
print "0$timeData[1]";
}
else{
print "$timeData[1]";
}
if ($timeData[0]>=0 && $timeData[0]<=9){
print "0$timeData[0]";
}
else{
print "$timeData[0]";
}
print "\n";
}
==============
Ejemplo :
Para salir escriba no
Introduce : 1181715026
070613011026
Introduce : no
#####################################
# Traduce de una fecha formato
# unix a fecha AAMMDDHHMMSS
#
#######################
print " Para salir escriba no \n";
while ( 1 ){
print " Introduce : ";
chomp($ARCH=
if ( lc($ARCH) =~ /no/){
exit;
}
@timeData = localtime($ARCH);
#print " @timeData \n";
#Seconds,Minutes,Hours,Day,Months,years (since 1900),days( since sunday), Number of days since the start of the yer,Whether or not daylight savings is active
if (($timeData[5]-100)>=0 && ($timeData[5]-100)<=9){
print "0".($timeData[5]-100);
}
else{
print ($timeData[5]-100);
}
if (($timeData[4]+1)>=0 && ($timeData[4]+1)<=9){
print "0".($timeData[4]+1);
}
else{
print ($timeData[4]+1);
}
if (($timeData[3])>=0 && ($timeData[3])<=9){
print "0$timeData[3]";
}
else{
print "$timeData[3]";
}
if ($timeData[2]>=0 && $timeData[2]<=9){
print "0$timeData[2]";
}
else{
print "$timeData[2]";
}
if ($timeData[1]>=0 && $timeData[1]<=9){
print "0$timeData[1]";
}
else{
print "$timeData[1]";
}
if ($timeData[0]>=0 && $timeData[0]<=9){
print "0$timeData[0]";
}
else{
print "$timeData[0]";
}
print "\n";
}
==============
Ejemplo :
Para salir escriba no
Introduce : 1181715026
070613011026
Introduce : no
Suscribirse a:
Entradas (Atom)