I don’t know how truly useful this is, but it’s kinda cool just for the geekiness.

I installed this on Ubuntu Server 9.04 running Nagios 3.1.2. You will want to create a Twitter account just for sending these tweets. Setup a new account and go to https://dev.twitter.com and login with the Twiiter account you will be sending tweets from. Next, create a new application. After that you need to create Access Tokens for the application, you may have to refresh a bit to receive the tokens.

If you don’t have python installed you may have to do the following.

Otherwise, install tweepy which is the python program we use to tweet the Nagios alerts.

Next create the file we will be using to tweet. I did…

Paste the follow using your own CONSUMER_KEY, CONSUMER_SECRET, ACCESS_KEY, ACCESS_SECRET from the Twitter account you setup.

Next make it executable.

Now, send a test tweet.

Now go to your Twitter account and if your access keys and secrets are correct, a tweet should have been posted.

Setup the Nagios part 

Edit your contact.cfg file with the following.

Add twitter to your contacts group. You should already have this part in your contacts.cfg file and would only need to add ‘twitter’ to the members section. But here it is just in case.

Add the follow to your commands.cfg file. I have mine running from /home/nagios/tweepy/. Change yours as needed. Also, change ‘@TwitterAccount’ to whatever Twitter account you want to mention in the tweet. I use my main Twitter account because it’s easier to notice if you have a mention rather than just skimming your Timeline.

Let me know how this goes for you!