Summary
Keep close tabs on your server with voice output.
Advertisement
I've been trying to keep closer tabs on my wiki site so that I can understand the ways people act there. This weekend I added voice synthesis. This turns out to be a lot of fun and pretty informative too. I'm writing to other server operators to encourage them to give this a try.
My mac has a command line program that will pronounce text. If I want it to say hello to the world I would type:
say hello world
I can add this to my perl wiki server by adding the line:
system("say $page&");
Place it in wiki.cgi just after where it figured out the requested page. I add the & to the command so that the server doesn't wait for the speaking to finish before serving the page. This could be a lot of fun if you're running a wiki for a group of people who happen to sit near the server. A more useful variation might be to add the speaking to the edit.cgi script. This would announce which pages are being edited so that people can avoid conflicts.
Now I don't actually sit anywhere near my server so I had to monitor its activity remotely. I'm used to using tail -f to watch my server logs. This works fine through secure shell too:
ssh 'tail -f /var/log/httpd/access_log'
So I wrote this into a perl script, something like:
This looks for wiki names in the log and pronounces them as fast as they come. I put the system call into a subroutine and added a sleep to limit the rate to one a second.
sub say {
system("say $1&");
sleep(1);
}
Longer names take more than a second to say so the talking can overlap. But this is easy to understand so long as the starts are staggered.
I've added a second voice for more rare events, like posts back to the server for saved pages:
system("say -v Bruce post&") if /POST/;
Bruce is easy to understand even when my default voice, Victora, is gabbing away. I've actually added five or six triggers for Bruce. When he gets going I know someone is doing something weird to my server.
I've also found it useful to ignore the robots. With them crusing through my site the talking gets way too complicated. I added this right inside the while loop:
next if /googlebot.com/;
You will have to tune what you look for and how you say it so that you get a good feel for what is going on moment by moment. Once you have it working, try watching the log the old fashion way in a separate window. You'll find more things you might want to pronounce.
That reminded me of a presentation[1] given at LL3 last year. They were using Jabber (the instant messaging protocol) to enable two-way communications with each machine in a large cluster. I really liked the idea of getting an instant message when an error message is logged, and being able to reply with "restart" or whatever.
There are Jabber client libraries available for most languages and platforms, including Perl[2], of course.