No se como configurar ese script para que me funcione...
Pues cambie solo cambio $username, $password, $hostname y no cuando
ejecuto el script con ./jabber.pl solo me arroja en la consola el
siguiente mensaje pero no me llega nada al usuario de jabber:
panamajack@Laptop-Inspiron-910:~/Escritorio$ ./jabber.pl
Usage...
./jabber.pl [jabberid] [message]
El 19/12/14 09:25, Alberto José García Fumero escribió:
El jue, 18-12-2014 a las 10:43 -0500, Rafael Pérez Saborit escribió:
Estoy usando xface, existiría alguna opción que me permita mandar un
mensaje a la interfaz de usuario que no sea por mail mandando el aviso.
Saludos
Hazlo por el Jabber ;-)
Cuando te haga falta avisar, ejecuta este script, que se posteó en la
lista hace algún tiempo. Le pasas como parámetros el usuario a quien
quieres contactar y el texto que desees. Te hace falta instalar
libnet-xmpp-perl.
#!/usr/bin/perl -w
#
# script for nagios notify via Jabber / Google Talk Instant Messaging
# using XMPP protocol and SASL PLAIN authentication.
#
# author: Andrew Elwell <a.elw...@physics.gla.ac.uk>
# based on work by Thus0 <th...@free.fr> and David Cox
#
# released under the terms of the GNU General Public License v2
# Copyright 2007 Andrew Elwell.
use strict;
use Net::XMPP;
## Configuration
my $username = "usuariodesdeelcualavisarás";
my $password = "notelavoyadecir";
my $resource = "nagios";
## End of configuration
my $len = scalar @ARGV;
if ($len ne 2) {
die "Usage...\n $0 [jabberid] [message]\n";
}
my @field=split(/,/,$ARGV[0]);
#------------------------------------
# Google Talk & Jabber parameters :
my $hostname = 'ip.del.servidor.jabber';
my $port = 5222;
my $componentname = 'ip.del.servidor.jabber';
my $connectiontype = 'tcpip';
my $tls = 0;#1
#------------------------------------
my $Connection = new Net::XMPP::Client();
# Connect to talk.google.com
my $status = $Connection->Connect(
hostname => $hostname, port => $port,
componentname => $componentname,
connectiontype => $connectiontype, tls => $tls);
if (!(defined($status))) {
print "ERROR: XMPP connection failed.\n";
print " ($!)\n";
exit(0);
}
# Change hostname
my $sid = $Connection->{SESSION}->{id};
$Connection->{STREAM}->{SIDS}->{$sid}->{hostname} = $componentname;
# Authenticate
my @result = $Connection->AuthSend(
username => $username, password => $password,
resource => $resource);
if ($result[0] ne "ok") {
print "ERROR: Authorization failed: $result[0] - $result[1]\n";
exit(0);
}
# Send messages
foreach ( @field ) {
$Connection->MessageSend(
to => "$_\@$componentname",
resource => $resource,
subject => "Notification",
type => "chat",
body => $ARGV[1]);
}
Suerte.
______________________________________________________________________
Lista de correos del Grupo de Usuarios de Tecnologías Libres de Cuba.
Gutl-l@jovenclub.cu
https://listas.jovenclub.cu/cgi-bin/mailman/listinfo/gutl-l
--
Este mensaje ha sido analizado por MailScanner
en busca de virus y otros contenidos peligrosos,
y se considera que está limpio.
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL:
<http://listas.jovenclub.cu/pipermail/gutl-l/attachments/20141222/badc6581/attachment.html>
______________________________________________________________________
Lista de correos del Grupo de Usuarios de Tecnologías Libres de Cuba.
Gutl-l@jovenclub.cu
https://listas.jovenclub.cu/cgi-bin/mailman/listinfo/gutl-l