Siguiendo con los traps y perl
Luis Vivero
morenisco en gmail.com
Lun Oct 23 19:17:14 CLST 2006
Hola, hice los siguientes cambios en el script, probando en RH 4EL:
#!/usr/bin/perl
use SNMP::Util;
use strict;
use warnings;
# Variables
$PORT="162";
$HOST1="172.19.4.50";
$HOST2="192.168.228.10";
$COM_NAME="netadmro";
$E_OID=".1.3.6.1.4.1.4227";
$OID=".1.3.6.1.4.1.4227";
$GEN_TRAP_NUMBER="6";
$SPEC_TRAP_NUMBER="200";
$TYPE="string";
$VALUE="hello";
printf ("Hello World from Perl xD\n");
snmptrap("$COM_NAME\@$HOST1:$PORT",$E_OID,$HOST2,$GEN_TRAP_NUMBER,$SPEC_TRAP_NUMBER,$OID,$TYPE,$VALUE);
Y la salida del comando es la siguiente:
[testing en cc]$ perl trap.0.1.remote.pl
Global symbol "$PORT" requires explicit package name at
trap.0.1.remote.plline 6.
Global symbol "$HOST1" requires explicit package name at
trap.0.1.remote.plline 7.
Global symbol "$HOST2" requires explicit package name at
trap.0.1.remote.plline 8.
Global symbol "$COM_NAME" requires explicit package name at
trap.0.1.remote.pl line 9.
Global symbol "$E_OID" requires explicit package name at
trap.0.1.remote.plline 10.
Global symbol "$OID" requires explicit package name at
trap.0.1.remote.plline 11.
Global symbol "$GEN_TRAP_NUMBER" requires explicit package name at
trap.0.1.remote.pl line 12.
Global symbol "$SPEC_TRAP_NUMBER" requires explicit package name at
trap.0.1.remote.pl line 13.
Global symbol "$TYPE" requires explicit package name at
trap.0.1.remote.plline 14.
Global symbol "$VALUE" requires explicit package name at
trap.0.1.remote.plline 15.
Global symbol "$COM_NAME" requires explicit package name at
trap.0.1.remote.pl line 19.
Global symbol "$HOST1" requires explicit package name at
trap.0.1.remote.plline 19.
Global symbol "$PORT" requires explicit package name at
trap.0.1.remote.plline 19.
Global symbol "$E_OID" requires explicit package name at
trap.0.1.remote.plline 19.
Global symbol "$HOST2" requires explicit package name at
trap.0.1.remote.plline 19.
Global symbol "$GEN_TRAP_NUMBER" requires explicit package name at
trap.0.1.remote.pl line 19.
Global symbol "$SPEC_TRAP_NUMBER" requires explicit package name at
trap.0.1.remote.pl line 19.
Global symbol "$OID" requires explicit package name at
trap.0.1.remote.plline 19.
Global symbol "$TYPE" requires explicit package name at
trap.0.1.remote.plline 19.
Global symbol "$VALUE" requires explicit package name at
trap.0.1.remote.plline 19.
Execution of trap.0.1.remote.pl aborted due to compilation errors.
Si le saco los warnings y el strict, da lo siguiente:
Undefined subroutine &main::snmptrap called at trap.0.1.remote.pl line 19.
Me da la impresion que esta pescando otro modulo, o no esta asociando bien
el codigo al modulo deseado, y por eso alega (el codigo esta probado en
debian).
Saludos.
Luis Eduardo Vivero Peña.
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: http://listas.inf.utfsm.cl/pipermail/linux/attachments/20061023/4d0d6765/attachment.html
Más información sobre la lista de distribución Linux