cancel
Showing results for 
Search instead for 
Did you mean: 

Problem this snippet solves:

This perl script is a standalone http daemon that will listen and log Management::EventNotification messages to disk.

Code :

#!/usr/bin/perl
#----------------------------------------------------------------------------
# The contents of this file are subject to the "END USER LICENSE AGREEMENT FOR F5
# Software Development Kit for iControl"; you may not use this file except in
# compliance with the License. The License is included in the iControl
# Software Development Kit.
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
#
# The Original Code is iControl Code and related documentation
# distributed by F5.
#
# The Initial Developer of the Original Code is F5 Networks,
# Inc. Seattle, WA, USA. Portions created by F5 are Copyright (C) 1996-2005 F5 Networks,
# Inc. All Rights Reserved.  iControl (TM) is a registered trademark of F5 Networks, Inc.
#
# Alternatively, the contents of this file may be used under the terms
# of the GNU General Public License (the "GPL"), in which case the
# provisions of GPL are applicable instead of those above.  If you wish
# to allow use of your version of this file only under the terms of the
# GPL and not to allow others to use your version of this file under the
# License, indicate your decision by deleting the provisions above and
# replace them with the notice and other provisions required by the GPL.
# If you do not delete the provisions above, a recipient may use your
# version of this file under either the License or the GPL.
#----------------------------------------------------------------------------

use SOAP::Transport::HTTP;-->

# don't want to die on 'Broken pipe' or Ctrl-c
$SIG{PIPE} = 'IGNORE';

my $daemon = SOAP::Transport::HTTP::Daemon-->
-> new (LocalAddr => 'localhost', LocalPort => 8080)
-> on_action(sub {})
-> dispatch_with
(
{'urn
);

print "Starting HTTP daemon listening on ", $daemon->url, "\n";
$daemon->handle;


###
### API for the SOAP server for cmd_dispatch
###
package Management::EventNotification;

BEGIN { push (@INC, ".."); }
use iControlTypeCast;

sub events_occurred {
my ($self,$event_source,$subscription_id,$event_data_list,$time_stamp) = @_;
print "events_occurred() was just invoked!\n";

# $event_source
$system_id = $event_source->{"system_id"};
$url = $event_source->{"url"};
  
$year = $time_stamp->{"year"};
$month = $time_stamp->{"month"};
$day = $time_stamp->{"day"};
$hour = $time_stamp->{"hour"};
$minute = $time_stamp->{"minute"};
$second = $time_stamp->{"second"};


print "Event Source\n";
print "   System Id : $system_id\n";
print "         Url : $url\n";
print "subscription id: $subscription_id\n";
print "  Time Stamp : $year:$month:$day/$hour:$minute:$second\n";
print "  Event Data List\n";
foreach $event_data (@{$event_data_list})
{
$username = $event_data->{"username"};
$sequence_number = $event_data->{"sequence_number"};
$event_type = $event_data->{"event_type"};
$object_type = $event_data->{"object_type"};
@event_data_item_list = @{$event_data->{"event_data_item_list"}};

print "---------------\n";
print "   Username : $username\n";
print "      seq # : $sequence_number\n";
print " Event Type : $event_type\n";
print "Object Type : $object_type\n";
print "Event List\n";
foreach $event_data_item (@event_data_item_list)
{
$event_data_name = $event_data_item->{"event_data_name"};
$event_data_type = $event_data_item->{"event_data_type"};
$event_data_value = $event_data_item->{"event_data_value"};
print "    ----------------\n";
print "      Item Name  : $event_data_name\n";
print "      Item Type  : $event_data_type\n";
print "      Item Value : $event_data_value\n";
}
}

}

1;
Comments
TomMc_89734
Historic F5 Account
There are 3 strings like this "-->" in the code. What are these for? I don't recognize them as Perl operators. Also, what is the "1;" on line 106?
Version history
Last update:
‎07-Mar-2015 15:28
Updated by:
Contributors