Net::Appliance::Logical::BlueCoat::SGOS - Perl extension for interaction with Bluecoat proxy devices
use Net::Appliance::Logical::BlueCoat::SGOS; my $sg = Net::Appliance::Logical::BlueCoat::SGOS->new( 'proxy-hostname' ); printf "%s (running version %s) has been up since %s\n", $sg->platform, $sg->version, $sg->started; $sg->delete_from_cache('http://cpan.perl.org/');
This module is a simple way to interact with BlueCoat SG proxy servers.
This code has only been tested on SGOS version 4.x
my $sg = Net::Appliance::Logical::BlueCoat::SGOS->new( $host [ $opts ] );
This class method constructs a new Net::Appliance::Logical::BlueCoat::SGOS object. It takes one required option, the hostname or IP of the proxy server, plus any additional options to override the defaults.
Net::Appliance::Logical::BlueCoat::SGOS
OPTIONS:
user => Admin username (default: admin) password => Admin password enable => Enable password (currently not used) port => Port for the HTTP admin interface (default: 8081) protocol => Protocol for the HTTP admin interface (default: http) community => SNMP community string (default: public) timeout => How long to wait for an HTTP admin command (default: 10)
my $val = $sg->webget( $path | $actionref , [ $opts ] );
Accepts either a path or a hashref to an action item, plus optional arguments.
You can use this to get specific pages wholesale, for instance:
$sg->webget('OPP/statistics');
Or you can use it to send back a hashref of data, for instance:
my $s = $sg->webget({ path => 'ContentFilter/Status', delim => ':' }); printf "Content-Provider: %s (%s)\n", $s->{Provider}, $s->{Status};
my $response = $sg->privcmd('pcap stop'); $response=>{errors} and die "Error: " . $response->{errors}; print $response->{output};
Issues commands to the proxy as if you were logged in via ssh, enabled, and in config mode. Returns a hashref with the number of errors, warnings, and the output of the command.
If you issue an array of commands, they will be executed as separate requests A command that is a listref will be joined with newlines and issued as one command. For instance:
my @commands = ('show ver', 'show clock', 'show disk all', 'restart regular'); my @responses = $sg->privcmd(@commands);
versus
my $commands = [ 'exceptions', 'path http://foo', 'exit', 'load exceptions' ]; my $response = $sg->privcmd($commands);
You would want to use the latter if you have multi-step operations that need to be executed within one command.
Because of the current implementation, this is the same as privcmd above.
The above options pretty much do what you would expect.
$sg->uptime; # 1060242.8
Returns the uptime of the appliance in seconds.
$sg->started; # 2006-06-02 10:39:57
Returns the time the system was last re-started as a Class::Date object.
$sg->version # 3.2.6.8
Returns the version number of the OS
$sg->platform; # Blue Coat SG800 Series
Returns the platform identifier of the proxy
$sg->smartfilter_version; # 937
Returns the running version of the Smartfilter database
$sg->smartfilter_download_date; # 2006-06-14 01:00:04
my $category = $sg->categorize_url('http://www.bluecoat.com/'); my @categories = $sg->categorize_url('http://www.bluecoat.com/');
Returns content-filter categorization for the argument. Called in list context it returns them as an array.
$sg->current_workers; # 42
$sg->delete_from_cache( $uri );
Deletes a URI from the cache. Returns true on success, false on failure.
$sg->conf_net( $url );
Loads a config from a specified URL
Christopher Heschong, <chris@wiw.org>, with assistance from Sam McLane
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
To install Net::Appliance::Logical, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Appliance::Logical
CPAN shell
perl -MCPAN -e shell install Net::Appliance::Logical
For more information on module installation, please visit the detailed CPAN module installation guide.