From 47dbfbd43923a914661c8367c26a881ef20b9efd Mon Sep 17 00:00:00 2001 From: linggao Date: Mon, 22 Nov 2010 18:08:17 +0000 Subject: [PATCH] more conditions for monitoring services on the sn git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8233 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- .../mn/IBM.Condition/CheckFTPonSN_AIX.pm | 16 ++++++++++++++ .../mn/IBM.Condition/CheckNFSonSN.pm | 14 ++++++++++++ .../mn/IBM.Sensor/CheckFTPSensor_AIX.pm | 19 ++++++++++++++++ .../sn/IBM.Sensor/CheckFTPSensor_AIX.pm | 19 ++++++++++++++++ xCAT-rmc/scripts/check_ftpd | 22 +++++++++++++++++++ 5 files changed, 90 insertions(+) create mode 100644 xCAT-rmc/resources/mn/IBM.Condition/CheckFTPonSN_AIX.pm create mode 100644 xCAT-rmc/resources/mn/IBM.Condition/CheckNFSonSN.pm create mode 100644 xCAT-rmc/resources/mn/IBM.Sensor/CheckFTPSensor_AIX.pm create mode 100644 xCAT-rmc/resources/sn/IBM.Sensor/CheckFTPSensor_AIX.pm create mode 100755 xCAT-rmc/scripts/check_ftpd diff --git a/xCAT-rmc/resources/mn/IBM.Condition/CheckFTPonSN_AIX.pm b/xCAT-rmc/resources/mn/IBM.Condition/CheckFTPonSN_AIX.pm new file mode 100644 index 000000000..bf0c8ba77 --- /dev/null +++ b/xCAT-rmc/resources/mn/IBM.Condition/CheckFTPonSN_AIX.pm @@ -0,0 +1,16 @@ +#!/usr/bin/perl + +$RES::Condition{'CheckFTPonSN_AIX'} = { + Name => q(CheckFTPonSN_AIX), + ResourceClass => q(IBM.Sensor), + EventExpression => q(String != "ftpd is active"), + EventDescription => q(For AIX only. An event will be generated when the FTP server is down on the service node. There may be other nodes in this management domain such as HMCs. To exclude them, just change the SelectionString to: "ProgramName=='vsftpd' && NodeNameList >< {'hmc1','hmc2}" where hmc1 and hmc2 are the names for the nodes that you want to exclude.), + RearmExpression => q(String == "ftpd is active"), + RearmDescription => q(A rearm event will be generated when the FTP server is up on the service node.), + SelectionString => q(Name="CheckFTPSensor_AIX"), + ManagementScope => q(4), + Severity => q(1), +}; + + +1; diff --git a/xCAT-rmc/resources/mn/IBM.Condition/CheckNFSonSN.pm b/xCAT-rmc/resources/mn/IBM.Condition/CheckNFSonSN.pm new file mode 100644 index 000000000..fc5f94866 --- /dev/null +++ b/xCAT-rmc/resources/mn/IBM.Condition/CheckNFSonSN.pm @@ -0,0 +1,14 @@ +#!/usr/bin/perl + +$RES::Condition{'CheckNFSonSN'} = { + Name => q(CheckNFSonSN), + ResourceClass => q(IBM.Program), + EventExpression => q(Processes.CurPidCount == 0), + EventDescription => q(An event will be generated when the NFS server is down on the service node. There may be other nodes in this management domain such as HMCs. To exclude them, just change the SelectionString to: "ProgramName=='nfsd' && NodeNameList >< {'hmc1','hmc2}" where hmc1 and hmc2 are the names for the nodes that you want to exclude.), + RearmExpression => q(Processes.CurPidCount != 0), + RearmDescription => q(A rearm event will be generated when the NFS server is up on the service node.), + SelectionString => q(ProgramName=='nfsd'), + ManagementScope => q(4), + Severity => q(1), +}; +1; diff --git a/xCAT-rmc/resources/mn/IBM.Sensor/CheckFTPSensor_AIX.pm b/xCAT-rmc/resources/mn/IBM.Sensor/CheckFTPSensor_AIX.pm new file mode 100644 index 000000000..8f09b9f34 --- /dev/null +++ b/xCAT-rmc/resources/mn/IBM.Sensor/CheckFTPSensor_AIX.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_ftpd"; + +$RES::Sensor{'CheckFTPSensor_AIX'} = { + Name => q(CheckFTPSensor_AIX), + Command => "$cmd", + Description => "This sensor monitors the FTP server on AIX.", + UserName => q(root), + RefreshInterval => q(60), + ErrorExitValue => q(1), + ControlFlags => q(1), +}; +1; diff --git a/xCAT-rmc/resources/sn/IBM.Sensor/CheckFTPSensor_AIX.pm b/xCAT-rmc/resources/sn/IBM.Sensor/CheckFTPSensor_AIX.pm new file mode 100644 index 000000000..8f09b9f34 --- /dev/null +++ b/xCAT-rmc/resources/sn/IBM.Sensor/CheckFTPSensor_AIX.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_ftpd"; + +$RES::Sensor{'CheckFTPSensor_AIX'} = { + Name => q(CheckFTPSensor_AIX), + Command => "$cmd", + Description => "This sensor monitors the FTP server on AIX.", + UserName => q(root), + RefreshInterval => q(60), + ErrorExitValue => q(1), + ControlFlags => q(1), +}; +1; diff --git a/xCAT-rmc/scripts/check_ftpd b/xCAT-rmc/scripts/check_ftpd new file mode 100755 index 000000000..d96ae8729 --- /dev/null +++ b/xCAT-rmc/scripts/check_ftpd @@ -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=`lssrc -l -s inetd |grep " ftpd"|grep active 2>&1`; +if ($? == 0) { + print "ftpd is active"; +} else { + print "ftpd is inoperative" +} + +exit 0; +