NAME

Zenoss::Connector - Module responsible for establishing a connection to the Zenoss API

SYNOPSIS

use Zenoss::Connector;
use Zenoss::Router;

# Create a connection object
my $connection = Zenoss::Connector->new(
    {
        username    => 'admin',
        password    => 'zenoss',
        url         => 'http://zenossinstance:8080',
    }
);

# Pass the connection to the router
my $api = Zenoss::Router->new(
    {
        connector => $connection,
    }
);

# Call some API methods
my $response = $api->device_getDevices();

# Print the JSON return
print $response->json;

DESCRIPTION

This module creates a connection to the Zenoss API, and tests the connectivity. Once a Zenoss::Connector object has been established, it can be passed to Zenoss::Router to process Zenoss API calls.

While this module can be used directly, it is recommended that Zenoss facilitates the connection to the Zenoss::Router.

A croak will occur in the event a connection cannot be established.

ATTRIBUTES

Attributes can be set on object creation, see SYNOPSIS, or by calling $obj->attribute('value').

Attributes can be retrieved by calling $obj->attribute.

username

The username to log in with at the Zenos instance

password

The password to log in with at the Zenos instance

url

The url to be used in establishing a connection to the Zenoss instance. Note, that ports in the http(s) url are not required unless they're non-stanard. For example the url can be set to:

http://zenossinstance

https://zenossinstance

Without having to specify :80 or :443. However, non-standard ports must be specified! Zenoss by default uses :8080, so this must be specified on the url if your instance uses this.

IE

http://zenossinstance:8080

timeout

The timeout value for processing transactions. Note, if you process a large request, IE getting all historical events, its prudent to set this value to something higher than the default of 120 seconds.

endpoint

This attribute cannot be set. However, once the object is created this attribute can be accessed to provide the full url, with credentials, to the Zenoss instance. For example,

http://admin:zenoss@zenossinstance:8080

SEE ALSO

AUTHOR

Patrick Baker <patricksbaker@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2010 by Patrick Baker <patricksbaker@gmail.com>

This module is free software: you can redistribute it and/or modify it under the terms of the Artistic License 2.0.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

You can obtain the Artistic License 2.0 by either viewing the LICENSE file provided with this distribution or by navigating to http://opensource.org/licenses/artistic-license-2.0.php.