NAME
POE::Component::Client::NSCA - a POE Component that implements send_nsca functionality
VERSION
version 0.18
SYNOPSIS
POE::Session->create(
inline_states
=> {
_start
=>
sub
{
POE::Component::Client::NSCA->send_nsca(
host
=>
$hostname
,
event
=>
'_result'
,
password
=>
'moocow'
,
encryption
=> 1,
# Lets use XOR
message
=> {
host_name
=>
'bovine'
,
svc_description
=>
'chews'
,
return_code
=> 0,
plugin_output
=>
'Chewing okay'
,
},
);
return
;
},
_result
=>
sub
{
my
$result
=
$_
[ARG0];
Dumper(
$result
);
return
;
},
}
);
$poe_kernel
->run();
exit
0;
DESCRIPTION
POE::Component::Client::NSCA is a POE component that implements send_nsca
functionality. This is the client program that is used to send service check information from a remote machine to an nsca daemon on the central machine that runs Nagios
.
It is based in part on code shamelessly borrowed from Net::Nsca and optionally supports encryption using the Mcrypt module.
CONSTRUCTOR
send_nsca
-
Takes a number of parameters:
'host'
, the hostname or IP address to
connect
to, mandatory;
'event'
, the event handler in your session where the result should be sent, mandatory;
'password'
, password that should be used to encrypt the packet, mandatory;
'encryption'
, the encryption method to
use
, see below, mandatory;
'message'
, a hashref containing details of the message to
send
, see below, mandatory;
'session'
, optional
if
the poco is spawned from within another session;
'port'
, the port to
connect
to,
default
is 5667;
'context'
, anything you like that'll fit in a
scalar
, a
ref
for
instance;
'timeout'
, number of seconds to
wait
for
socket
timeouts,
default
is 10;
The 'session' parameter is only required if you wish the output event to go to a different session than the calling session, or if you have spawned the poco outside of a session.
The 'encryption' method is an integer value indicating the type of encryption to employ:
1 = Simple XOR (No security, just obfuscation, but very fast)
2 = DES
3 = 3DES (Triple DES)
4 = CAST-128
5 = CAST-256
6 = xTEA
7 = 3WAY
8 = BLOWFISH
9 = TWOFISH
10 = LOKI97
11 = RC2
12 = ARCFOUR
14 = RIJNDAEL-128
15 = RIJNDAEL-192
16 = RIJNDAEL-256
19 = WAKE
20 = SERPENT
22 = ENIGMA (Unix
crypt
)
23 = GOST
24 = SAFER64
25 = SAFER128
26 = SAFER+
Methods 2-26 require that the Mcrypt module is installed.
The 'message' hashref must contain the following keys:
'host_name'
, the host that this check is
for
, mandatory;
'return_code'
, the result code
for
the check, mandatory;
'plugin_output'
, the output from the check, mandatory;
'svc_description'
, the service description ( required
if
this is a service not a host check );
The poco does it's work and will return the output event with the result.
OUTPUT EVENT
This is generated by the poco. ARG0 will be a hash reference with the following keys:
'host'
, the hostname
given
;
'message'
, the message that was sent;
'context'
, anything that you specified;
'success'
, indicates that the check was successfully sent to the NSCA daemon;
'error'
, only
exists
if
something went wrong;
PROVENANCE
Based on Net::Nsca by P Kent
Which was originally derived from work by Ethan Galstad.
SEE ALSO
AUTHOR
Chris Williams <chris@bingosnet.co.uk>
COPYRIGHT AND LICENSE
This software is copyright (c) 2017 by Chris Williams, P Kent and Ethan Galstad.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.