Tuesday, March 22, 2016

Managing Docker-based Jabber bots with Monit?

I've "Dockerized" much of my in-house automation, some of which has a Jabber interface (e.g., one bot can control the lights, fan, audio, etc. in the office). I've added monit into the mix, which ensures that the bots' containers are running (most of those using process matching since PID files are sandboxed).

I'm feeling the need for additional "support" in that there might be issues which prevent the bot from properly connecting to the Jabber server, even though the bots' containers are actually running.  I'm thinking that the solution might provide for monitoring via Openfire's presence service:

1) A cron job which periodically:

  • Connects to the Openfire presence service.
  • For each Jabber user present, touch (the Linux "touch") a file within a specific folder (call it that watch folder).
  • Deletes all files within the watch folder which haven't been "touched" in a specific number of cycles (I'm thinking 2).

2) A monit job which periodically:

  • Checks for the existence of a specific bot's watch file.
  • Restarts the bot (and sends alert?) when the bot's watch file doesn't exist.

What do you think?  Will attempt in the next few weeks (i.e., with this pose, it's on my "to do" list).

No comments:

Post a Comment