App::MBUtiny::Collector::Server - MBUtiny collector server
Version 1.01
use CGI; use App::MBUtiny::Collector::Server "/mbutiny"; my $q = new CGI; my $server = new App::MBUtiny::Collector::Server( project => "MBUtiny", ident => "mbutiny", log => "on", logfd => fileno(STDERR), ); $server->status or die($server->error); print $server->call($q->request_method, $q->request_uri, $q) or die($server->error);
MBUtiny collector server
This class provides WWW::MLite REST server methods for MBUtiny collector
See collector.cgi.sample file for example
collector.cgi.sample
WWW::MLite methods
curl -v --raw http://localhost/mbutiny > GET /mbutiny HTTP/1.1 > Host: localhost > User-Agent: curl/7.62.0 > Accept: */* > < HTTP/1.1 200 OK < Date: Wed, 19 Jun 2019 10:57:31 GMT < Server: Apache/2.2.25 (Win32) mod_ssl/2.2.25 OpenSSL/0.9.8y mod_perl/2.0.8 Perl/v5.16.3 < Connection: close < Content-Length: 214 < Content-Type: application/json; charset=utf-8 < { "dsn" : "dbi:SQLite:dbname=/var/lib/mbutiny/mbutiny.db", "status" : 1, "name" : "check", "error" : "", "method" : "GET", "path" : "/mbutiny", "description" : "Check collectors" } curl -v --raw http://localhost/mbutiny/foo > GET /mbutiny/foo HTTP/1.1 > Host: localhost > User-Agent: curl/7.58.0 > Accept: */* > < HTTP/1.1 200 OK < Date: Sat, 22 Jun 2019 10:29:26 GMT < Server: Apache/2.4.29 (Ubuntu) < Connection: close < Content-Length: 556 < Content-Type: application/json; charset=utf-8 < { "name" : "foo", "error" : "", "file" : null, "status" : 1, "time" : 0.0073, "info" : { "comment" : "Local storages...", "sha1" : "4200f422b425967ca2cb278cf311edeb74ecdde1", "addr" : "127.0.0.1", "file" : "foo-2019-06-22.tar.gz", "type" : 1, "status" : 1, "time" : 1561194766, "md5" : "008413f90584f4af5d5a49c7c0ec64c2", "id" : 13, "size" : 501, "name" : "foo", "error" : "" } }
curl -v --raw http://localhost/mbutiny/list?name=foo > GET /mbutiny/list HTTP/1.1 > Host: localhost > User-Agent: curl/7.50.1 > Accept: */* > < HTTP/1.1 200 OK < Date: Fri, 31 May 2019 05:41:34 GMT < Server: Apache/2.4.18 (Ubuntu) < Connection: close < Content-Length: 16 < Content-Type: text/plain < { "time" : 0.0012, "list" : [...], "status" : 1, "error" : "" }
curl -v --raw http://localhost/mbutiny/report?start=1561799700 > GET /mbutiny/report HTTP/1.1 > Host: localhost > User-Agent: curl/7.50.1 > Accept: */* > < HTTP/1.1 200 OK < Date: Fri, 31 May 2019 05:41:34 GMT < Server: Apache/2.4.18 (Ubuntu) < Connection: close < Content-Length: 16 < Content-Type: text/plain < { "time" : 0.0012, "report" : [...], "status" : 1, "error" : "" }
curl -v -d '{ "type": 1, "name": "foo", "file": "foo", "size": 501, "md5": "3a5fb8a1e0564eed5a6f5c4389ec5fa0", "sha1": "22d12324fa2256e275761b55d5c063b8d9fc3b95", "status": 1, "error": "", "comment": "Test external fixup!"}' --raw -H "Content-Type: application/json" http://localhost/mbutiny > POST /mbutiny HTTP/1.1 > Host: localhost > User-Agent: curl/7.50.1 > Accept: */* > Content-Type: application/json > Content-Length: 27 > < HTTP/1.1 200 OK < Date: Thu, 20 Jun 2019 15:03:34 GMT < Server: Apache/2.4.18 (Ubuntu) < Connection: close < Content-Length: 27 < Content-Type: text/plain; charset=utf-8 <
curl -v --raw -X DELETE http://localhost/mbutiny/NAME?file=name&type=1 > DELETE /mbutiny/NAME?file=name HTTP/1.1 > Host: localhost > User-Agent: curl/7.58.0 > Accept: */* > < HTTP/1.1 204 No Content < Date: Fri, 21 Jun 2019 21:40:36 GMT < Server: Apache/2.4.29 (Ubuntu) < Connection: close < Content-Type: text/plain <
The CTK method for classes extension
See "again" in CTK
Returns App::MBUtiny::Collector::DBI object
The WWW::MLite method for input data preparing
The WWW::MLite method for output data preparing
Returns current serializer object
See CTK::Serializer
See Changes file
Changes
See TODO file
TODO
App::MBUtiny, WWW::MLite, App::MBUtiny::Collector::DBI
Serż Minus (Sergey Lepenkov) http://www.serzik.com <abalama@cpan.org>
Copyright (C) 1998-2019 D&D Corporation. All Rights Reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See LICENSE file and https://dev.perl.org/licenses/
LICENSE
To install App::MBUtiny, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::MBUtiny
CPAN shell
perl -MCPAN -e shell install App::MBUtiny
For more information on module installation, please visit the detailed CPAN module installation guide.