The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::Appliance::Logical::BlueCoat::SGOS - Perl extension for interaction with Bluecoat proxy devices

SYNOPSIS

    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/');

DESCRIPTION

This module is a simple way to interact with BlueCoat SG proxy servers.

NOTES

This code has only been tested on SGOS version 4.x

OBJECT CREATION

new
    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.

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)
webget
  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};
privcmd
  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.

cmd

Because of the current implementation, this is the same as privcmd above.

cpu
version_string
server_http_errors
server_http_requests
server_http_traffic_in
server_http_traffic_out
config
config_brief
show_policy_local
show_policy_central
show_policy_forward
show_policy_vpm

The above options pretty much do what you would expect.

uptime
  $sg->uptime;          # 1060242.8

Returns the uptime of the appliance in seconds.

started
  $sg->started;         # 2006-06-02 10:39:57

Returns the time the system was last re-started as a Class::Date object.

version
  $sg->version          # 3.2.6.8

Returns the version number of the OS

platform
  $sg->platform;        # Blue Coat SG800 Series

Returns the platform identifier of the proxy

smartfilter_version
  $sg->smartfilter_version;             # 937

Returns the running version of the Smartfilter database

smartfilter_download_date
  $sg->smartfilter_download_date;       # 2006-06-14 01:00:04
categorize_url
  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.

current_workers
  $sg->current_workers;  # 42
object_cache_info
  $sg->delete_from_cache( $uri );

Deletes a URI from the cache. Returns true on success, false on failure.

delete_from_cache
  $sg->delete_from_cache( $uri );

Deletes a URI from the cache. Returns true on success, false on failure.

conf_net
  $sg->conf_net( $url );

Loads a config from a specified URL

AUTHOR

Christopher Heschong, <chris@wiw.org>, with assistance from Sam McLane

LICENSE

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:

Around line 527:

You forgot a '=back' before '=head1'