Add option to turn off running commands
This commit is contained in:
@@ -236,6 +236,12 @@ print &ui_table_row($text{'mon_ontimeout'},
|
||||
&ui_textbox("ontimeout", $serv->{'ontimeout'}, 60),
|
||||
undef, \@tds);
|
||||
|
||||
# When to run commands?
|
||||
print &ui_table_row($text{'mon_cmdmode'},
|
||||
&ui_radio("cmdmode", $serv->{'cmdmode'} || 0,
|
||||
[ [ 0, text{'mon_cmdmode0'} ],
|
||||
[ 1, text{'mon_cmdmode1'} ] ]));
|
||||
|
||||
print &ui_table_row(" ", "<font size=-1>$text{'mon_oninfo'}</font>",
|
||||
undef, \@tds);
|
||||
|
||||
|
||||
@@ -105,6 +105,9 @@ mon_not=Not installed
|
||||
mon_ondown=If monitor goes down, run command
|
||||
mon_onup=If monitor comes up, run command
|
||||
mon_ontimeout=If monitor times out, run command
|
||||
mon_runon=Run commands when
|
||||
mon_cmdmode0=Notification is sent
|
||||
mon_cmdmode1=Never run commands
|
||||
mon_clone=Module to monitor
|
||||
mon_err=Failed to save monitor
|
||||
mon_edesc=Missing description
|
||||
|
||||
+4
-2
@@ -538,12 +538,14 @@ return $err;
|
||||
}
|
||||
|
||||
# run_on_command(&serv, command, remote-host)
|
||||
# Run some up or down command, if defined and enabled
|
||||
sub run_on_command
|
||||
{
|
||||
local ($serv, $cmd, $r) = @_;
|
||||
my ($serv, $cmd, $r) = @_;
|
||||
return undef if ($serv->{'cmdmode'} == 1);
|
||||
$r = undef if ($r eq "*");
|
||||
return undef if (!$cmd);
|
||||
local $out;
|
||||
my $out;
|
||||
if ($serv->{'runon'} && $r) {
|
||||
# Run on the remote host
|
||||
$remote_error_msg = undef;
|
||||
|
||||
@@ -75,6 +75,7 @@ else {
|
||||
$serv->{'ondown'} = $in{'ondown'};
|
||||
$serv->{'onup'} = $in{'onup'};
|
||||
$serv->{'ontimeout'} = $in{'ontimeout'};
|
||||
$serv->{'cmdmode'} = $in{'cmdmode'};
|
||||
$serv->{'runon'} = $in{'runon'};
|
||||
$serv->{'clone'} = $in{'clone'};
|
||||
$in{'fails'} =~ /^\d+$/ || &error($text{'mon_efails'});
|
||||
|
||||
Reference in New Issue
Block a user