From: Robert 'phaylon' Sedlacek Date: Wed, 9 May 2012 21:22:52 +0000 (+0000) Subject: Nagios::CheckMkAgent probe with base pod X-Git-Tag: v0.001_001~105 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=170951cadb50e23f32fd01aefd6163e726503cbb;p=scpubgit%2FSystem-Introspector.git Nagios::CheckMkAgent probe with base pod --- diff --git a/lib/System/Introspector/Nagios/CheckMkAgent.pm b/lib/System/Introspector/Nagios/CheckMkAgent.pm new file mode 100644 index 0000000..f50f821 --- /dev/null +++ b/lib/System/Introspector/Nagios/CheckMkAgent.pm @@ -0,0 +1,47 @@ +package System::Introspector::Nagios::CheckMkAgent; +use Moo; + +sub gather { + my ($self) = @_; + my @lines = $self->_get_check_mk_agent_output; + chomp @lines; + my %plugin; + my $current; + for my $line (@lines) { + if ($line =~ m{^<<<(.+)>>>$}) { + $plugin{ $1 } = $current = []; + next; + } + next unless $current; + push @$current, $line; + } + return \%plugin; +} + +sub _get_check_mk_agent_output { + return `check_mk_agent`; +} + +1; + +__END__ + +=head1 NAME + +System::Introspector::Nagios::CheckMkAgent - Gather check_mk_agent output + +=head1 DESCRIPTION + +Parses the output of C to gather data available to Nagios. + +=head1 SEE ALSO + +=over + +=item L + +=back + +=cut + +