Added NodeReachability condition, modified msg-hierarchical-event for RMC monitoring

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1727 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
linggao 2008-06-20 20:47:34 +00:00
parent 9ef42ce67c
commit 7164cb0f4c
6 changed files with 53 additions and 16 deletions

View File

@ -0,0 +1,15 @@
#!/usr/bin/perl
$RES::Condition{'NodeReachability_H'} = {
Name => q(NodeReachability_H),
ResourceClass => q(IBM.Condition),
EventExpression => q(LastEvent.Occurred==1 && LastEvent.ErrNum==0 && (LastEvent.EventFlags & 0x0233) == 0),
RearmExpression => q(LastEvent.Occurred==1 && LastEvent.ErrNum==0 && (LastEvent.EventFlags & 3) ==1),
EventDescription => q(This condition collects all the NodeReachability events from the service nodes. An event will be generated when a node becomes network unreachable from the management server.),
RearmDescription => q(A rearm event will be generated when the node is reachable again.),
SelectionString => q(Name="NodeReachability"),
ManagementScope => q(4),
Severity => q(2),
NoToggleExprFlag => q(1),
};
1;

View File

@ -1,8 +0,0 @@
#!/usr/bin/perl
$RES::EventResponse{'MsgHierarchicalEvents'} = {
Name => q(MsgHierarchicalEvents),
Locked => q(0),
Actions => q({[msgEvent,{127},{0},{86400},/opt/xcat/sbin/rmcmon/msg-hierarchical-event,3,0,0,0,{},0]}),
};
1;

View File

@ -0,0 +1,8 @@
#!/usr/bin/perl
$RES::EventResponse{'MsgRootHierarchicalEvents'} = {
Name => q(MsgRootHierarchicalEvents),
Locked => q(0),
Actions => q({[msgEvent,{127},{0},{86400},/opt/xcat/sbin/rmcmon/msg-hierarchical-event root,3,0,0,0,{},0]}),
};
1;

View File

@ -0,0 +1,13 @@
#!/usr/bin/perl
$RES::Condition{'NodeReachability'} = {
Name => q(NodeReachability),
ResourceClass => q(IBM.MngNode),
EventExpression => q(Status@P==1 && Status!=1),
EventDescription => q(An event will be generated when a node becomes network unreachable from the management server.),
RearmExpression => q(Status=1),
RearmDescription => q(A rearm event will be generated when the node is reachable again.),
ManagementScope => q(1),
Severity => q(2),
};
1;

View File

@ -1,7 +1,6 @@
#!/bin/sh
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
use Getopt::Long;
##########################################################################################
# This script is used for RMC node configuration

View File

@ -34,6 +34,7 @@ my @TYPE = ('Event', 'Rearm event');
my $severity=$COND_SEVERITY[$ENV{ERRM_COND_SEVERITYID}];
my $type=$TYPE[$ENV{ERRM_TYPEID }];
my $where = join(' ', @ARGV);
# Parse the ERRM_VALUE attribute, which will contain the EventOccurred structured data variable from the Condition class
# The fields in this structured data variable are documented below where we parse them out.
@ -73,25 +74,28 @@ for (my $i=0; $i<$NumAttrs; $i++) {
if (!length($ResourceName)) { $ResourceName = '(unknown)'; }
my $msg;
$msg .= "$severity $type occurred at " . convertTime($EventTime) . ":\n";
$msg .= "$severity $type occurred:\n";
$msg .= " MN Condition: $ENV{ERRM_COND_NAME}\n";
$msg .= " SN: $ENV{ERRM_NODE_NAME}\n"; # do we have to use $ERRM_NODE_NAMELIST here?
$msg .= " SN Condition: $ENV{ERRM_RSRC_NAME}\n";
$msg .= " SN: $ENV{ERRM_NODE_NAME}\n"; # do we have to use $ERRM_NODE_NAMELIST here?
$msg .= " Node: $NodeName\n";
$msg .= " Resource Name: $ResourceName\n";
$msg .= " Resource: $ResourceName\n";
$msg .= " Time: " . convertTime($EventTime) . " \n";
if (length($valuesMsg)) {
$msg .= " Attributes:\n";
$msg .= $valuesMsg;
}
# Skipped the following: $ERRM_EXPR $ERRM_RSRC_CLASS_PNAME $ERRM_DATA_TYPE $ERRM_NODE_NAMELIST $ERRM_RSRC_TYPE
#$str = escape_chars($str);
my $rc = system(qq(echo "$msg" | write $where)) >> 8;
open(CMD, "| wall") || die "Error: can not start wall command.\n";
print CMD $msg;
close(CMD);
exit $rc;
#open(CMD, "| wall") || die "Error: can not start wall command.\n";
#print CMD $msg;
#close(CMD);
exit;
# convert time string
@ -99,3 +103,9 @@ sub convertTime {
my ($seconds, $micro) = split(/\./, $_[0]);
return strftime("%A %D %T", localtime($seconds));
}