On Tue, May 23, 2017 at 10:09:05PM +1000, Russell Coker wrote:
I am using sendxmpp to send notifications of system
errors. That requires
the XMPP client keep running. Xabber on Android sometimes stops for no
apparent reason (I have it configured to always have a notification so it
should never stop).
Is there a command-line program to check presence on XMPP so that I could
have it notify me by some other method if it detects that I haven't been on
for a while?
Dunno about an existing command line tool but it should be pretty simple
to write one in perl or python or something.
for python in debian, there is:
python-jabberbot - easily write simple Jabber bots
python-nbxmpp - Non blocking Jabber/XMPP Python library
python-xmpp - Python library for communication with XMPP (Jabber) servers
python-pyxmpp - XMPP and Jabber implementation for Python
python-sleekxmpp - Python XMPP (Jabber) Library Implementing Everything as a Plugin
python3-slixmpp - Threadless, event-based XMPP Python 3 library
python3-slixmpp-lib - Threadless, event-based XMPP Python 3 library (optional binary
module)
slixmpp seems to be python3 only. the others have python & python3
versions.
And for perl, there is:
libanyevent-xmpp-perl - implementation of the XMPP Protocol
libnet-xmpp-perl - XMPP Perl library
BTW, sendxmpp is a perl script that uses libnet-xmpp-perl (aka
Net::XMPP) so you already have that installed. It shouldn't be too hard
to hack up a modified version of sendxmpp that checks if the recipient
account has been logged in recently before sending the message. maybe
make it a generic subroutine (e.g. recipient(s), max seconds since last
seen, and message as args) and submit it as a patch upstream. Looking
at the man pages in the package, Net::XMPP::Presence will probably have
what you need.
or you could do it the crude/slack/easy way and just send an email every
time as well as attempting a jabber message. and just in case email is
down, use curl or lynx or something to fetch a specific URL (CGI script)
from some other server you control.
craig
--
craig sanders <cas(a)taz.net.au>