PDA

View Full Version : Zabbix, Jabber and Gtalk


alfiere
30-01-2009, 17:27
As far as I know Zabbix doesn't support Gtalk.

I'm able to interact with different Jabber servers, but "talk.google.com" is not one of them.

Googling around I found this useful link:
http://www.newwebplatform.com/scripts-and-programs/Google-Talk

With this script
http://www.pervasive-network.org/SPIP/Google-Talk-with-perl-bis
is possible to send messages thought gtalk, I suppose should not be so hard to integrate everything inside the Zabbix core.

my 2 cents.

Thanks and Cheers,
Alf

Tenzer
02-02-2009, 12:15
Since nothing in Zabbix is build on Perl, it would be odd (imo) to include this into the core package. Instead I would recommend you to use it as an external alert script, it is very easy to set up.

alfiere
03-02-2009, 11:58
UPDATE

After a quite long investigation, I can say:

Google Gtalk is completely inter operable with the Jabber network.
http://code.google.com/apis/talk/open_communications.html


1. I registered a free account with jabberes.org (jabber.org seems not working with gtalk)

2. From gtalk client or from gmail page u need to add the new account xxx@jabberes.org. In this way the jabberes.org server will automatically provide to authorize the gtalk invitation.

3. In the Zabbix GUI:
Administration->Media types->Create Media types->
Type: Jabber
Jabber Identifier: follow the schema user@server. In our case xxx@jabberes.org
password: of course the xxx@jabberes.org password

4. Now, in Administration->Users->"select your user" and insert the jabber media created.
"send to" will be your xxxx@gmail.com account.


During my test I encountered two different problems:
1. Some jabber servers (jabber.org for example) don't accept the gtalk invite... the request remain always pending
2. Not all the interactions with the Zabbix GUI are well understood from the zabbix server. I mean, to be sure to commit a change (made by the GUI) I strongly suggest to restart zabbix_server


Cheers,
Alf

ipguy
01-02-2011, 05:11
UPDATE

After a quite long investigation, I can say:

Google Gtalk is completely inter operable with the Jabber network.
http://code.google.com/apis/talk/open_communications.html


1. I registered a free account with jabberes.org (jabber.org seems not working with gtalk)

2. From gtalk client or from gmail page u need to add the new account xxx@jabberes.org. In this way the jabberes.org server will automatically provide to authorize the gtalk invitation.

3. In the Zabbix GUI:
Administration->Media types->Create Media types->
Type: Jabber
Jabber Identifier: follow the schema user@server. In our case xxx@jabberes.org
password: of course the xxx@jabberes.org password

4. Now, in Administration->Users->"select your user" and insert the jabber media created.
"send to" will be your xxxx@gmail.com account.


During my test I encountered two different problems:
1. Some jabber servers (jabber.org for example) don't accept the gtalk invite... the request remain always pending
2. Not all the interactions with the Zabbix GUI are well understood from the zabbix server. I mean, to be sure to commit a change (made by the GUI) I strongly suggest to restart zabbix_server


Cheers,
Alf

so how does this work if the jabber.org don't accept the gtalk invite ?

vins
08-02-2011, 17:34
this is the script i use for gtalk alerts: (it needs some cpan modules!)

#!/usr/bin/perl

use strict;
use warnings;

use Net::Jabber;
use POSIX qw(strftime);

my $recip = shift @ARGV;
my $mensaje = join ("\n",@ARGV);
my $room = "";

if ($recip=~m/\@conference/)
{
($room)=$recip=~m/(.*)\@conference/;
}

my $jserver="talk.google.com";
my $jport="5222";
my $domain="gmail.com.";

my $user="zabbix-alerts"; # gtalk user authentication
my $pass="zabbix-alerts";
my $nick="Zabbix Alert";

my $con = new Net::Jabber::Client();

sub Msg($) {
chomp($_[0]);
if ($room)
{
$con->MessageSend(to=>$recip, type=>"groupchat", body=>$_[0]);
} else {
$con->MessageSend(to=>$recip, type=>"chat", body=>$_[0]);
}
}

my $status = $con->Connect(hostname=>$jserver,port=>$jport,connectiontype=>'tcpip', tls=>'1',componentname=>'gmail.com');

defined $status or die "can't connect ($!)";

my @result = $con->AuthSend(username=>$user, password=>$pass, domain=>$domain, resource=>"$0-$$");

$result[0] eq "ok" or Stop("$result[0] $result[1]");

$con->RosterGet(); # tell server to send presence info
$con->PresenceSend(); # tell world that we are logged in

if ($room)
{
$con->MUCJoin(room=>$room, server=>"conference.$jserver", nick=>($nick||$user));
}

Msg($mensaje);
sleep 1;

$con->Disconnect();



zabbix@hostname:/home/zabbix/bin# ./jabber.pl user@gmail.com "sample message"