Make your server tweet alerts, update #1

In a previous post I showed you how to make your server tweet alerts. I also told you that it would be a long series of posts, so here’s the second one!

obama-not-bad

In this post, I’ll show you two things. First, I made a few improvements over the first scripts I had made, the one that checks for updates and tweets you the result. Next, I’ll show you a second script I made.

Improvements

I learnt a lots of things since my previous post so I made some improvements on update_check.py:

  • inserted a optional debug mode. When activated, the script prints out everything.
  • got rid of apt-check command, now I use simulation mode of “apt-get upgrade”, using “-s” parameter.
  • cleaned out the whole script.

I won’t post the result here as it is subject to change. To get the script, check out my GitHub.

 

Second script

I created a second script based on the very same idea: launch a command, retrieve its result, analyse it. This one checks if apache is running. If not, it tweets you an alert. This one’s name “apache_check.py”. It’s also on my GitHub.

That’s all for now! Have fun!