From 7164cb0f4cd1aef80985c96365c335e38ccbf07d Mon Sep 17 00:00:00 2001 From: linggao Date: Fri, 20 Jun 2008 20:47:34 +0000 Subject: [PATCH] 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 --- .../mn/IBM.Condition/NodeReachability_H.pm | 15 ++++++++++++ .../MsgHierarchicalEvents.pm | 8 ------- .../MsgRootHierarchicalEvents.pm | 8 +++++++ .../sn/IBM.Condition/NodeReachability.pm | 13 ++++++++++ xCAT-rmc/scripts/configrmcnode | 1 - xCAT-rmc/scripts/msg-hierarchical-event | 24 +++++++++++++------ 6 files changed, 53 insertions(+), 16 deletions(-) create mode 100644 xCAT-rmc/resources/mn/IBM.Condition/NodeReachability_H.pm delete mode 100644 xCAT-rmc/resources/mn/IBM.EventResponse/MsgHierarchicalEvents.pm create mode 100644 xCAT-rmc/resources/mn/IBM.EventResponse/MsgRootHierarchicalEvents.pm create mode 100644 xCAT-rmc/resources/sn/IBM.Condition/NodeReachability.pm diff --git a/xCAT-rmc/resources/mn/IBM.Condition/NodeReachability_H.pm b/xCAT-rmc/resources/mn/IBM.Condition/NodeReachability_H.pm new file mode 100644 index 000000000..bb6453511 --- /dev/null +++ b/xCAT-rmc/resources/mn/IBM.Condition/NodeReachability_H.pm @@ -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; diff --git a/xCAT-rmc/resources/mn/IBM.EventResponse/MsgHierarchicalEvents.pm b/xCAT-rmc/resources/mn/IBM.EventResponse/MsgHierarchicalEvents.pm deleted file mode 100644 index 79dc760e7..000000000 --- a/xCAT-rmc/resources/mn/IBM.EventResponse/MsgHierarchicalEvents.pm +++ /dev/null @@ -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; diff --git a/xCAT-rmc/resources/mn/IBM.EventResponse/MsgRootHierarchicalEvents.pm b/xCAT-rmc/resources/mn/IBM.EventResponse/MsgRootHierarchicalEvents.pm new file mode 100644 index 000000000..5cfdeffd4 --- /dev/null +++ b/xCAT-rmc/resources/mn/IBM.EventResponse/MsgRootHierarchicalEvents.pm @@ -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; diff --git a/xCAT-rmc/resources/sn/IBM.Condition/NodeReachability.pm b/xCAT-rmc/resources/sn/IBM.Condition/NodeReachability.pm new file mode 100644 index 000000000..bb63cea05 --- /dev/null +++ b/xCAT-rmc/resources/sn/IBM.Condition/NodeReachability.pm @@ -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; diff --git a/xCAT-rmc/scripts/configrmcnode b/xCAT-rmc/scripts/configrmcnode index d9cfdfd2d..4d5b5ccd9 100755 --- a/xCAT-rmc/scripts/configrmcnode +++ b/xCAT-rmc/scripts/configrmcnode @@ -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 diff --git a/xCAT-rmc/scripts/msg-hierarchical-event b/xCAT-rmc/scripts/msg-hierarchical-event index 54935fb76..87e18053e 100755 --- a/xCAT-rmc/scripts/msg-hierarchical-event +++ b/xCAT-rmc/scripts/msg-hierarchical-event @@ -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)); } + + + + + +