Error message

  • Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /data03/toxictux/public_html/main/includes/common.inc).
  • Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in menu_set_active_trail() (line 2405 of /data03/toxictux/public_html/main/includes/menu.inc).

ZXTM Eventing Modules

Over the past few days I've written some perl modules to plug a Zeus ZXTM Traffic Manager into first, Twitter, and then a Nabaztag bunny. At first both of these seem a little frivolous, but on further reflection perhaps a little ingenious. I can now keep an eye on my networks and application servers by following my ZXTM on Twitter, or I can get a small plastic bunny to yell at me in my living room, when things go wrong.
 
The perl code for Twitter:
 
  #!/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 good thing about Twitter is that it allows you to protect your updates, so that only your friends can see what you're doing. When you have an ADC posting messages about the state of your network, you will probably want to switch that option on.

If you're lucky enough to have a Nabaztag bunny in your living room though:

 

  #!/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;

 

You should get something like this....

 

 
For further instructions on using these modules with ZXTM, there's a Zeus Knowledgehub article, which tells you everything that you need to know.