| 1 | package YATG::Retrieve::RPC; | ||
| 2 | { | ||
| 3 | $YATG::Retrieve::RPC::VERSION = '5.140510'; | ||
| 4 | } | ||
| 5 | |||
| 6 | use strict; | ||
| 7 | use warnings FATAL => 'all'; | ||
| 8 | |||
| 9 | use RPC::Serialized::Client::INET; | ||
| 10 | |||
| 11 | sub retrieve { | ||
| 12 | my $config = shift; | ||
| 13 | |||
| 14 | my $server = $config->{rpc_serialized_client_inet} | ||
| 15 | ->{'io_socket_inet'}->{'PeerAddr'}; | ||
| 16 | print "Connecting to storage server at [$server]\n" | ||
| 17 | if $ENV{YATG_DEBUG} || $config->{yatg}->{'debug'}; | ||
| 18 | |||
| 19 | # get connection to RPC server | ||
| 20 | my $yc = eval { | ||
| 21 | RPC::Serialized::Client::INET->new( | ||
| 22 | $config->{rpc_serialized_client_inet} | ||
| 23 | ) | ||
| 24 | } or die "yatg: FATAL: storage server at [$server] failed: $@\n"; | ||
| 25 | |||
| 26 | # get data | ||
| 27 | eval { $yc->yatg_retrieve($config, @_) } or warn $@; | ||
| 28 | } | ||
| 29 | |||
| 30 | 1; | ||
| 31 | |||
| 32 | # ABSTRACT: Retrieve a set of polled data over the network | ||
| 33 | |||
| 34 | |||
| 35 | __END__ | ||
| 36 | =pod | ||
| 37 | |||
| 38 | =head1 NAME | ||
| 39 | |||
| 40 | YATG::Retrieve::RPC - Retrieve a set of polled data over the network | ||
| 41 | |||
| 42 | =head1 VERSION | ||
| 43 | |||
| 44 | version 5.140510 | ||
| 45 | |||
| 46 | =head1 DESCRIPTION | ||
| 47 | |||
| 48 | You can load this module to retrieve a set of data which has previously been | ||
| 49 | stored by L<YATG::Store::Disk> or L<YATG::Store::RPC>. An implementation of | ||
| 50 | this process is given in the CGI bundled with this distribution, which | ||
| 51 | displays results of SNMP polls. | ||
| 52 | |||
| 53 | There is not a lot to describe - it's a very lightweight call which throws | ||
| 54 | data to an instance of L<YATG::Retrieve::Disk> on another system, so read the | ||
| 55 | manual page for that module for more information. | ||
| 56 | |||
| 57 | You must of course configure C<yatg_updater> with the location of the RPC | ||
| 58 | service (see below). | ||
| 59 | |||
| 60 | Also see L<RPC::Serialized::Handler::YATG::Retrieve> for guidance on setting | ||
| 61 | up the remote RPC server. | ||
| 62 | |||
| 63 | The parameter signature for the C<retrieve> subroutine is the same as that for | ||
| 64 | C<YATG::Store::Retrieve::retrieve()>. | ||
| 65 | |||
| 66 | =head1 CONFIGURATION | ||
| 67 | |||
| 68 | In the main C<yatg_updater> configuration, you need to specify the location of | ||
| 69 | the remote RPC service. Follow the example in the bundled C<yatg.yml> example | ||
| 70 | file. | ||
| 71 | |||
| 72 | You can also override some default settings of L<RPC::Serialized>. For | ||
| 73 | instance the default serializer is set to L<YAML::Syck> so to change that try: | ||
| 74 | |||
| 75 | rpc_serialized_client_inet: | ||
| 76 | data_serializer: | ||
| 77 | serializer: 'JSON::Syck' | ||
| 78 | |||
| 79 | =head1 SEE ALSO | ||
| 80 | |||
| 81 | =over 4 | ||
| 82 | |||
| 83 | =item L<RPC::Serialized> | ||
| 84 | |||
| 85 | =back | ||
| 86 | |||
| 87 | =head1 AUTHOR | ||
| 88 | |||
| 89 | Oliver Gorwits <oliver@cpan.org> | ||
| 90 | |||
| 91 | =head1 COPYRIGHT AND LICENSE | ||
| 92 | |||
| 93 | This software is copyright (c) 2014 by University of Oxford. | ||
| 94 | |||
| 95 | This is free software; you can redistribute it and/or modify it under | ||
| 96 | the same terms as the Perl 5 programming language system itself. | ||
| 97 | |||
| 98 | =cut | ||
| 99 |