views:

330

answers:

2

Is there any way to tell Monit to send XMPP notifications as well as emails on alerts?

+1  A: 

I don't know Monit, but if you can specify an arbitrary command, you could setup a python script that sends a message via DBus to either Pidgin or Finch. Pidgin/Finch should already be running and be connected.

Here is an example script:

#!/usr/bin/env python

import dbus, gobject, dbus.glib
import sys

bus = dbus.SessionBus()
obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface")

account = purple.PurpleAccountsFindAny('[email protected]/Home', 'prpl-jabber')
conv = purple.PurpleConversationNew(1, account, '[email protected]')
im = purple.PurpleConvIm(conv)
purple.PurpleConvImSend(im, sys.argv[1])
Francois Botha
Thank you. Yes, that's one possibility. I could use one of my Ruby scripts for this purpose.
Milan Novota
+1  A: 

Monit uses emails to send notifications. I don't know if a xmpp notification is provided, but you could use or code an email to xmpp gateway ?

I just found this : [http://invalidlogic.com/code/smtp-to-xmpp-gateway-in-ruby/%5D I don't know if it works, but it's an interesting solution to get email notifications (not only monit ones) onto your favorite xmpp client.

dzen
Well, that's an interesting option. Thanks!
Milan Novota