| 1 | package YATG::Store::RPC; | ||
| 2 | { | ||
| 3 | $YATG::Store::RPC::VERSION = '5.140510'; | ||
| 4 | } | ||
| 5 | |||
| 6 | use strict; | ||
| 7 | use warnings FATAL => 'all'; | ||
| 8 | |||
| 9 | use RPC::Serialized::Client::INET; | ||
| 10 | |||
| 11 | sub store { | ||
| 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" if | ||
| 17 | $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 | # send results | ||
| 27 | eval { $yc->yatg_store($config, @_) } or warn $@; | ||
| 28 | } | ||
| 29 | |||
| 30 | 1; | ||
| 31 | |||
| 32 | # ABSTRACT: Back-end module to store polled data over the network | ||
| 33 | |||
| 34 | |||
| 35 | __END__ | ||
| 36 | =pod | ||
| 37 | |||
| 38 | =head1 NAME | ||
| 39 | |||
| 40 | YATG::Store::RPC - Back-end module to store polled data over the network | ||
| 41 | |||
| 42 | =head1 VERSION | ||
| 43 | |||
| 44 | version 5.140510 | ||
| 45 | |||
| 46 | =head1 DESCRIPTION | ||
| 47 | |||
| 48 | This module implements part of a callback handler used to store SNMP data to | ||
| 49 | disk on a remote networked host. | ||
| 50 | |||
| 51 | There is not a lot to describe - it's a very lightweight call which throws | ||
| 52 | data to an instance of L<YATG::Store::Disk> on another system, so read the | ||
| 53 | manual page for that module for more information. | ||
| 54 | |||
| 55 | You must of course configure C<yatg_updater> with the location of the RPC | ||
| 56 | service (see below). | ||
| 57 | |||
| 58 | Also see L<RPC::Serialized::Handler::YATG::Store> for guidance on setting up | ||
| 59 | the remote RPC server. | ||
| 60 | |||
| 61 | The parameter signature for the C<store> subroutine is the same as that for | ||
| 62 | C<YATG::Store::Disk::store()>. | ||
| 63 | |||
| 64 | =head1 CONFIGURATION | ||
| 65 | |||
| 66 | In the main C<yatg_updater> configuration, you need to specify the location of | ||
| 67 | the remote RPC service. Follow the example in the bundled C<yatg.yml> example | ||
| 68 | file. | ||
| 69 | |||
| 70 | You can also override some default settings of L<RPC::Serialized>. For | ||
| 71 | instance the default serializer is set to L<YAML::Syck> so to change that try: | ||
| 72 | |||
| 73 | rpc_serialized_client_inet: | ||
| 74 | data_serializer: | ||
| 75 | serializer: 'JSON::Syck' | ||
| 76 | |||
| 77 | =head1 SEE ALSO | ||
| 78 | |||
| 79 | =over 4 | ||
| 80 | |||
| 81 | =item L<RPC::Serialized> | ||
| 82 | |||
| 83 | =back | ||
| 84 | |||
| 85 | =head1 AUTHOR | ||
| 86 | |||
| 87 | Oliver Gorwits <oliver@cpan.org> | ||
| 88 | |||
| 89 | =head1 COPYRIGHT AND LICENSE | ||
| 90 | |||
| 91 | This software is copyright (c) 2014 by University of Oxford. | ||
| 92 | |||
| 93 | This is free software; you can redistribute it and/or modify it under | ||
| 94 | the same terms as the Perl 5 programming language system itself. | ||
| 95 | |||
| 96 | =cut | ||
| 97 |