PDA

View Full Version : Send notifies by xmpp (jabber)


sauron
24-01-2006, 17:29
For this need installed sendxmpp (http://www.djcbsoftware.nl/code/sendxmpp/)

Put xmpp.sh in zabbix scripts directory. Create config file sendxmpprc:

#account password
zabbix@jabber.server jabber


chown and chmod this file to zabbix user/

chown zabbix sendxmpprc
chmod 0600 sendxmpprc


create xmpp.sh:

#!/bin/sh
echo "$3" | sendxmpp -f /path/sendxmpprc -s "$2" "$1"

where path - path to sendxmpprc.

chmod xmpp.sh:



Then add script in media, and add to need user notification.

cameronsto
24-01-2006, 18:01
This is very cool. For those trying to get this working, I had to install the Net::XMPP perl module by entering the cpan shell with:
perl -MCPAN -e shell
then entering:
install Net::XMPP
It will probably ask you to download a few other dependent modules, so enter yes for each of the prompts.

The instructions available at the sendxmpp site cover how to install it from there.

-cameron

sauron
25-01-2006, 06:06
yep :) I'm use emerge sendxmpp :D

cameronsto
25-01-2006, 15:36
Has anyone been able to get this to work with Google's Talk servers? I've tried many different scripts/libraries, but never get it to work. Seems like I can connect to jabber.org fine though.

-cameron

sauron
26-01-2006, 07:40
I'm think you need ssl enable connection ;)

DiedX
01-02-2006, 23:32
very, very cool indeed :)

Thanks!

Alexei
02-02-2006, 09:45
Would you be interested to have it implemented into ZABBIX core?

Nate Bell
02-02-2006, 17:10
Would you be interested to have it implemented into ZABBIX core?

Absolutely! I made a custom script similar to the one used here, and IMO jabber alerts are much more useful during working hours than email alerts, since they automatically pop up on your screen as soon as the trigger gets tripped. My coworkers love them (well, sort of, since the alerts usually mean something went wrong). But my Jabber script is a bit of a hack, and something more core to Zabbix would be great!

Nate

DiedX
02-02-2006, 21:50
Makes that +1. I had this baby implemented yesterday, and it works like a charm :)

axel
03-02-2006, 17:20
Hi i have some problems ;) wie use our own jabber server with only ssl.


zabbix@zabbix2:~$ sendxmpp -t -v -f /etc/zabbix/sendxmpprc asdasd
sendxmpp: config: 'password' => 'xxxxx'
sendxmpp: config: 'jserver' => 'abcd.net'
sendxmpp: config: 'port' => '5223'
sendxmpp: config: 'username' => 'axel'
Use of uninitialized value in string eq at /usr/bin/sendxmpp line 365.
Error 'Connect': [HASH(0x8778e18)]

My be a problem with tls ?

sauron
07-02-2006, 12:25
Hi i have some problems ;) wie use our own jabber server with only ssl.


zabbix@zabbix2:~$ sendxmpp -t -v -f /etc/zabbix/sendxmpprc asdasd
sendxmpp: config: 'password' => 'xxxxx'
sendxmpp: config: 'jserver' => 'abcd.net'
sendxmpp: config: 'port' => '5223'
sendxmpp: config: 'username' => 'axel'
Use of uninitialized value in string eq at /usr/bin/sendxmpp line 365.
Error 'Connect': [HASH(0x8778e18)]

My be a problem with tls ?
username' => 'axel@abcd.net'
username shuld contain server name and @

roger69
23-02-2006, 22:21
I found this page:

http://www.pervasive-network.org/SPIP/GoogleTalk-with-perl

There are two different methods here, one using a Perl module, and another just relying on Net::XMPP, to send messages via XMPP through Google Talk.

Thought this might be useful. I was not able to get sendxmpp to work with Google Talk, but I am happily now using the Perl module and the provided sendgtalk.pl script to send notifications through Gtalk.

erisan500
11-04-2006, 10:10
Has anyone got this working on Centos 4.3 ? I'm messing with this for 2 weeks now without success. Any help is highly appreciated.

Thanks in advance.

:( EriSan :(

alexander
04-09-2007, 15:56
Sorry for my english.
I'm trying to set up jabber notification, but on

sendxmpp -u zabbix -p zabbix -j jabber alexander@jabber

i'v got:

Usage: Authen::SASL::Cyrus::client_new(pkg, parent, service, host, ...) at /usr/lib/perl5/vendor_perl/5.8.8/Authen/SASL.pm line 74.

could anybody help me with it?

Flu
07-09-2007, 16:14
Here's how I accomplished Jabber notifications when trying to set this up on my Zabbix server, which is running Fedora 7. This technique is being used to send messages to an Openfire Jabber server on our local network, but I imagine it will work with most any Jabber server.

I ended up installing the python-xmpp RPM on Fedora with the yum install python-xmpp command. I believe the website for this package is located at http://xmpppy.sourceforge.net/. Anyhow, I then modified the xsend.py example application that comes with it and shoved it inside of the /usr/local/bin/ directory. Here is the modified program which I called jabber_send.py.

You'll need to alter the sender_jabber_id@yourdomain.com, sender_jabber_username and sender_jabber_password lines to match the appropriate sender account information on your Jabber server.


#!/usr/bin/python
# $Id: xsend.py,v 1.8 2006/10/06 12:30:42 normanr Exp $
import sys,os,xmpp,time

if len(sys.argv) < 2:
print "Syntax: jabber_send JID text"
sys.exit(0)

tojid=sys.argv[1]
text=' '.join(sys.argv[2:])


jidparams={}

jid=xmpp.protocol.JID('sender_jabber_id@yourdomain .com')
cl=xmpp.Client(jid.getDomain(),debug=[])

jidparams['username']="sender_jabber_username"
jidparams['password']="sender_jabber_password"
jidparams['resource']="Zabbix"


con=cl.connect()
if not con:
print 'could not connect!'
sys.exit()
print 'connected with',con
auth=cl.auth(jidparams['username'],jidparams['password'],resource=jidparams['resource'])
if not auth:
print 'could not authenticate!'
sys.exit()
print 'authenticated using',auth

#cl.SendInitPresence(requestRoster=0) # you may need to uncomment this for old server
id=cl.send(xmpp.protocol.Message(tojid,text))
print 'sent message with id',id

time.sleep(1) # some older servers will not send the message if you disconnect immediately after sending

#cl.disconnect()


Next I created the xmpp.sh script inside of the /var/lib/zabbix directory, containing the following code:

#!/bin/sh
# If no argument was given on the commandline, stop
if [ $# -lt 2 ];then
echo "Not enough arguments provided to $0"
exit
fi

jabber_send.py "$1" "$3"

Finally, inside of the Zabbix web configuration utility, I added a new Script media type with Jabber Script as the description and entered xmpp.sh for the script name. In order for a user to get a Jabber notification, make sure you add the Jabber Script Media type to for the appropriate person under Administration/Users inside of the Zabbix web configuration panel.

There might be a much easier way to do this these days, but I set the above system up and it works flawlessly for me on my system.

BusteR81
18-09-2007, 06:32
why go thr all this script mess ? i tried script with my own Openfire server but didnt get it to work... a waste of time !!! Finally i tried using the "Internal zabbix built-in Jabber". Oh man it works like a charm !! i created my own and for my network collegues jabber accounts at jabber.org and that is all.

Jabber alerts are working in zabbix 1.4.2 now. tested on 'live' network for 1 month. Stability ~93%

why i mention 93 % is because occasionally jabber.org webbie goes down for maintence and when jabber.org server up again, zabbix server will NOT resume the connection. it is like "Once broken, consider it Sold". so i need to kill and restart zabbix_server.

Suggestion:
Perhaps Alexi can intro a feature to check Jabber connection is constantly connected to jabber server (which we add in our alerts)

Cheers
CentOS 4.3 Mysql Zabbix 1.4.2

skaze
27-01-2008, 21:07
Yes we also suffer from some kind of 'reconnect' issue with 1.4.2. If i bounce zabbix all is well but only until openfire gets cycled again in the midnight backup process, once that happens no more jabber notifications from zabbix.

GOB
27-02-2008, 13:04
Does the built in jabber support work with an internal jabber (Openfire) server rather than a public one?
If it does can anyone provide any tips on configuring it? Our Jabber server uses Active Directory Authentication and I have created an AD user account for our Zabbix server.

Thanks

zeki893
01-01-2009, 03:14
why go thr all this script mess ? i tried script with my own Openfire server but didnt get it to work... a waste of time !!! Finally i tried using the "Internal zabbix built-in Jabber". Oh man it works like a charm !! i created my own and for my network collegues jabber accounts at jabber.org and that is all.

Jabber alerts are working in zabbix 1.4.2 now. tested on 'live' network for 1 month. Stability ~93%

why i mention 93 % is because occasionally jabber.org webbie goes down for maintence and when jabber.org server up again, zabbix server will NOT resume the connection. it is like "Once broken, consider it Sold". so i need to kill and restart zabbix_server.

Suggestion:
Perhaps Alexi can intro a feature to check Jabber connection is constantly connected to jabber server (which we add in our alerts)

Cheers
CentOS 4.3 Mysql Zabbix 1.4.2

You are the only person that has reported that the internal jabber is working. Can you share with us how you did this?

BusteR81
02-01-2009, 02:47
That was a long time ago with stable version 1.4.2

1) U need to compile zabbix server with -with-jabber
2) U need to install pk_config and imsel....
3) Visit jabber.org and create accounts
3a) for testing account -> Download Pidgin
4) Go to zabbix -> user -> enter the jabber account
5) zabbix -> admin -> enter it's jabber account

----------------------
Note: U need to open 1 'Artifical Intelligent' jabber account for zabbix_server which will be online 24/7. zabbix_server will use this account to notify zabbix users on alerts etc.

zeki893
02-01-2009, 22:49
Thanks for the reply! I had already done everything you told me before and I got it to work finally. I had to add the jabber alerts to the admin account. I don't know why, but it works with the admin account, but not with other accounts I create.

zeki893
02-01-2009, 23:01
damn I came back from the holidays and it doesn't wok again :mad:

zeki893
03-01-2009, 00:39
OMG after messing around for an hour I restarted the zabbix-server and it works again :confused:

zeki893
03-01-2009, 04:26
it seems it stops sending jabber alerts after an undefined amount of time until another zabbix_server restart is applied

pongraczi
04-05-2009, 11:44
It seems, I also have this kind of problem.
I just upgraded to 1.6.4, maybe this will solve this issue.

In details:
After some time the jabber notification stops working and I have to restart zabbix server.
I used jabber.org and jabber.hu accounts.

Regards,
István

alfiere
26-05-2009, 20:18
I have the same problem

zabbix 1.6.4
all the notifications work for few days, sometime a week, and after they stop.

No a single log line.

The only solution I found is to restart the zabbix daemon.


Any help from the sky? :)


Ciao,
Alf

pongraczi
26-05-2009, 20:34
I have the same problem

zabbix 1.6.4
all the notifications work for few days, sometime a week, and after they stop.

No a single log line.

The only solution I found is to restart the zabbix daemon.


Any help from the sky? :)


Ciao,
Alf

Hi,

somewhere in this forum I found a description, how to make a new media, which can use sendxmpp script to send jabber notification.

I followed that and I got sendxmpp working well, except, I had to hack the sendxmpp script to send the notification as 'chat' instead of 'message', because pidgin cannot show message (maybe pidgin bug).

Just try to search 'sendxmpp' to find the relevant topic.
This was a good learning curve, at least for me.

Cheers,
István