bug fixes for monitoring code
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@229 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
410528f79c
commit
7825f9b720
@ -296,16 +296,23 @@ sub notify {
|
||||
my ($modname, $path, $suffix) = fileparse($_, ".pm");
|
||||
# print "modname=$modname, path=$path, suffix=$suffix\n";
|
||||
if ($suffix =~ /.pm/) { #it is a perl module
|
||||
my $pid;
|
||||
my $pid;
|
||||
if ($pid=fork()) { }
|
||||
elsif (defined($pid)) {
|
||||
my $fname;
|
||||
if (($path eq "") || ($path eq ".\/")) {
|
||||
#default path is /opt/xcat/lib/perl/xCAT_monitoring/ if there is no path specified
|
||||
require "$::XCATROOT/lib/perl/xCAT_monitoring/".$modname.".pm";
|
||||
$fname = "$::XCATROOT/lib/perl/xCAT_monitoring/".$modname.".pm";
|
||||
} else {
|
||||
require $_;
|
||||
$fname = $_;
|
||||
}
|
||||
eval {require($fname)};
|
||||
if ($@) {
|
||||
print "The file $fname cannot be located or has compiling errors.\n";
|
||||
}
|
||||
else {
|
||||
${"xCAT_monitoring::".$modname."::"}{processTableChanges}->($action, $tablename, $old_data, $new_data);
|
||||
}
|
||||
${"xCAT_monitoring::".$modname."::"}{processTableChanges}->($action, $tablename, $old_data, $new_data);
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
@ -370,7 +370,16 @@ sub stopMonitoring {
|
||||
my $file_name="$::XCATROOT/lib/perl/xCAT_monitoring/" . lc($_) . "mon.pm";
|
||||
$module_name="xCAT_monitoring::" . lc($_) . "mon";
|
||||
#load the module in memory
|
||||
require $file_name;
|
||||
eval {require($file_name)};
|
||||
if ($@) {
|
||||
my @ret3=(1, "The file $file_name cannot be located or has compiling errors.\n");
|
||||
$ret{$_}=\@ret3;
|
||||
next;
|
||||
}
|
||||
else {
|
||||
my @a=($file_name, $module_name);
|
||||
$PRODUCT_LIST{$pname}=\@a;
|
||||
}
|
||||
}
|
||||
#stop monitoring
|
||||
my @ret2 = ${$module_name."::"}{stop}->();
|
||||
@ -412,7 +421,14 @@ sub stopNodeStatusMonitoring {
|
||||
my $file_name="$::XCATROOT/lib/perl/xCAT_monitoring/" . lc($pname) . "mon.pm";
|
||||
$module_name="xCAT_monitoring::" . lc($pname) . "mon";
|
||||
#load the module in memory
|
||||
require $file_name;
|
||||
eval {require($file_name)};
|
||||
if ($@) {
|
||||
return (1, "The file $file_name cannot be located or has compiling errors.\n");
|
||||
}
|
||||
else {
|
||||
my @a=($file_name, $module_name);
|
||||
$PRODUCT_LIST{$pname}=\@a;
|
||||
}
|
||||
}
|
||||
|
||||
my @ret2 = ${$module_name."::"}{stopNodeStatusMon}->();
|
||||
@ -702,10 +718,14 @@ sub refreshProductList {
|
||||
$file_name="$::XCATROOT/lib/perl/xCAT_monitoring/" . lc($pname) . "mon.pm";
|
||||
$module_name="xCAT_monitoring::" . lc($pname) . "mon";
|
||||
#load the module in memory
|
||||
require $file_name;
|
||||
|
||||
my @a=($file_name, $module_name);
|
||||
$PRODUCT_LIST{$pname}=\@a;
|
||||
eval {require($file_name)};
|
||||
if ($@) {
|
||||
print "The file $file_name cannot be located or has compiling errors.\n";
|
||||
}
|
||||
else {
|
||||
my @a=($file_name, $module_name);
|
||||
$PRODUCT_LIST{$pname}=\@a;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
package xCAT_monitoring::xcatmon;
|
||||
BEGIN
|
||||
{
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
||||
}
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
#use xCAT::NodeRange;
|
||||
|
Loading…
Reference in New Issue
Block a user