From cacedba6679078a86929a3bd0520727f71ed2ec2 Mon Sep 17 00:00:00 2001 From: linggao Date: Wed, 17 Nov 2010 20:22:40 +0000 Subject: [PATCH] addind a sendor/condition to check the status of xcatd on the sn git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8191 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- .../mn/IBM.Condition/CheckxCATonSN.pm | 16 ++++++++++++++ .../mn/IBM.Sensor/CheckxCATSensor.pm | 19 ++++++++++++++++ .../sn/IBM.Sensor/CheckxCATSensor.pm | 19 ++++++++++++++++ xCAT-rmc/scripts/check_xcatd | 22 +++++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 xCAT-rmc/resources/mn/IBM.Condition/CheckxCATonSN.pm create mode 100644 xCAT-rmc/resources/mn/IBM.Sensor/CheckxCATSensor.pm create mode 100644 xCAT-rmc/resources/sn/IBM.Sensor/CheckxCATSensor.pm create mode 100755 xCAT-rmc/scripts/check_xcatd diff --git a/xCAT-rmc/resources/mn/IBM.Condition/CheckxCATonSN.pm b/xCAT-rmc/resources/mn/IBM.Condition/CheckxCATonSN.pm new file mode 100644 index 000000000..a72dc0611 --- /dev/null +++ b/xCAT-rmc/resources/mn/IBM.Condition/CheckxCATonSN.pm @@ -0,0 +1,16 @@ +#!/usr/bin/perl + +$RES::Condition{'CheckxCATonSN'} = { + Name => q(CheckxCATonSN), + ResourceClass => q(IBM.Sensor), + EventExpression => q(String != "xcatd is ok"), + EventDescription => q(An event will be generated when xcatd is not working.), + RearmExpression => q(String == "xcatd is ok"), + RearmDescription => q(An rearm event will be generated when xcatd resumes working state.), + SelectionString => q(Name="CheckxCATSensor"), + ManagementScope => q(4), + Severity => q(1), +}; + + +1; diff --git a/xCAT-rmc/resources/mn/IBM.Sensor/CheckxCATSensor.pm b/xCAT-rmc/resources/mn/IBM.Sensor/CheckxCATSensor.pm new file mode 100644 index 000000000..80ea59118 --- /dev/null +++ b/xCAT-rmc/resources/mn/IBM.Sensor/CheckxCATSensor.pm @@ -0,0 +1,19 @@ +#!/usr/bin/perl +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} +use lib "$::XCATROOT/lib/perl"; + +my $cmd="$::XCATROOT/sbin/rmcmon/check_xcatd"; + +$RES::Sensor{'CheckxCATSensor'} = { + Name => q(CheckxCATSensor), + Command => "$cmd", + Description => "This sensor monitors the xcatd daemon.", + UserName => q(root), + RefreshInterval => q(60), + ErrorExitValue => q(1), + ControlFlags => q(0), +}; +1; diff --git a/xCAT-rmc/resources/sn/IBM.Sensor/CheckxCATSensor.pm b/xCAT-rmc/resources/sn/IBM.Sensor/CheckxCATSensor.pm new file mode 100644 index 000000000..80ea59118 --- /dev/null +++ b/xCAT-rmc/resources/sn/IBM.Sensor/CheckxCATSensor.pm @@ -0,0 +1,19 @@ +#!/usr/bin/perl +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} +use lib "$::XCATROOT/lib/perl"; + +my $cmd="$::XCATROOT/sbin/rmcmon/check_xcatd"; + +$RES::Sensor{'CheckxCATSensor'} = { + Name => q(CheckxCATSensor), + Command => "$cmd", + Description => "This sensor monitors the xcatd daemon.", + UserName => q(root), + RefreshInterval => q(60), + ErrorExitValue => q(1), + ControlFlags => q(0), +}; +1; diff --git a/xCAT-rmc/scripts/check_xcatd b/xCAT-rmc/scripts/check_xcatd new file mode 100755 index 000000000..3de9036f9 --- /dev/null +++ b/xCAT-rmc/scripts/check_xcatd @@ -0,0 +1,22 @@ +#!/usr/bin/env perl +# IBM(c) 2010 EPL license http://www.eclipse.org/legal/epl-v10.html +use strict; +use locale; +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} + +use Getopt::Std; +use IPC::SysV qw(IPC_STAT S_IRWXU IPC_PRIVATE IPC_CREAT S_IRUSR S_IWUSR ); +use IPC::Msg; + +my $rc=`$::XCATROOT/bin/lsxcatd -a 2>&1`; +if ($?) { + print "$rc"; +} else { + print "xcatd is ok"; +} + +exit 0; +