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

NAME

App::MBUtiny::CollectorAgent - Agent for access to App::MBUtiny collector server

VIRSION

Version 1.02

SYNOPSIS

    use App::MBUtiny::CollectorAgent;
    
    my $agent = new App::MBUtiny::CollectorAgent(
            uri => "https://mbutiny.example.com/collector.cgi",
        );
    
    my $status = $agent->check;
    
    if ($status) {
        print STDOUT $agent->response->{data}{message};
    } else { 
        print STDERR $agent->error;
    }

DESCRIPTION

Agent for access to App::MBUtiny collector server

METHODS

new
    my $agent = new App::MBUtiny::CollectorAgent(
            uri         => $uri, # Collector URI
            user        => $user, # optional
            password    => $password, # optional
            timeout     => $timeout, # default: 180
        );

Returns agent

check
    my $status = $agent->check;

Returns check-status of collector. 0 - Error; 1 - Ok

See README file for details of data format

del
    my $status = $agent->del(
            host => $hostname,
            file => $filename,
        );

Request for deleting of file on collector by hostname and filename. The method returns status of operation: 0 - Error; 1 - Ok

See README file for details of data format

download
    my $status = $agent->download(
            host => $hostname,
            file => $filename,
            path => "/file/to/write",
        );

Request for download file on collector by hostname and filename. Result will be written to "path" file. The method returns status of operation: 0 - Error; 1 - Ok

See README file for details of data format

error
    print $agent->error;

Returns error string

fixup
    $status = $agent->fixup(
            type    => $type, # 0 - external / 1 - internal (Uploaded earlier)
            id      => $id, # ID of file (type = 1 only)
            host    => $hostname,
            file    => $filename,
            path    => $filepath, # /path/to/filename
            sha1    => $sha1, # Optional
            md5     => $md5,  # Optional
            status  => $status, # 1 - good backup / 0 - bad backup
            comment => $comment, # Optional
            message => "Your files successfully stored ...", # Optional
        );

Request for fixupping of backup on collector by hostname and others parameters. The method returns status of operation: 0 - Error; 1 - Ok

See README file for details of data format

info
    my $status = $agent->info(
            host => $hostname,
            file => $filename,
        );

Request for getting information about file on collector by hostname and filename. The method returns status of operation: 0 - Error; 1 - Ok

See README file for details of data format

list
    my $status = $agent->list(
            host => $hostname,
        );

Request for getting list of files on collector by hostname. The method returns status of operation: 0 - Error; 1 - Ok

See README file for details of data format

report
    my $status = $agent->report(
            host    => $hostname, # Optional. Default: all hosts
            start   => '01.09.2014', # Optional. Default: current date
            finish  => '09.09.2014', # Optional. Default: current date
            type    => 2, # 0 - external; 1 - internal; 2 - both (all, default)
        );

Request for getting report of backup on collector by hostname. The method returns status of operation: 0 - Error; 1 - Ok

See README file for details of data format

request
    my $request = $agent->request;

Returns request hash

response
    my $response = $agent->response;

Returns response hash

status
    my $status = $agent->status;

Returns object status value. 0 - Error; 1 - Ok

upload
    $status = $agent->upload(
            host    => $hostname,
            file    => $filename,
            path    => $filepath, # /path/to/filename
            sha1    => $sha1, # Optional
            md5     => $md5,  # Optional
            comment => $comment, # Optional
        );

Request for uploading of backup on collector by hostname and others parameters. The method returns status of operation: 0 - Error; 1 - Ok

See README file for details of data format

HISTORY

See CHANGES file

TO DO

See TODO file

BUGS

* none noted

SEE ALSO

App::MBUtiny

AUTHOR

Serz Minus (Lepenkov Sergey) http://www.serzik.com <minus@mail333.com>

COPYRIGHT

Copyright (C) 1998-2014 D&D Corporation. All Rights Reserved

LICENSE

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

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. See the GNU General Public License for more details.

See LICENSE file