Adventures As Me


Easy Fetchmail Monitor

Written 08 Jan 2004

For a while I've had a dilemma, one of my clients needs an easy way to monitor his mail retrieval. He has a very small network for his business, 5 clients at the most. Due to various factors, we don't have the MX entries for his domain pointing to his internal server for mail delivery. Instead fetchmail runs every 5 minutes to retrieve mail for all his users.

Unfortunately, fetchmail is notorious for problems, but it solves the mail retrieval problem better than others I've tried. One problem we experience is that fetchmail will mysteriously die without warning. Since I'm not onsite, usually their solution is to reboot the server. This I don't like however because other problems may surface during a reboot, thus my search for an easy to use, understandable fetchmail monitor.

The requirements are simple:

  • It must be web accessible
  • It must be usable by anyone, meaning even those with dubious computer skills and knowledge.
  • It must be accurate and timely.
  • It must, in a straightforward manner, present the current status of fetchmail (e.g., tt is active)
  • It must provide access to a log of fetchmail's activity.

The problem was finding a program that could fulfill these requirements. Something like webmin is overkill and far too complex for my intended audience. Thus I decided to write my own. That was a very good decision I found, because I learned a lot. The server side language is PHP, with which I already have experience. However, I've often wondered how a person writes web accessible software that provides some adminsitrative access to a machine.

Enter sudo. It may not be the best way to do it, but sudo allows me to grant specific command access to the web server user. In turn, this allowed me to construct a web page that accomplishes the program requirements.

Soon I will post the code, using the GNU GPL license, along with a web page devoted to this little software.

Related Posts