made changes to startmon and stopmon commands to support hierarchy
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@772 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
9705c72e27
commit
c59eed7325
@ -7,7 +7,6 @@ BEGIN
|
||||
}
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
|
||||
use Sys::Hostname;
|
||||
use xCAT::NodeRange;
|
||||
use xCAT::Table;
|
||||
use xCAT::MsgUtils;
|
||||
@ -914,7 +913,8 @@ sub getMonHierarchy {
|
||||
|
||||
#get monserver for each node. use "monserver" attribute from noderes table, if not
|
||||
#defined, use "servicenode". otherwise, use loca lhost.
|
||||
my $host=hostname();
|
||||
my @hostinfo=xCAT::Utils->determinehostname();
|
||||
my $host=pop(@hostinfo);
|
||||
if (defined(@tmp1) && (@tmp1 > 0)) {
|
||||
foreach(@tmp1) {
|
||||
my $node=$_->{node};
|
||||
@ -967,7 +967,8 @@ sub getMonServerWithInfo {
|
||||
#print "getMonServerWithInfo called with @in_nodes\n";
|
||||
#get all from the noderes table
|
||||
my $table2=xCAT::Table->new("noderes", -create =>0);
|
||||
my $host=hostname();
|
||||
my @hostinfo=xCAT::Utils->determinehostname();
|
||||
my $host=pop(@hostinfo);
|
||||
|
||||
foreach (@in_nodes) {
|
||||
my $node=$_->[0];
|
||||
@ -1018,7 +1019,8 @@ sub getMonServer {
|
||||
#get all from nodelist table and noderes table
|
||||
my $table=xCAT::Table->new("nodelist", -create =>0);
|
||||
my $table2=xCAT::Table->new("noderes", -create =>0);
|
||||
my $host=hostname();
|
||||
my @hostinfo=xCAT::Utils->determinehostname();
|
||||
my $host=pop(@hostinfo);
|
||||
|
||||
foreach (@in_nodes) {
|
||||
my @tmp1=$table->getAttribs({'node'=>$_}, ('node', 'nodetype', 'status'));
|
||||
|
@ -11,6 +11,7 @@ use xCAT::NodeRange;
|
||||
use xCAT::Table;
|
||||
use xCAT::MsgUtils;
|
||||
use xCAT_monitoring::monitorctrl;
|
||||
use xCAT::Utils;
|
||||
|
||||
1;
|
||||
|
||||
@ -133,6 +134,14 @@ sub startmon {
|
||||
my $VERSION;
|
||||
my $HELP;
|
||||
|
||||
if (xCAT::Utils->isServiceNode()) {
|
||||
my %rsp=();
|
||||
$rsp->{data}->[0]= "This command is not supported on a service node.";
|
||||
$callback->($rsp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
# subroutine to display the usage
|
||||
sub startmon_usage
|
||||
{
|
||||
@ -261,7 +270,25 @@ sub startmon {
|
||||
$table->close();
|
||||
}
|
||||
|
||||
|
||||
#tell the service node to start monitoring too
|
||||
my $mon_hierachy=xCAT_monitoring::monitorctrl->getMonHierarchy();
|
||||
my @mon_servers=keys(%$mon_hierachy);
|
||||
my @hostinfo=xCAT::Utils->determinehostname();
|
||||
print "hostinfo=@hostinfo\n";
|
||||
%iphash=();
|
||||
foreach(@hostinfo) {$iphash{$_}=1;}
|
||||
foreach (@mon_servers) {
|
||||
if (! $iphash{$_}) { #if it is not this node, meaning it is ms
|
||||
my %rsp2;
|
||||
$rsp2->{data}->[0]="sending request to $_...";
|
||||
$callback->($rsp2);
|
||||
my $result=`psh --nonodecheck $_ updatemon 2>1&`;
|
||||
if ($result) {
|
||||
$rsp2->{data}->[0]="$result";
|
||||
$callback->($rsp2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my %rsp1;
|
||||
$rsp1->{data}->[0]="done.";
|
||||
@ -295,6 +322,13 @@ sub stopmon {
|
||||
my $VERSION;
|
||||
my $HELP;
|
||||
|
||||
if (xCAT::Utils->isServiceNode()) {
|
||||
my %rsp=();
|
||||
$rsp->{data}->[0]= "This command is not supported on a service node.";
|
||||
$callback->($rsp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
# subroutine to display the usage
|
||||
sub stopmon_usage
|
||||
{
|
||||
@ -378,6 +412,25 @@ sub stopmon {
|
||||
$table->close();
|
||||
}
|
||||
|
||||
#tell all the service nodes to stop monitoring too
|
||||
my $mon_hierachy=xCAT_monitoring::monitorctrl->getMonHierarchy();
|
||||
my @mon_servers=keys(%$mon_hierachy);
|
||||
my @hostinfo=xCAT::Utils->determinehostname();
|
||||
%iphash=();
|
||||
foreach(@hostinfo) {$iphash{$_}=1;}
|
||||
foreach (@mon_servers) {
|
||||
if (! $iphash{$_}) { #if it is not this node, meaning it is ms
|
||||
my %rsp2;
|
||||
$rsp2->{data}->[0]="sending request to $_...";
|
||||
$callback->($rsp2);
|
||||
my $result=`psh --nonodecheck $_ updatemon 2>1&`;
|
||||
if ($result) {
|
||||
$rsp2->{data}->[0]="$result";
|
||||
$callback->($rsp2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my %rsp1;
|
||||
$rsp1->{data}->[0]="done.";
|
||||
$callback->($rsp1);
|
||||
@ -538,3 +591,13 @@ sub lsmon {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -239,7 +239,7 @@ if ($EMAIL || ((keys(%hashE)==0) && ($severity_type =~/Critical|Warning/))) {
|
||||
my $head="SNMP $severity received from $host($ip)\n$briefmsg\n";
|
||||
my $middle="Trap details:\n$message\n";
|
||||
my $end;
|
||||
if ($node1) {$info= getMoreInfo($node1);}
|
||||
if ($node1) { $info= getMoreInfo($node1);}
|
||||
if ($info) {
|
||||
$end ="Additonal Info from xCAT:\n$info\n";
|
||||
}
|
||||
@ -303,8 +303,8 @@ sub getMoreInfo {
|
||||
|
||||
# get the info from rinv command if nothing in the vpd table
|
||||
if (!$vpd) {
|
||||
my $result=`$XCATROOT/bin/rinv $node all 2>&1 | egrep -i '(model|serial)' | grep -v Univ`;
|
||||
if ($? == 0) {#success
|
||||
my $result=`XCATBYPASS=Y $XCATROOT/bin/rinv $node all 2>&1 | egrep -i '(model|serial)' | grep -v Univ`;
|
||||
if ($? == 0) {#success
|
||||
chomp($result);
|
||||
my @b=split(/\n/, $result);
|
||||
foreach (@b) {
|
||||
|
Loading…
Reference in New Issue
Block a user