diff --git a/xCAT-client/pods/man1/nodestat.1.pod b/xCAT-client/pods/man1/nodestat.1.pod index ee8e93000..14519e857 100644 --- a/xCAT-client/pods/man1/nodestat.1.pod +++ b/xCAT-client/pods/man1/nodestat.1.pod @@ -4,7 +4,7 @@ B - display the running status of each node in a noderange =head1 B -B [I] [I<-m>|I<--usemon>] [I<-u>|I<--updatedb>] +B [I] [I<-m>|I<--usemon>] [I<-p>|I<--powerstat>] [I<-u>|I<--updatedb>] B [I<-h>|I<--help>|I<-v>|I<--version>] @@ -21,7 +21,7 @@ By default, it works as following: 4. for non-pingable nodes, it shows 'noping'. -When -m is specified and there are settings in the monsetting table, it displays the status of the applications specified in the monsetting table. When -u is specified it saves the status info into the xCAT database. Node's pingable status and deployment status is saved in the nodelist.status column. Node's application status is saved in the nodelist.appstatus column. +When -m is specified and there are settings in the monsetting table, it displays the status of the applications specified in the monsetting table. When -p is specified it shows the power status for the nodes that are not pingable. When -u is specified it saves the status info into the xCAT database. Node's pingable status and deployment status is saved in the nodelist.status column. Node's application status is saved in the nodelist.appstatus column. To specify settings in the B table, use 'xcatmon' as the name, 'apps' as the key and the value will be a list of comma separated list of application names. For each application, you can specify the port number that can be queried on the nodes to get the running status. Or you can specify a command that can be called to get the node status from. The command can be a command that can be run locally at the management node or the service node for hierarchical cluster, or a command that can be run remotely on the nodes. @@ -53,6 +53,10 @@ Keywords to use: Uses the settings from the B talbe to determine a list of applications that need to get status for. +=item B<-p>|B<--powerstat> + +Gets the power status for the nodes that are 'noping'. + =item B<-u>|B<--updatedb> Updates the status and appstatus columns of the nodelist table with the returned running status from the given nodes. @@ -78,8 +82,16 @@ Print help. node4 ping,pbs node5 noping +2. nodestat compute -p -2. nodeset compute -u + node1 ping,sshd + node2 ping,sshd + node3 ping + node4 ping,pbs + node5 noping(Shutting down) + + +3. nodeset compute -u node1 ping,sshd node2 ping,sshd node3 ping @@ -87,7 +99,7 @@ Print help. node5 noping -3. nodeset compute -m +4. nodeset compute -m node1 ping,sshd,ll,gpfs=ok node2 ping,sshd,ll,gpfs=not ok,someapp=something is wrong node3 netboot diff --git a/xCAT-server/lib/xcat/plugins/nodestat.pm b/xCAT-server/lib/xcat/plugins/nodestat.pm index a88978a44..dccba9668 100644 --- a/xCAT-server/lib/xcat/plugins/nodestat.pm +++ b/xCAT-server/lib/xcat/plugins/nodestat.pm @@ -123,6 +123,7 @@ sub preprocess_request $::UPDATE=0; $::QUITE=0; $::MON=0; + $::POWER=0; #Getopt::Long::Configure("posix_default"); #Getopt::Long::Configure("no_gnu_compat"); Getopt::Long::Configure("bundling"); @@ -131,6 +132,7 @@ sub preprocess_request 'm|usemon' => \$::MON, 'q|quite' => \$::QUITE, #this is a internal flag used by monitoring 'u|updatedb' => \$::UPDATE, + 'p|powerstat' => \$::POWER, 'h|help' => \$::HELP, 'v|version' => \$::VERSION)) { @@ -158,6 +160,7 @@ sub preprocess_request $req->{'update'}->[0]=$::UPDATE; $req->{'quite'}->[0]=$::QUITE; $req->{'mon'}->[0]=$::MON; + $req->{'power'}->[0]=$::POWER; return [$req]; } @@ -488,8 +491,6 @@ sub process_request_nmap { my @nodes =(); if ($nodelist) { @nodes=@$nodelist;} - my $update=$request->{'update'}->[0]; - my %nodebyip; my @livenodes; my %unknownnodes; @@ -855,13 +856,14 @@ sub process_request { #print Dumper($ret); my $status={}; my @noping_nodes=(); + my $power=$request->{'power'}->[0]; foreach my $tmpdata (@$ret) { if ($tmpdata =~ /([^:]+): (.*)$separator(.*)$separator(.*)/) { # print "node=$1, status=$2, appstatus=$3, appsd=$4\n"; $status->{$1}->{'status'}=$2; $status->{$1}->{'appstatus'}=$3; $status->{$1}->{'appsd'}=$4; - if ($2 eq "noping") { + if (($power) && ($2 eq "noping")) { push(@noping_nodes, $1); } } else { @@ -871,7 +873,8 @@ sub process_request { } } - if (@noping_nodes > 0) { + #get power status for noping nodes + if (($power) && (@noping_nodes > 0)) { #print "noping_nodes=@noping_nodes\n"; my $ret = xCAT::Utils->runxcmd( { @@ -977,7 +980,7 @@ sub usage my $cb=shift; my $rsp={}; $rsp->{data}->[0]= "Usage:"; - $rsp->{data}->[1]= " nodestat [noderange] [-m|--usemon] [-u|--updatedb]"; + $rsp->{data}->[1]= " nodestat [noderange] [-m|--usemon] [-p|powerstat] [-u|--updatedb]"; $rsp->{data}->[2]= " nodestat [-h|--help|-v|--version]"; xCAT::MsgUtils->message("I", $rsp, $cb); }