ZXTMs like to Tweet Too

Keep out pleaseIt would seem that not a day goes by without another social networking site appearing on the interweb. We're all familiar with My Space, Facebook, and Linked-In, but the latest craze sweeping the internet, and the Zeus office, is Twitter. Twitter is a micro-blogging site, which encourages its members to submit short blogs (no more than 140 characters), answering the simple question "What are you doing?"

Someone in the office (it may have been me), thought it would be a pretty cool idea to plug ZXTM's eventing system into Twitter, and let it tweet alerts, and status messages. A few minutes reading the Twitter API docs later....

#!/usr/bin/perl
use LWP;
my $username="Your Twitter User";
my $password="Your Twitter Pass";
# The below text will be prepended to your ZXTM's tweet
my $preStatus = "Cluster update: ";
my $updateURL="http://twitter.com/statuses/update.xml";
my $browser = LWP::UserAgent->new;
my $message = join(" ", @ARGV);
$message =~ s/--eventtype=/$preStatus/;
$browser->agent('ZXTM Eventing System');
$browser->credentials(
'twitter.com:80',
'Twitter API',
$username => $password
);
my $response = $browser->post( $updateURL, [ status => $message ] );
print $response->status_line;
print $response->content;

The above perl code, needs to be saved in a file called "twitter.pl", and then uploaded to your ZXTMs Catalog: Catalogs -> Extra Files -> Action Programs.

Once uploaded, you will need to point your browser at System -> Alerting and the click "Manage Actions". Next Create a new action called "Twitter", and set the type to be program.

On the next screen, ensure that the twitter.pl program is selected under Additional Settings.

Setting up the Twitter Action

Click either "Update", or "Update and Test", if you want ZXTM to tweet now, and then return to the Alerting screen.

You can now map any of your alerts to use the Twitter action. In my ZXTM I told it to send all events to Twitter, but you'll probably want to be more selective.

Send All events to Twitter

Enjoy your tweeting, and Merry Christmas!

Mark Boddington [Zeus Systems Engineering] 15 December 2008 Bookmark with del.icio.us Post this article to Digg Post this article to reddit Post this article to Facebook Tweet this article 7 comments  

Comments:

This public messageboard is not a forum for technical support. To report technical support problems, please contact our dedicated Support team using the instructions at the bottom of this page.

Comment from: Mark Boddington [Zeus Systems Engineering]
If you want to follow my ZXTM 5.1 Desktop Edition tweets: http://twitter.com/ZXTM
Permalink 15 December 2008 @ 14:27
Comment from: Lance [Visitor] · http://www.lancewicks.com
Excellent!
How about a traffic script to send that info to a Nabaztag bunny?
Lance
Permalink 15 December 2008 @ 17:23
Comment from: Mark Boddington [Zeus Systems Engineering]
For all those Nabaztag (http://www.nabaztag.com) bunny lovers out there....

#!/usr/bin/perl

use LWP;

my $serial = "Your Nabaztag Serial Number";
my $token = "Your Nabaztag API token";

my $chor = "10,0,motor,1,20,0,0,0,led,2,0,238,0,2,led,1,250,0,0,3,led,2,0,0,0";
my $voice = "IE-Orla";

# The below text will be prepended to your ZXTM's Message
my $preStatus = "Cluster update: ";

my $message = join(" ", @ARGV);
$message =~ s/--eventtype=/$preStatus/;

my $nabaztagAPI = "http://api.nabaztag.com/vl/FR/api.jsp?sn=" . $serial .
"&token=" . $token .
"&tts=" . $message .
"&chor=" . $chor .
"&voice=" . $voice ;
my $browser = LWP::UserAgent->new;

$browser->agent('ZXTM Eventing System');

my $response = $browser->get($nabaztagAPI);

print $response->status_line;
print $response->content;

Permalink 17 December 2008 @ 14:11
Comment from: Lance [Visitor] · http://envirtua.com
Brilliant!

Glad my little old bunny could be of use, here is what it looked like (if the embed works),
else take a look at http://www.viddler.com/explore/lancew/videos/2/





Permalink 17 December 2008 @ 14:17
Comment from: Jeff Rhys-Jones [Visitor] · http://www.yottaserve.com
I have a rabbit!

On our 5.1 ZXTM unit. I've followed all the steps - but when I run the action test, I get the following error - even though the file is clearly there. Is this a permissions issue? I gave it 777 just to see if it would work, but alas, still the error.

Action Nabaztag: Program aborted: Failed to run /usr/local/zeus/zxtm/conf/actionprogs/jeff_nabaztag.pl --eventtype=.Test Settings INFO testaction actions/Nabaztag Test settings for action 'Nabaztag' (requested by user admin): No such file or directory

Am on Linux software version.

Cheers,

Jeff
Permalink 18 February 2009 @ 14:55
Comment from: Mark Boddington [Zeus Systems Engineering]
Jeffs error was caused by file corruption of the script. Cleaning the file of unwanted control characters solved the problem.

Cheers,
Mark
Permalink 03 March 2009 @ 12:28
Comment from: mrz [Visitor] · http://www.mozilla.com
Trying to get ZXTM to tweet connection rate and bandwidth info per vserver or other "interesting" metrics. Anyone do this already?
Permalink 19 June 2009 @ 17:46
Leave a comment ...
Your email address will not be displayed.
Your URL will be displayed.
This public messageboard is not a forum for technical support. To report technical support problems, please contact our dedicated Support team using the instructions at the bottom of this page.
Options:
 
(Line breaks become <br />)
(Set cookies for name, email & url)

Recently...

Other Resources