From 680c924c53793f3b7f32773ca6a64914c2a62c33 Mon Sep 17 00:00:00 2001 From: linggao Date: Fri, 5 Nov 2010 17:38:27 +0000 Subject: [PATCH] fix for rmc monitoring git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8064 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-rmc/plugin/rmcmon.pm | 67 ++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/xCAT-rmc/plugin/rmcmon.pm b/xCAT-rmc/plugin/rmcmon.pm index 015396b05..3a06dbeaf 100644 --- a/xCAT-rmc/plugin/rmcmon.pm +++ b/xCAT-rmc/plugin/rmcmon.pm @@ -389,7 +389,7 @@ sub stop { =cut #-------------------------------------------------------------------------------- sub config { - print "rmcmon:config called\n"; + #print "rmcmon:config called\n"; my $noderef=shift; if ($noderef =~ /xCAT_monitoring::rmcmon/) { $noderef=shift; @@ -428,12 +428,6 @@ sub config { #enable remote client connection `/usr/bin/rmcctrl -p`; - my $pPairHash=xCAT_monitoring::monitorctrl->getMonServer($noderef); - if (ref($pPairHash) eq 'ARRAY') { - reportError($pPairHash->[1], $callback); - return (1, ""); - } - #the identification of this node my @hostinfo=xCAT::Utils->determinehostname(); @@ -442,6 +436,39 @@ sub config { foreach(@hostinfo) {$iphash{$_}=1;} if (!$isSV) { $iphash{'noservicenode'}=1;} + #create conditions/responses/sensors on the service node or mn + my $result=`/usr/sbin/rsct/install/bin/ctversion`; + my $rsct_ver; + if (!$?) { + chomp($result); + my @tempa=split(/ /, $result); + if (@tempa>1) { + $rsct_ver=$tempa[1]; + } + } + my $version_string; + if ($rsct_ver) {$version_string="RSCT_VER=$rsct_ver"; } + + my $result; + if ($isSV) { + $result=`$version_string $::XCATROOT/sbin/rmcmon/mkrmcresources $::XCATROOT/lib/perl/xCAT_monitoring/rmc/resources/sn 2>&1`; } else { + $result=`$version_string $::XCATROOT/sbin/rmcmon/mkrmcresources $::XCATROOT/lib/perl/xCAT_monitoring/rmc/resources/mn 2>&1`; + } + if ($?) { + my $error= "Error when creating predefined resources on $localhostname:\n$result"; + reportError($error, $callback); + } + if(!$isSV){ + xCAT::Utils->runcmd("chtab key='rmetrics_IBM.Host' monsetting.name=rmcmon monsetting.value='PctTotalTimeIdle,PctTotalTimeWait,PctTotalTimeUser,PctTotalTimeKernel,PctRealMemFree:1'", 0); + xCAT::Utils->runcmd("chtab key='rmetrics_IBM.EthernetDevice' monsetting.name=rmcmon monsetting.value='RecByteRate,RecPacketRate,XmitByteRate,XmitPacketRate:1'", 0); + } + + my $pPairHash=xCAT_monitoring::monitorctrl->getMonServer($noderef); + if (ref($pPairHash) eq 'ARRAY') { + reportError($pPairHash->[1], $callback); + return (1, ""); + } + foreach my $key (keys (%$pPairHash)) { my @key_a=split(':', $key); if (! $iphash{$key_a[0]}) { next;} @@ -474,32 +501,6 @@ sub config { } } - #create conditions/responses/sensors on the service node or mn - my $result=`/usr/sbin/rsct/install/bin/ctversion`; - my $rsct_ver; - if (!$?) { - chomp($result); - my @tempa=split(/ /, $result); - if (@tempa>1) { - $rsct_ver=$tempa[1]; - } - } - my $version_string; - if ($rsct_ver) {$version_string="RSCT_VER=$rsct_ver"; } - - my $result; - if ($isSV) { - $result=`$version_string $::XCATROOT/sbin/rmcmon/mkrmcresources $::XCATROOT/lib/perl/xCAT_monitoring/rmc/resources/sn 2>&1`; } else { - $result=`$version_string $::XCATROOT/sbin/rmcmon/mkrmcresources $::XCATROOT/lib/perl/xCAT_monitoring/rmc/resources/mn 2>&1`; - } - if ($?) { - my $error= "Error when creating predefined resources on $localhostname:\n$result"; - reportError($error, $callback); - } - if(!$isSV){ - xCAT::Utils->runcmd("chtab key='rmetrics_IBM.Host' monsetting.name=rmcmon monsetting.value='PctTotalTimeIdle,PctTotalTimeWait,PctTotalTimeUser,PctTotalTimeKernel,PctRealMemFree:1'", 0); - xCAT::Utils->runcmd("chtab key='rmetrics_IBM.EthernetDevice' monsetting.name=rmcmon monsetting.value='RecByteRate,RecPacketRate,XmitByteRate,XmitPacketRate:1'", 0); - } } #--------------------------------------------------------------------------------