| Net-NSCA-Client documentation | view source | Contained in the Net-NSCA-Client distribution. |
Net::NSCA::Client::ServerConfig - Specify configuration data for the remote NSCA server
This documentation refers to version 0.009001
use Net::NSCA::Client::ServerConfig;
# Specify the non-default server configuration
my $config = Net::NSCA::Client::ServerConfig->new(
max_hostname_length => 100,
max_description_length => 128,
max_pluginoutput_length => 3072, # 3 KiB!
);
# Create a new connection with the configuration
my $connection = Net::NSCA::Client::Connection->new(
remote_host => 'nagios.example.net',
server_config => $config,
);
# Create a new client with the configuration
my $nsca = Net::NSCA::Client->new(
remote_host => 'nagios.example.net',
server_config => $config,
);
# Data packets will adhere to the server configuration
$nsca->send_report(
hostname => 'web1.example.net',
service => 'MYSQL',
message => $plugin_output,
status => $Net::NSCA::Client::STATUS_OK,
);
When NSCA is compiled, there are constants that define the size of the packets that will be generated and accepted. If NSCA was compiled with custom values for these constants, then this module will allow the client to generate corresponding packets.
This is fully object-oriented, and as such before any method can be used, the constructor needs to be called to create an object to work with.
This will construct a new object.
%attributes is a HASH where the keys are attributes (specified in the
ATTRIBUTES section).
$attributes is a HASHREF where the keys are attributes (specified in the
ATTRIBUTES section).
# Get an attribute my $value = $object->attribute_name;
This specifies the byte length of the initialization vector in the initial
packet as specified in the TRANSMITTED_IV_SIZE constant in common.h.
This specifies the maximum description length in bytes as specified in
the MAX_DESCRIPTION_LENGTH constant in common.h.
This specifies the maximum host name length in bytes as specified in
the MAX_HOSTNAME_LENGTH constant in common.h.
This specifies the maximum service message (plugin output) length in bytes
as specified in the MAX_PLUGINOUTPUT_LENGTH constant in common.h.
This takes another Net::NSCA::Client::ServerConfig
instance and returns a Boolean specifying if the two server configurations
are compatible with each other. This method is also accessible through an
overloaded == and !=.
This takes a HASHREF that specify the members of the C structure and the values to pack in each member. This will return a string that is the raw packed byte data.
This takes a HASHREF that specify the members of the C structure and the values to pack in each member. This will return a string that is the raw packed byte data.
This takes the raw packet as the first argument and a HASHREF (as specified in pack_data_packet) as the second argument. The first argument (the raw packet) may be a scalar reference and the packet will be modified in place. The new raw packet or the same scalar reference will be returned, based on if the first argument was a scalar reference or not.
# Repack by copying packet around
my $no_crc32 = $packer->repack_data_packet($raw_packet, {crc32_value => 0});
# Repack in place
$packer->repack_data_packet(\$raw_packet, {crc32_value => 0});
This takes the raw packet as the first argument and a HASHREF (as specified in pack_initial_packet) as the second argument. The first argument (the raw packet) may be a scalar reference and the packet will be modified in place. The new raw packet or the same scalar reference will be returned, based on if the first argument was a scalar reference or not. See repack_data_packet for usage examples.
This takes the raw packet and returns a HASHREF of the C structure names and values. The raw packet may be given as a string or as a scalar reference.
This takes the raw packet and returns a HASHREF of the C structure names and values. The raw packet may be given as a string or as a scalar reference.
Douglas Christopher Wilson, <doug at somethingdoug.com>
Please report any bugs or feature requests to bug-net-nsca-client at rt.cpan.org,
or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-NSCA-Client.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
I highly encourage the submission of bugs and enhancements to my modules.
Copyright 2009 Douglas Christopher Wilson.
This program is free software; you can redistribute it and/or modify it under the terms of either:
| Net-NSCA-Client documentation | view source | Contained in the Net-NSCA-Client distribution. |