Given that my recently created (and blogged about) home theater PC is functionally a piece of furniture, the last thing we need is to be constantly checking on it. Rather, the machine should manage itself, and notify us (the users) when updates or intervention is needed. As such I played around with my favorite scripting language to make some monitoring tools.
Using a very very very simple python script, I am able to read in a file and send the contents to a list of recipients. Once that was built, we needed a way to create the file for each email including html formatting. Another simple python script which reads in updates lists and status files to create an html file which can then be sent by the original tool. The last step was automating the process. A few bash scripts placed in the automatically called locations (init.d, cron) can consolidate the necessary information to a file which can be passed through the python scripts.
The result is a daily email or two (perhaps I will consolidate the daily emails in to one soon!) alerting us of any power-cycles, updates, or necessary changes needed. There is support for a few extra features which I have not implemented yet, but will soon (read: eventually). These tools can be used for many things I have not thought of I’m sure, so I made them highly generic. The builder can accept any type flags you want to define, so its behavior can be expanded without limit. The sender can send any file desired with a customizable subject in the command line. Both tools are written fairly clearly in the hopes of use for new and different things to suit each need. The code is available in the usual spot here and is intended for linux systems. I must clarify that these tools have only been tested on the end table PC, so excuse any compatibility errors.
To install, simply download the repository, edit the sender with the To, From, and Auth fields of your choosing, then run the install.sh as root.
Hope you get some use out of this tool, and as always, raise a glass and code on.