Gracefully handle monitor types that don't exist

https://forum.virtualmin.com/t/finally-upgraded-and-a-problem/135204
This commit is contained in:
Jamie Cameron
2025-09-24 20:32:40 -07:00
parent d5a22a592f
commit df97b4a419

View File

@@ -197,9 +197,14 @@ foreach $r (&expand_remotes($serv)) {
# Just include and use the local monitor library
do "${t}-monitor.pl" if (!$done_monitor{$t}++);
my $func = "get_${t}_status";
$rv = &$func($serv,
if (defined(&$func)) {
$rv = &$func($serv,
$serv->{'clone'} ? $serv->{'clone'} : $t,
$fromcgi);
}
else {
$rv = { 'up' => -1 };
}
}
alarm(0);
};