From e47683853f71ae85cfd67dfefb1445a721e00a85 Mon Sep 17 00:00:00 2001 From: linggao Date: Mon, 14 Jan 2008 20:31:25 +0000 Subject: [PATCH] minor bug fix for monitoring plug-in infrastructure git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@263 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT-2.0/xCAT/Schema.pm | 2 +- .../lib/xcat/monitoring/monitorctrl.pm | 34 ++++++++++++------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/perl-xCAT-2.0/xCAT/Schema.pm b/perl-xCAT-2.0/xCAT/Schema.pm index b7e69141f..543009b5e 100644 --- a/perl-xCAT-2.0/xCAT/Schema.pm +++ b/perl-xCAT-2.0/xCAT/Schema.pm @@ -849,7 +849,7 @@ package xCAT::Schema; {attr_name => 'name', tabentry => 'monitoring.name', access_tabentry => 'monitoring.name=attr:name', - description => 'The module name of the mornitoring plug-in.'}, + description => 'The name of the mornitoring plug-in module.'}, {attr_name => 'nodestatmon', tabentry => 'monitoring.nodestatmon', access_tabentry => 'monitoring.name=attr:name', diff --git a/xCAT-server-2.0/lib/xcat/monitoring/monitorctrl.pm b/xCAT-server-2.0/lib/xcat/monitoring/monitorctrl.pm index ddcb5d4c9..a27cca09f 100644 --- a/xCAT-server-2.0/lib/xcat/monitoring/monitorctrl.pm +++ b/xCAT-server-2.0/lib/xcat/monitoring/monitorctrl.pm @@ -131,9 +131,17 @@ sub handleMonSignal { my @old_products=keys(%PRODUCT_LIST); my $old_nodestatmon=$NODESTAT_MON_NAME; + #print "old_products=@old_products.\n"; + #print "old_nodestatmon=$old_nodestatmon.\n"; #get new cache values, it also loads the newly added modules refreshProductList(); + #my @new_products=keys(%PRODUCT_LIST); + #my $new_nodestatmon=$NODESTAT_MON_NAME; + #print "new_products=@new_products.\n"; + #print "new_nodestatmon=$new_nodestatmon.\n"; + + #check what have changed my %summary; foreach (@old_products) { $summary{$_}=-1;} @@ -143,8 +151,10 @@ sub handleMonSignal { my %ret=(); foreach (keys %summary) { if ($summary{$_}==-1) { #plug-in deleted + print "got here stop $_.\n"; %ret=stopMonitoring(($_)); } elsif ($summary{$_}==1) { #plug-in added + print "got here start $_.\n"; my %ret1=startMonitoring(($_)); %ret=(%ret, %ret1); } @@ -169,7 +179,7 @@ sub handleMonSignal { foreach(keys(%ret)) { my $retstat=$ret{$_}; print "$_: @$retstat\n"; - } + } } @@ -275,7 +285,7 @@ sub startMonitoring { my @ret1 = ${$module_name."::"}{start}->($monservers); $ret{$_}=\@ret1; } else { - $ret{$_}=[1, "Monitoring plug-in module for $_ cannot be found."]; + $ret{$_}=[1, "Monitoring plug-in module $_ is not registered."]; } } @@ -321,7 +331,7 @@ sub startNodeStatusMonitoring { } } else { - return (1, "The monitoring plug-in module for $pname cannot be found."); + return (1, "The monitoring plug-in module $pname is not registered."); } } else { @@ -373,10 +383,10 @@ sub stopMonitoring { $ret{$_}=\@ret3; next; } - else { - my @a=($file_name, $module_name); - $PRODUCT_LIST{$pname}=\@a; - } + #else { + # my @a=($file_name, $module_name); + # $PRODUCT_LIST{$pname}=\@a; + #} } #stop monitoring my @ret2 = ${$module_name."::"}{stop}->(); @@ -422,10 +432,10 @@ sub stopNodeStatusMonitoring { 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; - } + #else { + # my @a=($file_name, $module_name); + # $PRODUCT_LIST{$pname}=\@a; + #} } my @ret2 = ${$module_name."::"}{stopNodeStatusMon}->(); @@ -713,7 +723,7 @@ sub refreshProductList { #find out the monitoring plugin file and module name for the product $file_name="$::XCATROOT/lib/perl/xCAT_monitoring/$pname.pm"; - $module_name="xCAT_monitoring::" . $pname; + $module_name="xCAT_monitoring::$pname"; #load the module in memory eval {require($file_name)}; if ($@) {