Nagios-Plugin-OverHTTP
view release on metacpan or search on metacpan
lib/Nagios/Plugin/OverHTTP/Formatter/Nagios/Version2.pm view on Meta::CPAN
package Nagios::Plugin::OverHTTP::Formatter::Nagios::Version2;
use 5.008001;
use strict;
use warnings 'all';
###########################################################################
# METADATA
our $AUTHORITY = 'cpan:DOUGDUDE';
our $VERSION = '0.16';
###########################################################################
# MOOSE
use Moose 0.74;
use MooseX::StrictConstructor 0.08;
###########################################################################
# ROLES
with 'Nagios::Plugin::OverHTTP::Formatter';
###########################################################################
# ALL IMPORTS BEFORE THIS WILL BE ERASED
use namespace::clean 0.04 -except => [qw(meta)];
###########################################################################
# METHODS
sub exit_code {
my ($self) = @_;
# Just return the default
return $self->standard_status_exit_code($self->response->status);
}
sub stderr {
# N/A
return q{};
}
sub stdout {
my ($self) = @_;
# The message is only the first line
my $message = [split m{\n}msx, $self->response->message]->[0];
if ($self->response->has_performance_data) {
# Get the performance data on one line
my $performance_data = join q{ }, split m{\n}msx,
$self->response->performance_data;
# Add on the performance data
$message .= q{ | } . $performance_data;
}
return $message;
}
###########################################################################
# MAKE MOOSE OBJECT IMMUTABLE
__PACKAGE__->meta->make_immutable;
1;
__END__
=head1 NAME
Nagios::Plugin::OverHTTP::Formatter::Nagios::Version2 - Format output for
Nagios version 2
=head1 VERSION
This documentation refers to L<Nagios::Plugin::OverHTTP::Formatter::Nagios::Version2>
version 0.16
=head1 SYNOPSIS
#TODO: Write this
=head1 DESCRIPTION
This formatter for L<Nagios::Plugin::OverHTTP> will format the plugin output
that corresponds to the plugin API in Nagios 2.
=head1 CONSTRUCTOR
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.
=head2 new
This will construct a new plugin object.
=over
=item B<< new(%attributes) >>
C<< %attributes >> is a HASH where the keys are attributes (specified in the
L</ATTRIBUTES> section).
=item B<< new($attributes) >>
C<< $attributes >> is a HASHREF where the keys are attributes (specified in the
L</ATTRIBUTES> section).
=back
=head1 ATTRIBUTES
( run in 2.135 seconds using v1.01-cache-2.11-cpan-71847e10f99 )