Skip to content
Snippets Groups Projects
Commit abab5d63 authored by Mark Harrison's avatar Mark Harrison
Browse files

Adding a 'run helper script and return the output' check, to deal with some

custom helper scripts the bluestreak checks use.


git-svn-id: https://labs.omniti.com/resmon/trunk@99 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55
parent f4072742
No related branches found
No related tags found
No related merge requests found
package Resmon::Module::SCRIPT;
use Resmon::ExtComm qw/cache_command/;
use vars qw/@ISA/;
@ISA = qw/Resmon::Module/;
# Runs a custom helper script, returning the output.
# Example config file:
# SCRIPT {
# name : script => /path/to/perl_script.pl, cache => 30
# name2 : script => /path/to/another_script.pl, cache => 30
# }
sub handler {
my $arg = shift;
my $os = $arg->fresh_status();
return $os if $os;
my $object = $arg->{'object'};
my $script = $arg->{'script'} || return "BAD", "No script specified";
my $timeout = $arg->{'timeout'} || 30;
my $output = cache_command("$script", $timeout);
if ($output) {
chomp($output);
return $arg->set_status($output);
} else {
return "BAD", "No output from command";
}
}
1;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment