Showing posts with label PERL. Show all posts
Showing posts with label PERL. Show all posts

Tuesday, September 13, 2011

A little perl nugget: differences between two arrays

Something small, simple...

I have two perl arrays and I want to remove all elements in common between the two arrays, leaving only the elements in list_one that are unique to list_one.


For example pre-populate two arrays with the following values.
my @list_one = ();
push(@list_one,'a');
push(@list_one,'b');
push(@list_one,'c');

my @list_two = ();
push(@list_two,'b');


Thursday, April 7, 2011

Load-Balancing network traffic when it gets hot in Winnemucca (i.e. User defined load balancing)




OK--a tad bit facetious. But I just want to make a point that given a new hook in the Vyatta wan load balancing feature it's now possible for users to define custom health-checks. Before going further this post does assume that the user has some familiarity with the Vyatta router and configuration.

This new "knob" allows for user defined interface health tests. In the past there has been icmp echo support (i.e. ping), and more recently a time to live (ttl) expired test--both of which are supported directly via the implementation in the feature. And this got me thinking a while back that perhaps load balancing based on other criteria could be even more useful (i.e. user-defined criteria). This other criteria could be defined by the deployment (i.e. within a virtualized environment), or other network data or statistics (i.e. flows and rate).

What has now been added to the interface is the ability for the user to now define their own test target (or health-test) script. This means that you can define the success/failure criteria for each outbound interface. A few examples of the types of tests that can be performed are:

- test whether an http server is reachable
- disable interface after 6 pm
- enable additional interfaces based on traffic load
- disable interface based on virtualized host cpu loading

Wednesday, December 29, 2010

Perl command line emulator (an exercise in using remote API calls for command completion/execution)

OK--that's an awkward title. The real deal is this...

This was an exercise in seeing if a command line interface could be built using a remote source (meaning accessing an REST API via http) for command completion and execution. The remote API used was the Vyatta router remote access API (REST based https configuration API). I choose PERL as the language so that this little prototype could run on any system (windows, mac, linux etc.). Sure the language could have been something else, but what the heck I picked Perl--plus it has pretty good JSON support (which is the response body format for the remote service).