From d00f870c088521a7e93c84e7d251357f754e642c Mon Sep 17 00:00:00 2001 From: saiprakash Date: Tue, 30 Sep 2008 14:39:59 +0000 Subject: [PATCH] modified pcp_collect git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2266 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/sbin/pcp_collect | 39 +++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/xCAT-server/sbin/pcp_collect b/xCAT-server/sbin/pcp_collect index 7feed6020..e059fbcf5 100755 --- a/xCAT-server/sbin/pcp_collect +++ b/xCAT-server/sbin/pcp_collect @@ -13,6 +13,7 @@ use xCAT::Utils; use xCAT::GlobalDef; use xCAT_monitoring::monitorctrl; use xCAT::MsgUtils; +use xCAT_monitoring::xcatmon; use strict; use warnings; 1; @@ -60,10 +61,21 @@ sub performance no strict; no warnings; #my $i=0; + my @inactive_children; for ($i = 0;$i < $count_child;$i++) { #opening if count_child 2 - $str=`pmdumptext -c $::XCATROOT/lib/perl/xCAT_monitoring/pcp/pcpmon.config -d§ -s1 -h$children[$i] -f%D:%H:%M:%S`; + $str=`pmdumptext -c $::XCATROOT/lib/perl/xCAT_monitoring/pcp/pcpmon.config -d§ -s1 -h$children[$i] -f%D:%H:%M:%S 2>&1`; #print "before split is $str \n"; + #if ($str =~ /\s*No\s*route\s*to\s*host/) + if ($str =~ /pmdumptext:\s*Error:\s*host\s*"\w*":/) + { + #print "host unreachable \n"; + @inactive_children=$children[$i]; + #print "inactive children is @inactive_children \n"; + } + else + { + #print "into elso loop \n"; $str =~ s/\n//g; #print "before split_1 is $str \n"; my @spl1=split(/§/,$str); @@ -118,7 +130,32 @@ sub performance $table1->setAttribs(\%key_col1, \%setting_hash); } $table1->close(); + } } #closing if count_child 2 + my %node_status=(); + #print "2nd set is @inactive_children \n"; + my $count_inactive=@inactive_children; + if ($count_inactive>0) + { + #print "more than 0 inactive children \n"; + #print "3rd set is @inactive_children \n"; + $node_status{$::STATUS_INACTIVE}=\@inactive_children; + my $changed1=$nodes_status{$::STATUS_INACTIVE}; + #print "the changed1 is $changed1 \n"; + my @final_inactive=@$changed1; + #print "final inactive is @final_inactive \n"; + } + + + #only set the node status for the changed ones + if (keys(%node_status) > 0) + { + #print %node_status, "\n"; + #print "updating nodelist table \n"; + xCAT_monitoring::xcatmon::setNodeStatusAttributes(\%node_status); + } + + } #closing if count_child 1 } # closing subroutine \ No newline at end of file