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; +