简体   繁体   中英

Monit XMPP notifications

有没有办法告诉Monit发送XMPP通知以及警报电子邮件?

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('sender@gmail.com/Home', 'prpl-jabber')
conv = purple.PurpleConversationNew(1, account, 'recipient@gmail.com')
im = purple.PurpleConvIm(conv)
purple.PurpleConvImSend(im, sys.argv[1])

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/] 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM