add time stamps for nodelist.status and nodelist.appstatus
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5433 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
1ea195ee01
commit
523f862d06
@ -406,14 +406,16 @@ nodehm => {
|
||||
},
|
||||
},
|
||||
nodelist => {
|
||||
cols => [qw(node groups status appstatus primarysn comments disable)],
|
||||
cols => [qw(node groups status statustime appstatus appstatustime primarysn comments disable)],
|
||||
keys => [qw(node)],
|
||||
table_desc => "The list of all the nodes in the cluster, including each node's current status and what groups it is in.",
|
||||
descriptions => {
|
||||
node => 'The hostname of a node in the cluster.',
|
||||
groups => "A comma-delimited list of groups this node is a member of. Group names are arbitrary, except all nodes should be part of the 'all' group.",
|
||||
status => 'The current status of this node. This attribute will be set by xCAT software. Valid values: defined, booting, netbooting, booted, discovering, configuring, installing, alive, standingby, powering-off, unreachable. If blank, defined is assumed. The possible status change sequenses are: For installaton: defined->[discovering]->[configuring]->[standingby]->installing->booting->booted->[alive], For diskless deployment: defined->[discovering]->[configuring]->[standingby]->netbooting->booted->[alive], For booting: [alive/unreachable]->booting->[alive], For powering off: [alive]->powering-off->[unreachable], For monitoring: alive->unreachable. Discovering and configuring are for x Series dicovery process. Alive and unreachable are set only when there is a monitoring plug-in start monitor the node status for xCAT. Please note that the status values will not reflect the real node status if you change the state of the node from outside of xCAT (i.e. power off the node using HMC GUI).',
|
||||
statustime => "The data and time when the status was updated.",
|
||||
appstatus => "A comma-delimited list monitored applications that are active on the node. For example 'sshd,rmcd,gmond",
|
||||
appstatustime => "The date and time when appstatus was updated.",
|
||||
primarysn => "Not used currently. The primary servicenode, used by this node.",
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
@ -1562,10 +1564,18 @@ my @nodeattrs = (
|
||||
tabentry => 'nodelist.status',
|
||||
access_tabentry => 'nodelist.node=attr:node',
|
||||
},
|
||||
{attr_name => 'statustime',
|
||||
tabentry => 'nodelist.statustime',
|
||||
access_tabentry => 'nodelist.node=attr:node',
|
||||
},
|
||||
{attr_name => 'appstatus',
|
||||
tabentry => 'nodelist.appstatus',
|
||||
access_tabentry => 'nodelist.node=attr:node',
|
||||
},
|
||||
{attr_name => 'appstatustime',
|
||||
tabentry => 'nodelist.appstatustime',
|
||||
access_tabentry => 'nodelist.node=attr:node',
|
||||
},
|
||||
{attr_name => 'primarysn',
|
||||
tabentry => 'nodelist.primarysn',
|
||||
access_tabentry => 'nodelist.node=attr:node',
|
||||
|
@ -622,11 +622,20 @@ sub setNodeStatusAttributes {
|
||||
}
|
||||
|
||||
my %updates;
|
||||
my (
|
||||
$sec, $min, $hour, $mday, $mon,
|
||||
$year, $wday, $yday, $isdst
|
||||
)
|
||||
= localtime(time);
|
||||
my $currtime = sprintf("%02d-%02d-%04d %02d:%02d:%02d",
|
||||
$mon + 1, $mday, $year + 1900,
|
||||
$hour, $min, $sec);
|
||||
if ($tab) {
|
||||
foreach (keys %status_hash) {
|
||||
my $nodes=$status_hash{$_};
|
||||
if (@$nodes > 0) {
|
||||
$updates{'status'} = $_;
|
||||
$updates{'statustime'} = $currtime;
|
||||
my $where_clause="node in ('" . join("','", @$nodes) . "')";
|
||||
$tab->setAttribsWhere($where_clause, \%updates );
|
||||
}
|
||||
|
@ -848,17 +848,30 @@ sub process_request {
|
||||
#get current values and compare with the new value to decide if update of db is necessary
|
||||
my @nodes1=keys(%$status);
|
||||
my $stuff = $nodetab->getNodesAttribs(\@nodes1, ['node', 'status', 'appstatus']);
|
||||
foreach my $node1 (@nodes1) {
|
||||
|
||||
#get current local time
|
||||
my (
|
||||
$sec, $min, $hour, $mday, $mon,
|
||||
$year, $wday, $yday, $isdst
|
||||
)
|
||||
= localtime(time);
|
||||
my $currtime = sprintf("%02d-%02d-%04d %02d:%02d:%02d",
|
||||
$mon + 1, $mday, $year + 1900,
|
||||
$hour, $min, $sec);
|
||||
|
||||
foreach my $node1 (@nodes1) {
|
||||
my $oldstatus=$stuff->{$node1}->[0]->{status};
|
||||
my $newstatus=$status->{$node1}->{status};
|
||||
if ($newstatus) {
|
||||
if ((!$oldstatus) || ($newstatus ne $oldstatus)) {
|
||||
$status1->{$node1}->{status}= $newstatus;
|
||||
$status1->{$node1}->{status}= $newstatus;
|
||||
$status1->{$node1}->{statustime}= $currtime;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($oldstatus) {
|
||||
$status1->{$node1}->{status}= "";
|
||||
$status1->{$node1}->{statustime}= "";
|
||||
}
|
||||
}
|
||||
|
||||
@ -867,11 +880,13 @@ sub process_request {
|
||||
if ($newappstatus) {
|
||||
if ((!$oldappstatus) || ($newappstatus ne $oldappstatus)) {
|
||||
$status1->{$node1}->{appstatus}= $newappstatus;
|
||||
$status1->{$node1}->{appstatustime}= $currtime;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($oldappstatus) {
|
||||
$status1->{$node1}->{appstatus}= "";
|
||||
$status1->{$node1}->{appstatustime}= "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user