* Added Clusterware (CRS) plugins (as a platform).
* Moved Serviceguard plugins to separate platform (+fixes) * Other fixes
This commit is contained in:
parent
a4e1b4b954
commit
05dd91edc4
33
build/clusterware/linux/ARCH/hc-resource-platform/.install
Normal file
33
build/clusterware/linux/ARCH/hc-resource-platform/.install
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# -- post-install --
|
||||||
|
post_install() {
|
||||||
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
|
# location of check_health.sh
|
||||||
|
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||||
|
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||||
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
echo "INFO: starting post-install script ..."
|
||||||
|
# refresh symbolic FPATH links
|
||||||
|
if [[ -x ${HC_BIN} ]]
|
||||||
|
then
|
||||||
|
${HC_BIN} --fix-symlinks
|
||||||
|
(( $? == 0 )) || echo "WARN: updating symlinks failed"
|
||||||
|
fi
|
||||||
|
echo "INFO: finished post-install script"
|
||||||
|
}
|
||||||
|
|
||||||
|
# -- post-remove --
|
||||||
|
post_remove() {
|
||||||
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
|
# location of check_health.sh
|
||||||
|
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||||
|
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||||
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
echo "INFO: starting post-uninstall script ..."
|
||||||
|
# refresh symbolic FPATH links
|
||||||
|
if [[ -x ${HC_BIN} ]]
|
||||||
|
then
|
||||||
|
${HC_BIN} --fix-symlinks
|
||||||
|
(( $? == 0 )) || echo "WARN: updating symlinks failed"
|
||||||
|
fi
|
||||||
|
echo "INFO: finished post-uninstall script"
|
||||||
|
}
|
29
build/clusterware/linux/ARCH/hc-resource-platform/PKGBUILD
Normal file
29
build/clusterware/linux/ARCH/hc-resource-platform/PKGBUILD
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# Maintainer: Patrick Van der Veken <patrick@kudos.be>
|
||||||
|
|
||||||
|
_pkgname="check_health"
|
||||||
|
pkgname="hc-clusterware-platform"
|
||||||
|
pkgver="%BUILD_DATE%"
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="The KUDOS Health Checker (HC) for UNIX (Clusterware plugins)"
|
||||||
|
arch=("any")
|
||||||
|
url="https://github.com/patvdv/${_pkgname}"
|
||||||
|
license=('GPL3')
|
||||||
|
makedepends=('git')
|
||||||
|
depends=('hc-linux')
|
||||||
|
source=("${_pkgname}::git+${url}.git#branch=master")
|
||||||
|
install=".install"
|
||||||
|
sha256sums=('SKIP')
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "${srcdir}/${_pkgname}"
|
||||||
|
install -d -m 755 ${pkgdir}/opt/hc/lib
|
||||||
|
install -d -m 755 ${pkgdir}/opt/hc/lib/platform
|
||||||
|
install -d -m 755 ${pkgdir}/opt/hc/lib/platform/clusterware
|
||||||
|
install -D -m 755 opt/hc/lib/platform/clusterware/check_clusterware_resource_config.sh ${pkgdir}/opt/hc/lib/platform/clusterware/check_clusterware_resource_config.sh
|
||||||
|
install -D -m 755 opt/hc/lib/platform/clusterware/check_clusterware_resource_status.sh ${pkgdir}/opt/hc/lib/platform/clusterware/check_clusterware_resource_status.sh
|
||||||
|
install -d -m 755 ${pkgdir}/etc/opt/hc
|
||||||
|
install -D -m 644 etc/opt/hc/check_clusterware_resource_config.conf.dist ${pkgdir}/etc/opt/hc/check_clusterware_resource_config.conf.dist
|
||||||
|
install -D -m 644 etc/opt/hc/check_clusterware_resource_status.conf.dist ${pkgdir}/etc/opt/hc/check_clusterware_resource_status.conf.dist
|
||||||
|
install -d -m 755 ${pkgdir}/etc/opt/hc/core
|
||||||
|
install -d -m 755 ${pkgdir}/etc/opt/hc/core/templates
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
Package: hc-clusterware-platform
|
||||||
|
Version: %BUILD_DATE%
|
||||||
|
Architecture: all
|
||||||
|
Maintainer: Patrick Van der Veken <patrick@kudos.be>
|
||||||
|
Essential: no
|
||||||
|
Installed-Size: 300
|
||||||
|
Depends: hc-linux
|
||||||
|
Section: tools
|
||||||
|
Priority: extra
|
||||||
|
Description: The KUDOS Health Checker (HC) for UNIX (Clusterware plugins).
|
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
|
# location of check_health.sh
|
||||||
|
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||||
|
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||||
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
echo "INFO: starting post-install script ..."
|
||||||
|
# debian: reset ownerships
|
||||||
|
chown -R root:root /opt/hc /etc/opt/hc 2>/dev/null
|
||||||
|
# refresh symbolic FPATH links
|
||||||
|
if [[ -x ${HC_BIN} ]]
|
||||||
|
then
|
||||||
|
${HC_BIN} --fix-symlinks
|
||||||
|
(( $? == 0 )) || echo "WARN: updating symlinks failed"
|
||||||
|
fi
|
||||||
|
echo "INFO: finished post-install script"
|
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
|
# location of check_health.sh
|
||||||
|
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||||
|
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||||
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
echo "INFO: starting post-uninstall script ..."
|
||||||
|
# refresh symbolic FPATH links
|
||||||
|
if [[ -x ${HC_BIN} ]]
|
||||||
|
then
|
||||||
|
${HC_BIN} --fix-symlinks
|
||||||
|
(( $? == 0 )) || echo "WARN: updating symlinks failed"
|
||||||
|
fi
|
||||||
|
echo "INFO: finished post-uninstall script"
|
83
build/clusterware/linux/SPECS/hc-clusterware-platform.spec
Normal file
83
build/clusterware/linux/SPECS/hc-clusterware-platform.spec
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
%define build_timestamp %(date +"%Y%m%d")
|
||||||
|
|
||||||
|
Name: hc-clusterware-platform
|
||||||
|
Version: %{build_timestamp}
|
||||||
|
Release: 1
|
||||||
|
|
||||||
|
Summary: The KUDOS Health Checker (HC) for UNIX (Clusterware plugins)
|
||||||
|
Group: Tools/Monitoring
|
||||||
|
|
||||||
|
License: GNU General Public License either version 2 of the License, or (at your option) any later version
|
||||||
|
URL: http://www.kudos.be
|
||||||
|
|
||||||
|
Requires: ksh,hc-linux
|
||||||
|
BuildArch: noarch
|
||||||
|
BuildRoot: %{_topdir}/%{name}-%{version}-root
|
||||||
|
|
||||||
|
%description
|
||||||
|
The Health Checker is collection of scripts (plugins) designed to perform regular - but not intensive - health checks on UNIX/Linux systems. It provides plugins for AIX, HP-UX and Linux as well customer specific checks. Checks may include topics such file system mounts, process checks, file consistency etc.
|
||||||
|
This package contains Serviceguard platform specific plugins.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
|
||||||
|
%build
|
||||||
|
|
||||||
|
%install
|
||||||
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
install -d -m 755 $RPM_BUILD_ROOT/opt/hc/lib
|
||||||
|
install -d -m 755 $RPM_BUILD_ROOT/opt/hc/lib/platform
|
||||||
|
install -d -m 755 $RPM_BUILD_ROOT/opt/hc/lib/platform/clusterware
|
||||||
|
cp ../SOURCES/opt/hc/lib/platform/clusterware/check_clusterware_resource_config.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/clusterware/check_clusterware_resource_config.sh
|
||||||
|
cp ../SOURCES/opt/hc/lib/platform/clusterware/check_clusterware_resource_status.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/clusterware/check_clusterware_resource_status.sh
|
||||||
|
install -d -m 755 $RPM_BUILD_ROOT/etc/opt/hc
|
||||||
|
cp ../SOURCES/etc/opt/hc/check_clusterware_resource_config.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/check_clusterware_resource_config.conf.dist
|
||||||
|
cp ../SOURCES/etc/opt/hc/check_clusterware_resource_status.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/check_clusterware_resource_status.conf.dist
|
||||||
|
install -d -m 755 $RPM_BUILD_ROOT/etc/opt/hc/core
|
||||||
|
install -d -m 755 $RPM_BUILD_ROOT/etc/opt/hc/core/templates
|
||||||
|
|
||||||
|
%post
|
||||||
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
|
# location of check_health.sh
|
||||||
|
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||||
|
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||||
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
echo "INFO: starting post-install script ..."
|
||||||
|
# refresh symbolic FPATH links
|
||||||
|
if [[ -x ${HC_BIN} ]]
|
||||||
|
then
|
||||||
|
${HC_BIN} --fix-symlinks
|
||||||
|
(( $? == 0 )) || echo "WARN: updating symlinks failed"
|
||||||
|
fi
|
||||||
|
echo "INFO: finished post-install script"
|
||||||
|
|
||||||
|
%postun
|
||||||
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
|
# location of check_health.sh
|
||||||
|
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||||
|
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||||
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
echo "INFO: starting post-uninstall script ..."
|
||||||
|
# refresh symbolic FPATH links
|
||||||
|
if [[ -x ${HC_BIN} ]]
|
||||||
|
then
|
||||||
|
${HC_BIN} --fix-symlinks
|
||||||
|
(( $? == 0 )) || echo "WARN: updating symlinks failed"
|
||||||
|
fi
|
||||||
|
echo "INFO: finished post-uninstall script"
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr(-,root,root,755)
|
||||||
|
%dir /opt/hc/lib
|
||||||
|
%dir /opt/hc/lib/platform
|
||||||
|
%dir /opt/hc/lib/platform/clusterware
|
||||||
|
%attr(755, root, root) /opt/hc/lib/platform/clusterware/check_clusterware_resource_config.sh
|
||||||
|
%attr(755, root, root) /opt/hc/lib/platform/clusterware/check_clusterware_resource_status.sh
|
||||||
|
%dir /etc/opt/hc
|
||||||
|
%attr(644, root, root) /etc/opt/hc/check_clusterware_resource_config.conf.dist
|
||||||
|
%attr(644, root, root) /etc/opt/hc/check_clusterware_resource_status.conf.dist
|
||||||
|
%dir /etc/opt/hc/core
|
||||||
|
%dir /etc/opt/hc/core/templates
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Sa Apr 20 2019 <patrick@kudos.be> - 0.0.1
|
||||||
|
- Initial build
|
53
build/clusterware/linux/hc_build_linux_rpms.sh
Normal file
53
build/clusterware/linux/hc_build_linux_rpms.sh
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/env ksh
|
||||||
|
#******************************************************************************
|
||||||
|
# @(#) build script for HC RPM packages (uses 'rpmbuild')
|
||||||
|
#******************************************************************************
|
||||||
|
# @(#) Copyright (C) 2014 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it and/or modify
|
||||||
|
# it under the same terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
||||||
|
#******************************************************************************
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# Requires following build (dir) structures:
|
||||||
|
#
|
||||||
|
# hc_build_linux_rpms.sh
|
||||||
|
# BUILD/
|
||||||
|
# BUILDROOT/
|
||||||
|
# RPMS/
|
||||||
|
# SOURCES/opt/
|
||||||
|
# SOURCES/opt/hc/bin/<hc_scripts>
|
||||||
|
# SOURCES/opt/hc/lib/*/<hc_plugins>
|
||||||
|
# SOURCES/etc/opt/hc/<hc_configs>
|
||||||
|
# SPECS/<spec_files>
|
||||||
|
# SRPMS/
|
||||||
|
#
|
||||||
|
# Build order:
|
||||||
|
# 1) Copy sources/scripts to the correct locations
|
||||||
|
# 2) Copy template, build and installer script files into correct locations
|
||||||
|
# 3) Execute hc_build_linux_rpms.sh
|
||||||
|
# 4) RPM packages may be found in the RPMS directory
|
||||||
|
#******************************************************************************
|
||||||
|
|
||||||
|
BUILD_DIR="$(dirname $0)"
|
||||||
|
|
||||||
|
# clean up previous packages
|
||||||
|
rm -f ${BUILD_DIR}/RPMS/*/* >/dev/null
|
||||||
|
|
||||||
|
# build main packages
|
||||||
|
rpmbuild -bb ${BUILD_DIR}/SPECS/hc-clusterware-platform.spec
|
||||||
|
|
||||||
|
print "List of built packages:"
|
||||||
|
ls -l ${BUILD_DIR}/RPMS/*/*
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# END of script
|
||||||
|
#******************************************************************************
|
155
build/hpux/check_health-build_hpux_depots.sh
Normal file
155
build/hpux/check_health-build_hpux_depots.sh
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
#!/usr/bin/env ksh
|
||||||
|
#******************************************************************************
|
||||||
|
# @(#) CGK build script for HC SD packages (uses 'swpackage')
|
||||||
|
#******************************************************************************
|
||||||
|
# @(#) Copyright (C) 2014 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it and/or modify
|
||||||
|
# it under the same terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
||||||
|
#******************************************************************************
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# Requires following build (dir) structures:
|
||||||
|
#
|
||||||
|
# build/hpux/<build_files>
|
||||||
|
# build/hpux/check_health-build_hpux_depots.sh
|
||||||
|
# opt/hc/bin/<hc_scripts>
|
||||||
|
# opt/hc/lib/*/<hc_plugins>
|
||||||
|
# etc/opt/hc/<hc_configs>
|
||||||
|
# depots/
|
||||||
|
#
|
||||||
|
# Build order:
|
||||||
|
# 1) Copy sources/scrips to the correct locations
|
||||||
|
# 2) Copy pristine version of the build spec file to preserver %BUILD_DATE% (.psf)
|
||||||
|
# 3) Copy template, build and installer script files into correct locations
|
||||||
|
# 4) Execute check_health-build_hpux_depots.sh
|
||||||
|
# 5) SD packages may be found in the 'depots' directory
|
||||||
|
#******************************************************************************
|
||||||
|
|
||||||
|
BUILD_DATE="$(date +'%Y%m%d')"
|
||||||
|
BUILD_PRETTY_DATE="$(date +'%Y.%m.%d')"
|
||||||
|
BUILD_DIR=$(dirname "${0}")
|
||||||
|
DEPOTS_DIR="${BUILD_DIR}/../../depots"
|
||||||
|
|
||||||
|
case "${1}" in
|
||||||
|
prod)
|
||||||
|
SW_DEPOT_LOC="/var/opt/ignite/depots/3rdparty"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
SW_DEPOT_LOC="/var/opt/ignite/depots/3rdparty-test"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# replace BUILD_DATE placeholder in PSF file(s)
|
||||||
|
function fix_build_date
|
||||||
|
{
|
||||||
|
find . -name "*.psf" | while read -r FILE
|
||||||
|
do
|
||||||
|
if (( $(grep -c '%BUILD_DATE%' "${FILE}") == 0 ))
|
||||||
|
then
|
||||||
|
print -u2 "ERROR: no %BUILD_DATE% placeholder in ${FILE}!"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
perl -pi -e "s/%BUILD_DATE%/${BUILD_PRETTY_DATE}/g" "${FILE}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# check for depot directory or clean up previous packages
|
||||||
|
if [[ -d "${DEPOTS_DIR}" ]]
|
||||||
|
then
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
rm -f ${DEPOTS_DIR}/hc_hpux*.sd ${DEPOTS_DIR}/hc_display*.sd ${DEPOTS_DIR}/hc_notify*.sd >/dev/null
|
||||||
|
else
|
||||||
|
mkdir -p "${DEPOTS_DIR}" || exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# build hc_hpux package
|
||||||
|
cd "${BUILD_DIR}/hc_hpux/" || exit 1
|
||||||
|
fix_build_date
|
||||||
|
swpackage -s hc_hpux.psf -x media_type=tape -d "${DEPOTS_DIR}/hc_hpux-${BUILD_DATE}.sd"
|
||||||
|
swpackage -s hc_hpux.psf @ ${SW_DEPOT_LOC}
|
||||||
|
cd - || exit 1
|
||||||
|
|
||||||
|
# build hc_hpux_platform package
|
||||||
|
cd "${BUILD_DIR}/hc_hpux_platform" || exit 1
|
||||||
|
fix_build_date
|
||||||
|
swpackage -s hc_hpux_platform.psf -x media_type=tape -d "${DEPOTS_DIR}/hc_hpux_platform-${BUILD_DATE}.sd"
|
||||||
|
swpackage -s hc_hpux_platform.psf @ ${SW_DEPOT_LOC}
|
||||||
|
cd - || exit 1
|
||||||
|
|
||||||
|
# build hc_display_csv package
|
||||||
|
cd "${BUILD_DIR}/hc_display_csv" || exit 1
|
||||||
|
fix_build_date
|
||||||
|
swpackage -s hc_display_csv.psf -x media_type=tape -d "${DEPOTS_DIR}/hc_display_csv-${BUILD_DATE}.sd"
|
||||||
|
swpackage -s hc_display_csv.psf @ ${SW_DEPOT_LOC}
|
||||||
|
cd - || exit 1
|
||||||
|
|
||||||
|
# build hc_display_init package
|
||||||
|
cd "${BUILD_DIR}/hc_display_init" || exit 1
|
||||||
|
fix_build_date
|
||||||
|
swpackage -s hc_display_init.psf -x media_type=tape -d "${DEPOTS_DIR}/hc_display_init-${BUILD_DATE}.sd"
|
||||||
|
swpackage -s hc_display_init.psf @ ${SW_DEPOT_LOC}
|
||||||
|
cd - || exit 1
|
||||||
|
|
||||||
|
# build hc_display_json package
|
||||||
|
cd "${BUILD_DIR}/hc_display_json" || exit 1
|
||||||
|
fix_build_date
|
||||||
|
swpackage -s hc_display_json.psf -x media_type=tape -d "${DEPOTS_DIR}/hc_display_json-${BUILD_DATE}.sd"
|
||||||
|
swpackage -s hc_display_json.psf @ ${SW_DEPOT_LOC}
|
||||||
|
cd - || exit 1
|
||||||
|
|
||||||
|
# build hc_display_terse package
|
||||||
|
cd "${BUILD_DIR}/hc_display_terse" || exit 1
|
||||||
|
fix_build_date
|
||||||
|
swpackage -s hc_display_terse.psf -x media_type=tape -d "${DEPOTS_DIR}/hc_display_terse-${BUILD_DATE}.sd"
|
||||||
|
swpackage -s hc_display_terse.psf @ ${SW_DEPOT_LOC}
|
||||||
|
cd - || exit 1
|
||||||
|
|
||||||
|
# build hc_display_zenoss package
|
||||||
|
cd "${BUILD_DIR}/hc_display_zenoss" || exit 1
|
||||||
|
fix_build_date
|
||||||
|
swpackage -s hc_display_zenoss.psf -x media_type=tape -d "${DEPOTS_DIR}/hc_display_zenoss-${BUILD_DATE}.sd"
|
||||||
|
swpackage -s hc_display_zenoss.psf @ ${SW_DEPOT_LOC}
|
||||||
|
cd - || exit 1
|
||||||
|
|
||||||
|
# build hc_notify_sms package
|
||||||
|
cd "${BUILD_DIR}/hc_notify_sms" || exit 1
|
||||||
|
fix_build_date
|
||||||
|
swpackage -s hc_notify_sms.psf -x media_type=tape -d "${DEPOTS_DIR}/hc_notify_sms-${BUILD_DATE}.sd"
|
||||||
|
swpackage -s hc_notify_sms.psf @ ${SW_DEPOT_LOC}
|
||||||
|
cd - || exit 1
|
||||||
|
|
||||||
|
# build hc_notify_eif package
|
||||||
|
cd "${BUILD_DIR}/hc_notify_eif" || exit 1
|
||||||
|
fix_build_date
|
||||||
|
swpackage -s hc_notify_eif.psf -x media_type=tape -d "${DEPOTS_DIR}/hc_notify_eif-${BUILD_DATE}.sd"
|
||||||
|
swpackage -s hc_notify_eif.psf @ ${SW_DEPOT_LOC}
|
||||||
|
cd - || exit 1
|
||||||
|
|
||||||
|
# -- additional depots --
|
||||||
|
# build hc_serviceguard_platform package
|
||||||
|
cd "${BUILD_DIR}/hc_serviceguard_platform" || exit 1
|
||||||
|
fix_build_date
|
||||||
|
swpackage -s hc_serviceguard_platform.psf -x media_type=tape -d "${DEPOTS_DIR}/hc_serviceguard_platform-${BUILD_DATE}.sd"
|
||||||
|
swpackage -s hc_serviceguard_platform.psf @ ${SW_DEPOT_LOC}
|
||||||
|
cd - || exit 1
|
||||||
|
|
||||||
|
print "INFO: list of built packages (local @${DEPOTS_DIR}):"
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
ls -l ${DEPOTS_DIR}/hc_hpux*.sd ${DEPOTS_DIR}/hc_display*.sd ${DEPOTS_DIR}/hc_notify*.sd
|
||||||
|
|
||||||
|
print "INFO: list of built packages (central @${SW_DEPOT_LOC}):"
|
||||||
|
swlist @ ${SW_DEPOT_LOC} | grep "HC-"
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# END of script
|
||||||
|
#******************************************************************************
|
@ -83,11 +83,6 @@ This is the OS/platform plugin package"
|
|||||||
file -m 755 check_hpux_postfix_status.sh
|
file -m 755 check_hpux_postfix_status.sh
|
||||||
file -m 755 check_hpux_root_crontab.sh
|
file -m 755 check_hpux_root_crontab.sh
|
||||||
file -m 755 check_hpux_sfm_status.sh
|
file -m 755 check_hpux_sfm_status.sh
|
||||||
file -m 755 check_hpux_sg_package_status.sh
|
|
||||||
file -m 755 check_hpux_sg_package_config.sh
|
|
||||||
file -m 755 check_hpux_sg_cluster_status.sh
|
|
||||||
file -m 755 check_hpux_sg_cluster_config.sh
|
|
||||||
file -m 755 check_hpux_sg_qs_status.sh
|
|
||||||
file -m 755 check_hpux_sshd_status.sh
|
file -m 755 check_hpux_sshd_status.sh
|
||||||
file -m 755 check_hpux_syslog.sh
|
file -m 755 check_hpux_syslog.sh
|
||||||
file -m 755 check_hpux_syslogd_status.sh
|
file -m 755 check_hpux_syslogd_status.sh
|
||||||
@ -122,10 +117,6 @@ This is the OS/platform plugin package"
|
|||||||
file -m 755 check_hpux_patch_version.conf.dist
|
file -m 755 check_hpux_patch_version.conf.dist
|
||||||
file -m 644 check_hpux_root_crontab.conf.dist
|
file -m 644 check_hpux_root_crontab.conf.dist
|
||||||
file -m 644 check_hpux_sfm_status.conf.dist
|
file -m 644 check_hpux_sfm_status.conf.dist
|
||||||
file -m 644 check_hpux_sg_package_status.conf.dist
|
|
||||||
file -m 644 check_hpux_sg_package_config.conf.dist
|
|
||||||
file -m 644 check_hpux_sg_cluster_status.conf.dist
|
|
||||||
file -m 644 check_hpux_sg_cluster_config.conf.dist
|
|
||||||
file -m 644 check_hpux_syslog.conf.dist
|
file -m 644 check_hpux_syslog.conf.dist
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -41,11 +41,6 @@ package() {
|
|||||||
install -D -m 755 opt/hc/lib/platform/linux/check_linux_hpssacli.sh ${pkgdir}/opt/hc/lib/platform/linux/check_linux_hpssacli.sh
|
install -D -m 755 opt/hc/lib/platform/linux/check_linux_hpssacli.sh ${pkgdir}/opt/hc/lib/platform/linux/check_linux_hpssacli.sh
|
||||||
install -D -m 755 opt/hc/lib/platform/linux/check_linux_process_limits.sh ${pkgdir}/opt/hc/lib/platform/linux/check_linux_process_limits.sh
|
install -D -m 755 opt/hc/lib/platform/linux/check_linux_process_limits.sh ${pkgdir}/opt/hc/lib/platform/linux/check_linux_process_limits.sh
|
||||||
install -D -m 755 opt/hc/lib/platform/linux/check_linux_root_crontab.sh ${pkgdir}/opt/hc/lib/platform/linux/check_linux_root_crontab.sh
|
install -D -m 755 opt/hc/lib/platform/linux/check_linux_root_crontab.sh ${pkgdir}/opt/hc/lib/platform/linux/check_linux_root_crontab.sh
|
||||||
install -D -m 755 opt/hc/lib/platform/linux/check_linux_sg_cluster_config.sh ${pkgdir}/opt/hc/lib/platform/linux/check_linux_sg_cluster_config.sh
|
|
||||||
install -D -m 755 opt/hc/lib/platform/linux/check_linux_sg_cluster_status.sh ${pkgdir}/opt/hc/lib/platform/linux/check_linux_sg_cluster_status.sh
|
|
||||||
install -D -m 755 opt/hc/lib/platform/linux/check_linux_sg_package_config.sh ${pkgdir}/opt/hc/lib/platform/linux/check_linux_sg_package_config.sh
|
|
||||||
install -D -m 755 opt/hc/lib/platform/linux/check_linux_sg_package_status.sh ${pkgdir}/opt/hc/lib/platform/linux/check_linux_sg_package_status.sh
|
|
||||||
install -D -m 755 opt/hc/lib/platform/linux/check_linux_sg_qs_status.sh ${pkgdir}/opt/hc/lib/platform/linux/check_linux_sg_qs_status.sh
|
|
||||||
install -D -m 755 opt/hc/lib/platform/linux/check_linux_vz_ct_counters.sh ${pkgdir}/opt/hc/lib/platform/linux/check_linux_vz_ct_counters.sh
|
install -D -m 755 opt/hc/lib/platform/linux/check_linux_vz_ct_counters.sh ${pkgdir}/opt/hc/lib/platform/linux/check_linux_vz_ct_counters.sh
|
||||||
install -D -m 755 opt/hc/lib/platform/linux/check_linux_vz_ct_status.sh ${pkgdir}/opt/hc/lib/platform/linux/check_linux_vz_ct_status.sh
|
install -D -m 755 opt/hc/lib/platform/linux/check_linux_vz_ct_status.sh ${pkgdir}/opt/hc/lib/platform/linux/check_linux_vz_ct_status.sh
|
||||||
install -d -m 755 ${pkgdir}/etc/opt/hc
|
install -d -m 755 ${pkgdir}/etc/opt/hc
|
||||||
@ -62,10 +57,6 @@ package() {
|
|||||||
install -D -m 644 etc/opt/hc/check_linux_ntp_status.conf.dist ${pkgdir}/etc/opt/hc/check_linux_ntp_status.conf.dist
|
install -D -m 644 etc/opt/hc/check_linux_ntp_status.conf.dist ${pkgdir}/etc/opt/hc/check_linux_ntp_status.conf.dist
|
||||||
install -D -m 644 etc/opt/hc/check_linux_process_limits.conf.dist ${pkgdir}/etc/opt/hc/check_linux_process_limits.conf.dist
|
install -D -m 644 etc/opt/hc/check_linux_process_limits.conf.dist ${pkgdir}/etc/opt/hc/check_linux_process_limits.conf.dist
|
||||||
install -D -m 644 etc/opt/hc/check_linux_root_crontab.conf.dist ${pkgdir}/etc/opt/hc/check_linux_root_crontab.conf.dist
|
install -D -m 644 etc/opt/hc/check_linux_root_crontab.conf.dist ${pkgdir}/etc/opt/hc/check_linux_root_crontab.conf.dist
|
||||||
install -D -m 644 etc/opt/hc/check_linux_sg_cluster_config.conf.dist ${pkgdir}/etc/opt/hc/check_linux_sg_cluster_config.conf.dist
|
|
||||||
install -D -m 644 etc/opt/hc/check_linux_sg_cluster_status.conf.dist ${pkgdir}/etc/opt/hc/check_linux_sg_cluster_status.conf.dist
|
|
||||||
install -D -m 644 etc/opt/hc/check_linux_sg_package_config.conf.dist ${pkgdir}/etc/opt/hc/check_linux_sg_package_config.conf.dist
|
|
||||||
install -D -m 644 etc/opt/hc/check_linux_sg_package_status.conf.dist ${pkgdir}/etc/opt/hc/check_linux_sg_package_status.conf.dist
|
|
||||||
install -D -m 644 etc/opt/hc/check_linux_vz_ct_counters.conf.dist ${pkgdir}/etc/opt/hc/check_linux_vz_ct_counters.conf.dist
|
install -D -m 644 etc/opt/hc/check_linux_vz_ct_counters.conf.dist ${pkgdir}/etc/opt/hc/check_linux_vz_ct_counters.conf.dist
|
||||||
install -D -m 644 etc/opt/hc/check_linux_vz_ct_status.conf.dist ${pkgdir}/etc/opt/hc/check_linux_vz_ct_status.conf.dist
|
install -D -m 644 etc/opt/hc/check_linux_vz_ct_status.conf.dist ${pkgdir}/etc/opt/hc/check_linux_vz_ct_status.conf.dist
|
||||||
install -d -m 755 ${pkgdir}/etc/opt/hc/core
|
install -d -m 755 ${pkgdir}/etc/opt/hc/core
|
||||||
|
@ -49,11 +49,6 @@ cp ../SOURCES/opt/hc/lib/platform/linux/check_linux_hplog.sh $RPM_BUILD_ROOT/opt
|
|||||||
cp ../SOURCES/opt/hc/lib/platform/linux/check_linux_hpssacli.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/linux/check_linux_hpssacli.sh
|
cp ../SOURCES/opt/hc/lib/platform/linux/check_linux_hpssacli.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/linux/check_linux_hpssacli.sh
|
||||||
cp ../SOURCES/opt/hc/lib/platform/linux/check_linux_process_limits.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/linux/check_linux_process_limits.sh
|
cp ../SOURCES/opt/hc/lib/platform/linux/check_linux_process_limits.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/linux/check_linux_process_limits.sh
|
||||||
cp ../SOURCES/opt/hc/lib/platform/linux/check_linux_root_crontab.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/linux/check_linux_root_crontab.sh
|
cp ../SOURCES/opt/hc/lib/platform/linux/check_linux_root_crontab.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/linux/check_linux_root_crontab.sh
|
||||||
cp ../SOURCES/opt/hc/lib/platform/linux/check_linux_sg_cluster_config.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/linux/check_linux_sg_cluster_config.sh
|
|
||||||
cp ../SOURCES/opt/hc/lib/platform/linux/check_linux_sg_cluster_status.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/linux/check_linux_sg_cluster_status.sh
|
|
||||||
cp ../SOURCES/opt/hc/lib/platform/linux/check_linux_sg_package_config.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/linux/check_linux_sg_package_config.sh
|
|
||||||
cp ../SOURCES/opt/hc/lib/platform/linux/check_linux_sg_package_status.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/linux/check_linux_sg_package_status.sh
|
|
||||||
cp ../SOURCES/opt/hc/lib/platform/linux/check_linux_sg_qs_status.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/linux/check_linux_sg_qs_status.sh
|
|
||||||
cp ../SOURCES/opt/hc/lib/platform/linux/check_linux_vz_ct_counters.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/linux/check_linux_vz_ct_counters.sh
|
cp ../SOURCES/opt/hc/lib/platform/linux/check_linux_vz_ct_counters.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/linux/check_linux_vz_ct_counters.sh
|
||||||
cp ../SOURCES/opt/hc/lib/platform/linux/check_linux_vz_ct_status.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/linux/check_linux_vz_ct_status.sh
|
cp ../SOURCES/opt/hc/lib/platform/linux/check_linux_vz_ct_status.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/linux/check_linux_vz_ct_status.sh
|
||||||
install -d -m 755 $RPM_BUILD_ROOT/etc/opt/hc
|
install -d -m 755 $RPM_BUILD_ROOT/etc/opt/hc
|
||||||
@ -70,10 +65,6 @@ cp ../SOURCES/etc/opt/hc/check_linux_mysqld_status.conf.dist $RPM_BUILD_ROOT/etc
|
|||||||
cp ../SOURCES/etc/opt/hc/check_linux_ntp_status.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/check_linux_ntp_status.conf.dist
|
cp ../SOURCES/etc/opt/hc/check_linux_ntp_status.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/check_linux_ntp_status.conf.dist
|
||||||
cp ../SOURCES/etc/opt/hc/check_linux_process_limits.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/check_linux_process_limits.conf.dist
|
cp ../SOURCES/etc/opt/hc/check_linux_process_limits.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/check_linux_process_limits.conf.dist
|
||||||
cp ../SOURCES/etc/opt/hc/check_linux_root_crontab.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/check_linux_root_crontab.conf.dist
|
cp ../SOURCES/etc/opt/hc/check_linux_root_crontab.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/check_linux_root_crontab.conf.dist
|
||||||
cp ../SOURCES/etc/opt/hc/check_linux_sg_cluster_config.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/check_linux_sg_cluster_config.conf.dist
|
|
||||||
cp ../SOURCES/etc/opt/hc/check_linux_sg_cluster_status.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/check_linux_sg_cluster_status.conf.dist
|
|
||||||
cp ../SOURCES/etc/opt/hc/check_linux_sg_package_config.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/check_linux_sg_package_config.conf.dist
|
|
||||||
cp ../SOURCES/etc/opt/hc/check_linux_sg_package_status.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/check_linux_sg_package_status.conf.dist
|
|
||||||
cp ../SOURCES/etc/opt/hc/check_linux_vz_ct_counters.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/check_linux_vz_ct_counters.conf.dist
|
cp ../SOURCES/etc/opt/hc/check_linux_vz_ct_counters.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/check_linux_vz_ct_counters.conf.dist
|
||||||
cp ../SOURCES/etc/opt/hc/check_linux_vz_ct_status.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/check_linux_vz_ct_status.conf.dist
|
cp ../SOURCES/etc/opt/hc/check_linux_vz_ct_status.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/check_linux_vz_ct_status.conf.dist
|
||||||
install -d -m 755 $RPM_BUILD_ROOT/etc/opt/hc/core
|
install -d -m 755 $RPM_BUILD_ROOT/etc/opt/hc/core
|
||||||
@ -138,11 +129,6 @@ echo "INFO: finished post-uninstall script"
|
|||||||
%attr(755, root, root) /opt/hc/lib/platform/linux/check_linux_hpssacli.sh
|
%attr(755, root, root) /opt/hc/lib/platform/linux/check_linux_hpssacli.sh
|
||||||
%attr(755, root, root) /opt/hc/lib/platform/linux/check_linux_process_limits.sh
|
%attr(755, root, root) /opt/hc/lib/platform/linux/check_linux_process_limits.sh
|
||||||
%attr(755, root, root) /opt/hc/lib/platform/linux/check_linux_root_crontab.sh
|
%attr(755, root, root) /opt/hc/lib/platform/linux/check_linux_root_crontab.sh
|
||||||
%attr(755, root, root) /opt/hc/lib/platform/linux/check_linux_sg_cluster_config.sh
|
|
||||||
%attr(755, root, root) /opt/hc/lib/platform/linux/check_linux_sg_cluster_status.sh
|
|
||||||
%attr(755, root, root) /opt/hc/lib/platform/linux/check_linux_sg_package_config.sh
|
|
||||||
%attr(755, root, root) /opt/hc/lib/platform/linux/check_linux_sg_package_status.sh
|
|
||||||
%attr(755, root, root) /opt/hc/lib/platform/linux/check_linux_sg_qs_status.sh
|
|
||||||
%attr(755, root, root) /opt/hc/lib/platform/linux/check_linux_vz_ct_counters.sh
|
%attr(755, root, root) /opt/hc/lib/platform/linux/check_linux_vz_ct_counters.sh
|
||||||
%attr(755, root, root) /opt/hc/lib/platform/linux/check_linux_vz_ct_status.sh
|
%attr(755, root, root) /opt/hc/lib/platform/linux/check_linux_vz_ct_status.sh
|
||||||
%dir /etc/opt/hc
|
%dir /etc/opt/hc
|
||||||
@ -159,10 +145,6 @@ echo "INFO: finished post-uninstall script"
|
|||||||
%attr(644, root, root) /etc/opt/hc/check_linux_ntp_status.conf.dist
|
%attr(644, root, root) /etc/opt/hc/check_linux_ntp_status.conf.dist
|
||||||
%attr(644, root, root) /etc/opt/hc/check_linux_process_limits.conf.dist
|
%attr(644, root, root) /etc/opt/hc/check_linux_process_limits.conf.dist
|
||||||
%attr(644, root, root) /etc/opt/hc/check_linux_root_crontab.conf.dist
|
%attr(644, root, root) /etc/opt/hc/check_linux_root_crontab.conf.dist
|
||||||
%attr(644, root, root) /etc/opt/hc/check_linux_sg_cluster_config.conf.dist
|
|
||||||
%attr(644, root, root) /etc/opt/hc/check_linux_sg_cluster_status.conf.dist
|
|
||||||
%attr(644, root, root) /etc/opt/hc/check_linux_sg_package_config.conf.dist
|
|
||||||
%attr(644, root, root) /etc/opt/hc/check_linux_sg_package_status.conf.dist
|
|
||||||
%attr(644, root, root) /etc/opt/hc/check_linux_vz_ct_counters.conf.dist
|
%attr(644, root, root) /etc/opt/hc/check_linux_vz_ct_counters.conf.dist
|
||||||
%attr(644, root, root) /etc/opt/hc/check_linux_vz_ct_status.conf.dist
|
%attr(644, root, root) /etc/opt/hc/check_linux_vz_ct_status.conf.dist
|
||||||
%dir /etc/opt/hc/core
|
%dir /etc/opt/hc/core
|
||||||
@ -171,6 +153,8 @@ echo "INFO: finished post-uninstall script"
|
|||||||
%attr(644, root, root) /etc/opt/hc/core/templates/mail_body.tpl-check_linux_root_crontab
|
%attr(644, root, root) /etc/opt/hc/core/templates/mail_body.tpl-check_linux_root_crontab
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sat Apr 20 2019 <patrick@kudos.be> - 0.3.0
|
||||||
|
- Removed Serviceguard plugins
|
||||||
* Tue Mar 26 2019 <patrick@kudos.be> - 0.2.0
|
* Tue Mar 26 2019 <patrick@kudos.be> - 0.2.0
|
||||||
- New git tree organization
|
- New git tree organization
|
||||||
* Sat Mar 09 2019 <patrick@kudos.be> - 0.1.5
|
* Sat Mar 09 2019 <patrick@kudos.be> - 0.1.5
|
||||||
|
77
build/serviceguard/hpux/build_hpux_depots.sh
Normal file
77
build/serviceguard/hpux/build_hpux_depots.sh
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
#!/usr/bin/env ksh
|
||||||
|
#******************************************************************************
|
||||||
|
# @(#) build script for HC SD packages (uses 'swpackage')
|
||||||
|
#******************************************************************************
|
||||||
|
# @(#) Copyright (C) 2014 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it and/or modify
|
||||||
|
# it under the same terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
||||||
|
#******************************************************************************
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# Requires following build (dir) structures:
|
||||||
|
#
|
||||||
|
# build/hpux/<build_files>
|
||||||
|
# build/hpux/build_hpux_depots.sh
|
||||||
|
# opt/hc/bin/<hc_scripts>
|
||||||
|
# opt/hc/lib/*/<hc_plugins>
|
||||||
|
# etc/opt/hc/<hc_configs>
|
||||||
|
# depots/
|
||||||
|
#
|
||||||
|
# Build order:
|
||||||
|
# 1) Copy sources/scrips to the correct locations
|
||||||
|
# 2) Copy pristine version of the build spec file to preserver %BUILD_DATE% (.psf)
|
||||||
|
# 3) Copy template, build and installer script files into correct locations
|
||||||
|
# 4) Execute build_hpux_depots.sh
|
||||||
|
# 5) SD packages may be found in the 'depots' directory
|
||||||
|
#******************************************************************************
|
||||||
|
|
||||||
|
BUILD_DATE="$(date +'%Y%m%d')"
|
||||||
|
BUILD_PRETTY_DATE="$(date +'%Y.%m.%d')"
|
||||||
|
BUILD_DIR="$(dirname $0)"
|
||||||
|
|
||||||
|
# clean up previous packages
|
||||||
|
if [[ -d ../../depots ]]
|
||||||
|
then
|
||||||
|
rm -f ../../depots/* 2>/dev/null
|
||||||
|
else
|
||||||
|
mkdir -p ../../depots 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
# see if we have BUILD_DATE placeholder in PSF files
|
||||||
|
find ${BUILD_DIR} -name "*.psf" | while read FILE
|
||||||
|
do
|
||||||
|
if (( $(grep -c '%BUILD_DATE%' ${FILE}) == 0 ))
|
||||||
|
then
|
||||||
|
print -u2 "ERROR: no %BUILD_DATE% placeholder in ${FILE}!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# replace BUILD_DATE placeholder in PSF files
|
||||||
|
find ${BUILD_DIR} -name "*.psf" | while read FILE
|
||||||
|
do
|
||||||
|
perl -pi -e "s/%BUILD_DATE%/${BUILD_PRETTY_DATE}/g" ${FILE}
|
||||||
|
done
|
||||||
|
|
||||||
|
# build hc_serviceguard_platform package
|
||||||
|
cd ${BUILD_DIR}/hc_serviceguard_platform || exit 1
|
||||||
|
swpackage -s hc_serviceguard_platform.psf -x media_type=tape -d ../../../depots/hc-serviceguard-platform-${BUILD_DATE}.sd
|
||||||
|
cd - || exit 1
|
||||||
|
|
||||||
|
print "List of built packages:"
|
||||||
|
ls -l ../../depots/*
|
||||||
|
|
||||||
|
# when installed on an ignite server: possible addition of depot registration here
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# END of script
|
||||||
|
#******************************************************************************
|
@ -0,0 +1,102 @@
|
|||||||
|
# Depot definition:
|
||||||
|
depot
|
||||||
|
layout_version 1.0
|
||||||
|
|
||||||
|
# Vendor definition:
|
||||||
|
vendor
|
||||||
|
tag KUDOS
|
||||||
|
title "KUDOS BVBA - http://www.kudos.be"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Bundle definitions:
|
||||||
|
bundle
|
||||||
|
tag HC-SERVICEGUARD-PLATFORM
|
||||||
|
title "The Health Checker (HC) for UNIX (Serviceguard plugins)"
|
||||||
|
os_name HP-UX
|
||||||
|
revision %BUILD_DATE%
|
||||||
|
architecture HP-UX_B.11_32/64
|
||||||
|
machine_type ia64*
|
||||||
|
vendor_tag KUDOS
|
||||||
|
contents HC-SERVICEGUARD-PLATFORM,r=,a=,v=
|
||||||
|
end
|
||||||
|
|
||||||
|
# Product definitions:
|
||||||
|
product
|
||||||
|
tag HC-SERVICEGUARD-PLATFORM
|
||||||
|
revision %BUILD_DATE%
|
||||||
|
category tools
|
||||||
|
category_title Tools
|
||||||
|
title "The Health Checker (HC) for UNIX (Serviceguard plugins)"
|
||||||
|
description "The Health Checker is collection of scripts (plugins)
|
||||||
|
designed to perform regular - but not intensive - health checks on
|
||||||
|
UNIX/Linux systems. It provides plugins for AIX, HP-UX and Linux as
|
||||||
|
well customer specific checks. Checks may include topics such file
|
||||||
|
system mounts, process checks, file consistency etc.
|
||||||
|
This is the OS/platform plugin package"
|
||||||
|
architecture S700/S800_HP-UX_10/HP-UX_11/IA64_HP-UX_11
|
||||||
|
machine_type 9000/7*|9000/8*|ia64*
|
||||||
|
os_name HP-UX
|
||||||
|
os_release ?.1?.*
|
||||||
|
os_version [A-Z]
|
||||||
|
directory /opt/hc
|
||||||
|
is_locatable false
|
||||||
|
is_patch false
|
||||||
|
|
||||||
|
postinstall scripts/hc_serviceguard_platform.postinstall
|
||||||
|
postremove scripts/hc_serviceguard_platform.postremove
|
||||||
|
|
||||||
|
# Fileset definitions:
|
||||||
|
fileset
|
||||||
|
tag plugins
|
||||||
|
title UX Health Checker (Serviceguard plugins)
|
||||||
|
is_kernel false
|
||||||
|
is_locatable false
|
||||||
|
is_reboot false
|
||||||
|
is_sparse false
|
||||||
|
is_patch false
|
||||||
|
prerequisite HC-HPUX-MAIN
|
||||||
|
|
||||||
|
file_permissions -u 0222 -o root -g sys
|
||||||
|
|
||||||
|
directory ../../../opt/hc/lib/platform/serviceguard=/opt/hc/lib/platform/serviceguard
|
||||||
|
file -m 755 check_serviceguard_package_status.sh
|
||||||
|
file -m 755 check_serviceguard_package_config.sh
|
||||||
|
file -m 755 check_serviceguard_cluster_status.sh
|
||||||
|
file -m 755 check_serviceguard_cluster_config.sh
|
||||||
|
file -m 755 check_serviceguard_qs_status.sh
|
||||||
|
end
|
||||||
|
|
||||||
|
fileset
|
||||||
|
tag config
|
||||||
|
title UX Health Checker (Serviceguard plugins: configuration)
|
||||||
|
is_kernel false
|
||||||
|
is_locatable false
|
||||||
|
is_reboot false
|
||||||
|
is_sparse false
|
||||||
|
is_patch false
|
||||||
|
prerequisite HC-SERVICEGUARD-PLATFORM.plugins
|
||||||
|
|
||||||
|
file_permissions -u 0222 -o root -g sys
|
||||||
|
|
||||||
|
directory ../../../etc/opt/hc/=/etc/opt/hc
|
||||||
|
file -m 644 check_serviceguard_package_status.conf.dist
|
||||||
|
file -m 644 check_serviceguard_package_config.conf.dist
|
||||||
|
file -m 644 check_serviceguard_cluster_status.conf.dist
|
||||||
|
file -m 644 check_serviceguard_cluster_config.conf.dist
|
||||||
|
end
|
||||||
|
|
||||||
|
fileset
|
||||||
|
tag templates
|
||||||
|
title UX Health Checker (OS/Platform plugins: templates)
|
||||||
|
is_kernel false
|
||||||
|
is_locatable false
|
||||||
|
is_reboot false
|
||||||
|
is_sparse false
|
||||||
|
is_patch false
|
||||||
|
prerequisite HC-SERVICEGUARD-PLATFORM.plugins
|
||||||
|
|
||||||
|
file_permissions -u 0222 -o root -g sys
|
||||||
|
|
||||||
|
directory ../../../etc/opt/hc/core/templates=/etc/opt/hc/core/templates
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env ksh
|
||||||
|
#******************************************************************************
|
||||||
|
# @(#) post-install script for HC-SERVICEGUARD-PLATFORM SD package
|
||||||
|
#******************************************************************************
|
||||||
|
# @(#) Copyright (C) 2014 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it and/or modify
|
||||||
|
# it under the same terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
||||||
|
#******************************************************************************
|
||||||
|
|
||||||
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
|
# location of check_health.sh
|
||||||
|
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||||
|
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||||
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
|
||||||
|
print "INFO: starting post-install script ..."
|
||||||
|
|
||||||
|
# refresh symbolic FPATH links
|
||||||
|
if [[ -x ${HC_BIN} ]]
|
||||||
|
then
|
||||||
|
${HC_BIN} --fix-symlinks || print -u2 "WARN: updating symlinks failed"
|
||||||
|
else
|
||||||
|
print -u2 "ERROR: could not locate or excute the HC main script (${HC_BIN})"
|
||||||
|
fi
|
||||||
|
|
||||||
|
print "INFO: finished post-install script"
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# END of script
|
||||||
|
#******************************************************************************
|
@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env ksh
|
||||||
|
#******************************************************************************
|
||||||
|
# @(#) post-remove script for HC-PLATFORM SD package
|
||||||
|
#******************************************************************************
|
||||||
|
# @(#) Copyright (C) 2014 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it and/or modify
|
||||||
|
# it under the same terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
||||||
|
#******************************************************************************
|
||||||
|
|
||||||
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
|
# location of check_health.sh
|
||||||
|
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||||
|
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||||
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
|
||||||
|
print "INFO: starting post-remove script ..."
|
||||||
|
|
||||||
|
# refresh symbolic FPATH links
|
||||||
|
if [[ -x ${HC_BIN} ]]
|
||||||
|
then
|
||||||
|
${HC_BIN} --fix-symlinks || print -u2 "WARN: updating symlinks failed"
|
||||||
|
else
|
||||||
|
print -u2 "ERROR: could not locate or excute the HC main script (${HC_BIN})"
|
||||||
|
fi
|
||||||
|
|
||||||
|
print "INFO: finished post-remove script"
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# END of script
|
||||||
|
#******************************************************************************
|
@ -0,0 +1,33 @@
|
|||||||
|
# -- post-install --
|
||||||
|
post_install() {
|
||||||
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
|
# location of check_health.sh
|
||||||
|
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||||
|
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||||
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
echo "INFO: starting post-install script ..."
|
||||||
|
# refresh symbolic FPATH links
|
||||||
|
if [[ -x ${HC_BIN} ]]
|
||||||
|
then
|
||||||
|
${HC_BIN} --fix-symlinks
|
||||||
|
(( $? == 0 )) || echo "WARN: updating symlinks failed"
|
||||||
|
fi
|
||||||
|
echo "INFO: finished post-install script"
|
||||||
|
}
|
||||||
|
|
||||||
|
# -- post-remove --
|
||||||
|
post_remove() {
|
||||||
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
|
# location of check_health.sh
|
||||||
|
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||||
|
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||||
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
echo "INFO: starting post-uninstall script ..."
|
||||||
|
# refresh symbolic FPATH links
|
||||||
|
if [[ -x ${HC_BIN} ]]
|
||||||
|
then
|
||||||
|
${HC_BIN} --fix-symlinks
|
||||||
|
(( $? == 0 )) || echo "WARN: updating symlinks failed"
|
||||||
|
fi
|
||||||
|
echo "INFO: finished post-uninstall script"
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
# Maintainer: Patrick Van der Veken <patrick@kudos.be>
|
||||||
|
|
||||||
|
_pkgname="check_health"
|
||||||
|
pkgname="hc-serviceguard-platform"
|
||||||
|
pkgver="%BUILD_DATE%"
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="The KUDOS Health Checker (HC) for UNIX (Serviceguard plugins)"
|
||||||
|
arch=("any")
|
||||||
|
url="https://github.com/patvdv/${_pkgname}"
|
||||||
|
license=('GPL3')
|
||||||
|
makedepends=('git')
|
||||||
|
depends=('hc-linux')
|
||||||
|
source=("${_pkgname}::git+${url}.git#branch=master")
|
||||||
|
install=".install"
|
||||||
|
sha256sums=('SKIP')
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "${srcdir}/${_pkgname}"
|
||||||
|
install -d -m 755 ${pkgdir}/opt/hc/lib
|
||||||
|
install -d -m 755 ${pkgdir}/opt/hc/lib/platform
|
||||||
|
install -d -m 755 ${pkgdir}/opt/hc/lib/platform/serviceguard
|
||||||
|
install -D -m 755 opt/hc/lib/platform/serviceguard/check_serviceguard_cluster_config.sh ${pkgdir}/opt/hc/lib/platform/serviceguard/check_serviceguard_cluster_config.sh
|
||||||
|
install -D -m 755 opt/hc/lib/platform/serviceguard/check_serviceguard_cluster_status.sh ${pkgdir}/opt/hc/lib/platform/serviceguard/check_serviceguard_cluster_status.sh
|
||||||
|
install -D -m 755 opt/hc/lib/platform/serviceguard/check_serviceguard_package_config.sh ${pkgdir}/opt/hc/lib/platform/serviceguard/check_serviceguard_package_config.sh
|
||||||
|
install -D -m 755 opt/hc/lib/platform/serviceguard/check_serviceguard_package_status.sh ${pkgdir}/opt/hc/lib/platform/serviceguard/check_serviceguard_package_status.sh
|
||||||
|
install -D -m 755 opt/hc/lib/platform/serviceguard/check_serviceguard_qs_status.sh ${pkgdir}/opt/hc/lib/platform/serviceguard/check_serviceguard_qs_status.sh
|
||||||
|
install -d -m 755 ${pkgdir}/etc/opt/hc
|
||||||
|
install -D -m 644 etc/opt/hc/check_serviceguard_cluster_config.conf.dist ${pkgdir}/etc/opt/hc/check_serviceguard_cluster_config.conf.dist
|
||||||
|
install -D -m 644 etc/opt/hc/check_serviceguard_cluster_status.conf.dist ${pkgdir}/etc/opt/hc/check_serviceguard_cluster_status.conf.dist
|
||||||
|
install -D -m 644 etc/opt/hc/check_serviceguard_package_config.conf.dist ${pkgdir}/etc/opt/hc/check_serviceguard_package_config.conf.dist
|
||||||
|
install -D -m 644 etc/opt/hc/check_serviceguard_package_status.conf.dist ${pkgdir}/etc/opt/hc/check_serviceguard_package_status.conf.dist
|
||||||
|
install -d -m 755 ${pkgdir}/etc/opt/hc/core
|
||||||
|
install -d -m 755 ${pkgdir}/etc/opt/hc/core/templates
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
Package: hc-serviceguard-platform
|
||||||
|
Version: %BUILD_DATE%
|
||||||
|
Architecture: all
|
||||||
|
Maintainer: Patrick Van der Veken <patrick@kudos.be>
|
||||||
|
Essential: no
|
||||||
|
Installed-Size: 300
|
||||||
|
Depends: hc-linux
|
||||||
|
Section: tools
|
||||||
|
Priority: extra
|
||||||
|
Description: The KUDOS Health Checker (HC) for UNIX (Serviceguard plugins).
|
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
|
# location of check_health.sh
|
||||||
|
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||||
|
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||||
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
echo "INFO: starting post-install script ..."
|
||||||
|
# debian: reset ownerships
|
||||||
|
chown -R root:root /opt/hc /etc/opt/hc 2>/dev/null
|
||||||
|
# refresh symbolic FPATH links
|
||||||
|
if [[ -x ${HC_BIN} ]]
|
||||||
|
then
|
||||||
|
${HC_BIN} --fix-symlinks
|
||||||
|
(( $? == 0 )) || echo "WARN: updating symlinks failed"
|
||||||
|
fi
|
||||||
|
echo "INFO: finished post-install script"
|
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
|
# location of check_health.sh
|
||||||
|
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||||
|
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||||
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
echo "INFO: starting post-uninstall script ..."
|
||||||
|
# refresh symbolic FPATH links
|
||||||
|
if [[ -x ${HC_BIN} ]]
|
||||||
|
then
|
||||||
|
${HC_BIN} --fix-symlinks
|
||||||
|
(( $? == 0 )) || echo "WARN: updating symlinks failed"
|
||||||
|
fi
|
||||||
|
echo "INFO: finished post-uninstall script"
|
93
build/serviceguard/linux/SPECS/hc-serviceguard-platform.spec
Normal file
93
build/serviceguard/linux/SPECS/hc-serviceguard-platform.spec
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
%define build_timestamp %(date +"%Y%m%d")
|
||||||
|
|
||||||
|
Name: hc-serviceguard-platform
|
||||||
|
Version: %{build_timestamp}
|
||||||
|
Release: 1
|
||||||
|
|
||||||
|
Summary: The KUDOS Health Checker (HC) for UNIX (Serviceguard plugins)
|
||||||
|
Group: Tools/Monitoring
|
||||||
|
|
||||||
|
License: GNU General Public License either version 2 of the License, or (at your option) any later version
|
||||||
|
URL: http://www.kudos.be
|
||||||
|
|
||||||
|
Requires: ksh,hc-linux
|
||||||
|
BuildArch: noarch
|
||||||
|
BuildRoot: %{_topdir}/%{name}-%{version}-root
|
||||||
|
|
||||||
|
%description
|
||||||
|
The Health Checker is collection of scripts (plugins) designed to perform regular - but not intensive - health checks on UNIX/Linux systems. It provides plugins for AIX, HP-UX and Linux as well customer specific checks. Checks may include topics such file system mounts, process checks, file consistency etc.
|
||||||
|
This package contains Serviceguard platform specific plugins.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
|
||||||
|
%build
|
||||||
|
|
||||||
|
%install
|
||||||
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
install -d -m 755 $RPM_BUILD_ROOT/opt/hc/lib
|
||||||
|
install -d -m 755 $RPM_BUILD_ROOT/opt/hc/lib/platform
|
||||||
|
install -d -m 755 $RPM_BUILD_ROOT/opt/hc/lib/platform/serviceguard
|
||||||
|
cp ../SOURCES/opt/hc/lib/platform/serviceguard/check_serviceguard_cluster_config.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/serviceguard/check_serviceguard_cluster_config.sh
|
||||||
|
cp ../SOURCES/opt/hc/lib/platform/serviceguard/check_serviceguard_cluster_status.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/serviceguard/check_serviceguard_cluster_status.sh
|
||||||
|
cp ../SOURCES/opt/hc/lib/platform/serviceguard/check_serviceguard_package_config.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/serviceguard/check_serviceguard_package_config.sh
|
||||||
|
cp ../SOURCES/opt/hc/lib/platform/serviceguard/check_serviceguard_package_status.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/serviceguard/check_serviceguard_package_status.sh
|
||||||
|
cp ../SOURCES/opt/hc/lib/platform/serviceguard/check_serviceguard_qs_status.sh $RPM_BUILD_ROOT/opt/hc/lib/platform/serviceguard/check_serviceguard_qs_status.sh
|
||||||
|
install -d -m 755 $RPM_BUILD_ROOT/etc/opt/hc
|
||||||
|
cp ../SOURCES/etc/opt/hc/check_serviceguard_cluster_config.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/check_serviceguard_cluster_config.conf.dist
|
||||||
|
cp ../SOURCES/etc/opt/hc/check_serviceguard_cluster_status.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/check_serviceguard_cluster_status.conf.dist
|
||||||
|
cp ../SOURCES/etc/opt/hc/check_serviceguard_package_config.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/check_serviceguard_package_config.conf.dist
|
||||||
|
cp ../SOURCES/etc/opt/hc/check_serviceguard_package_status.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/check_serviceguard_package_status.conf.dist
|
||||||
|
install -d -m 755 $RPM_BUILD_ROOT/etc/opt/hc/core
|
||||||
|
install -d -m 755 $RPM_BUILD_ROOT/etc/opt/hc/core/templates
|
||||||
|
|
||||||
|
%post
|
||||||
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
|
# location of check_health.sh
|
||||||
|
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||||
|
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||||
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
echo "INFO: starting post-install script ..."
|
||||||
|
# refresh symbolic FPATH links
|
||||||
|
if [[ -x ${HC_BIN} ]]
|
||||||
|
then
|
||||||
|
${HC_BIN} --fix-symlinks
|
||||||
|
(( $? == 0 )) || echo "WARN: updating symlinks failed"
|
||||||
|
fi
|
||||||
|
echo "INFO: finished post-install script"
|
||||||
|
|
||||||
|
%postun
|
||||||
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
|
# location of check_health.sh
|
||||||
|
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||||
|
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||||
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
echo "INFO: starting post-uninstall script ..."
|
||||||
|
# refresh symbolic FPATH links
|
||||||
|
if [[ -x ${HC_BIN} ]]
|
||||||
|
then
|
||||||
|
${HC_BIN} --fix-symlinks
|
||||||
|
(( $? == 0 )) || echo "WARN: updating symlinks failed"
|
||||||
|
fi
|
||||||
|
echo "INFO: finished post-uninstall script"
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr(-,root,root,755)
|
||||||
|
%dir /opt/hc/lib
|
||||||
|
%dir /opt/hc/lib/platform
|
||||||
|
%dir /opt/hc/lib/platform/serviceguard
|
||||||
|
%attr(755, root, root) /opt/hc/lib/platform/serviceguard/check_serviceguard_cluster_config.sh
|
||||||
|
%attr(755, root, root) /opt/hc/lib/platform/serviceguard/check_serviceguard_cluster_status.sh
|
||||||
|
%attr(755, root, root) /opt/hc/lib/platform/serviceguard/check_serviceguard_package_config.sh
|
||||||
|
%attr(755, root, root) /opt/hc/lib/platform/serviceguard/check_serviceguard_package_status.sh
|
||||||
|
%attr(755, root, root) /opt/hc/lib/platform/serviceguard/check_serviceguard_qs_status.sh
|
||||||
|
%dir /etc/opt/hc
|
||||||
|
%attr(644, root, root) /etc/opt/hc/check_serviceguard_cluster_config.conf.dist
|
||||||
|
%attr(644, root, root) /etc/opt/hc/check_serviceguard_cluster_status.conf.dist
|
||||||
|
%attr(644, root, root) /etc/opt/hc/check_serviceguard_package_config.conf.dist
|
||||||
|
%attr(644, root, root) /etc/opt/hc/check_serviceguard_package_status.conf.dist
|
||||||
|
%dir /etc/opt/hc/core
|
||||||
|
%dir /etc/opt/hc/core/templates
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Sa Apr 20 2019 <patrick@kudos.be> - 0.0.1
|
||||||
|
- Initial build
|
53
build/serviceguard/linux/hc_build_linux_rpms.sh
Normal file
53
build/serviceguard/linux/hc_build_linux_rpms.sh
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/env ksh
|
||||||
|
#******************************************************************************
|
||||||
|
# @(#) build script for HC RPM packages (uses 'rpmbuild')
|
||||||
|
#******************************************************************************
|
||||||
|
# @(#) Copyright (C) 2014 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it and/or modify
|
||||||
|
# it under the same terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
||||||
|
#******************************************************************************
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# Requires following build (dir) structures:
|
||||||
|
#
|
||||||
|
# hc_build_linux_rpms.sh
|
||||||
|
# BUILD/
|
||||||
|
# BUILDROOT/
|
||||||
|
# RPMS/
|
||||||
|
# SOURCES/opt/
|
||||||
|
# SOURCES/opt/hc/bin/<hc_scripts>
|
||||||
|
# SOURCES/opt/hc/lib/*/<hc_plugins>
|
||||||
|
# SOURCES/etc/opt/hc/<hc_configs>
|
||||||
|
# SPECS/<spec_files>
|
||||||
|
# SRPMS/
|
||||||
|
#
|
||||||
|
# Build order:
|
||||||
|
# 1) Copy sources/scripts to the correct locations
|
||||||
|
# 2) Copy template, build and installer script files into correct locations
|
||||||
|
# 3) Execute hc_build_linux_rpms.sh
|
||||||
|
# 4) RPM packages may be found in the RPMS directory
|
||||||
|
#******************************************************************************
|
||||||
|
|
||||||
|
BUILD_DIR="$(dirname $0)"
|
||||||
|
|
||||||
|
# clean up previous packages
|
||||||
|
rm -f ${BUILD_DIR}/RPMS/*/* >/dev/null
|
||||||
|
|
||||||
|
# build main packages
|
||||||
|
rpmbuild -bb ${BUILD_DIR}/SPECS/hc-serviceguard-platform.spec
|
||||||
|
|
||||||
|
print "List of built packages:"
|
||||||
|
ls -l ${BUILD_DIR}/RPMS/*/*
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# END of script
|
||||||
|
#******************************************************************************
|
24
etc/opt/hc/check_clusterware_resource_config.conf.dist
Normal file
24
etc/opt/hc/check_clusterware_resource_config.conf.dist
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#******************************************************************************
|
||||||
|
# @(#) check_clusterware_resource_config.conf
|
||||||
|
#******************************************************************************
|
||||||
|
# This is a configuration file for the check_clusterware_resource_config HC plugin.
|
||||||
|
# All lines starting with a '#' are comment lines.
|
||||||
|
# [default: indicates hardcoded script values if no value is defined here]
|
||||||
|
#******************************************************************************
|
||||||
|
|
||||||
|
# specify whether to also log passed health checks
|
||||||
|
# (warning: this may rapidly grow the HC log)
|
||||||
|
# [default: no]
|
||||||
|
log_healthy="no"
|
||||||
|
|
||||||
|
# stanza(s) of resource definitions (case sensitive).
|
||||||
|
# Example:
|
||||||
|
#[myresource]
|
||||||
|
#NAME=myresource
|
||||||
|
#TYPE=cluster_resource
|
||||||
|
#ACL=owner:root:rwx,pgrp:root:r-x,other::r--,user:oracle:r-x
|
||||||
|
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# End of FILE
|
||||||
|
#******************************************************************************
|
26
etc/opt/hc/check_clusterware_resource_status.conf.dist
Normal file
26
etc/opt/hc/check_clusterware_resource_status.conf.dist
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#******************************************************************************
|
||||||
|
# @(#) check_clusterware_resource_status.conf
|
||||||
|
#******************************************************************************
|
||||||
|
# This is a configuration file for the check_clusterware_resource_status HC plugin.
|
||||||
|
# All lines starting with a '#' are comment lines.
|
||||||
|
# [default: indicates hardcoded script values if no value is defined here]
|
||||||
|
#******************************************************************************
|
||||||
|
|
||||||
|
# specify whether to also log passed health checks
|
||||||
|
# (warning: this may rapidly grow the HC log)
|
||||||
|
# [default: no]
|
||||||
|
log_healthy="no"
|
||||||
|
|
||||||
|
# list of required resource statuses
|
||||||
|
# Format:
|
||||||
|
# crs:<resource_name>:<*|node>=<ONLINE|OFFLINE>,<*|node>=<ONLINE|OFFLINE>,...
|
||||||
|
# Note: ONLINE definitions must precede OFFLINE definitions (if used)
|
||||||
|
# Examples:
|
||||||
|
#crs:res1:node1=ONLINE
|
||||||
|
#crs:res2:*=ONLINE
|
||||||
|
#crs:res3:node1=ONLINE,node2=OFFLINE
|
||||||
|
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# End of FILE
|
||||||
|
#******************************************************************************
|
@ -1,16 +0,0 @@
|
|||||||
#******************************************************************************
|
|
||||||
# @(#) check_hpux_sg_cluster_config.conf
|
|
||||||
#******************************************************************************
|
|
||||||
# This is a configuration file for the check_hpux_sg_cluster_config HC plugin.
|
|
||||||
# All lines starting with a '#' are comment lines.
|
|
||||||
# It is recommended to only monitor unique "param1 value2" combinations
|
|
||||||
#******************************************************************************
|
|
||||||
|
|
||||||
#[mycluster]
|
|
||||||
#param1 value1
|
|
||||||
#param2 value2
|
|
||||||
|
|
||||||
|
|
||||||
#******************************************************************************
|
|
||||||
# End of FILE
|
|
||||||
#******************************************************************************
|
|
@ -1,20 +0,0 @@
|
|||||||
#******************************************************************************
|
|
||||||
# @(#) check_hpux_sg_package_config.conf
|
|
||||||
#******************************************************************************
|
|
||||||
# This is a configuration file for the check_hpux_sg_package_config HC plugin.
|
|
||||||
# All lines starting with a '#' are comment lines.
|
|
||||||
# It is recommended to only monitor unique "param1 value2" combinations
|
|
||||||
#******************************************************************************
|
|
||||||
|
|
||||||
#[mypkg1]
|
|
||||||
#param1 value1
|
|
||||||
#param2 value2
|
|
||||||
|
|
||||||
#[mypkg2]
|
|
||||||
#param1 value1
|
|
||||||
#param2 value2
|
|
||||||
|
|
||||||
|
|
||||||
#******************************************************************************
|
|
||||||
# End of FILE
|
|
||||||
#******************************************************************************
|
|
@ -1,16 +0,0 @@
|
|||||||
#******************************************************************************
|
|
||||||
# @(#) check_linux_sg_cluster_config.conf
|
|
||||||
#******************************************************************************
|
|
||||||
# This is a configuration file for the check_linux_sg_cluster_config HC plugin.
|
|
||||||
# All lines starting with a '#' are comment lines.
|
|
||||||
# It is recommended to only monitor unique "param1 value2" combinations
|
|
||||||
#******************************************************************************
|
|
||||||
|
|
||||||
#[mycluster]
|
|
||||||
#param1 value1
|
|
||||||
#param2 value2
|
|
||||||
|
|
||||||
|
|
||||||
#******************************************************************************
|
|
||||||
# End of FILE
|
|
||||||
#******************************************************************************
|
|
@ -1,20 +0,0 @@
|
|||||||
#******************************************************************************
|
|
||||||
# @(#) check_linux_sg_package_config.conf
|
|
||||||
#******************************************************************************
|
|
||||||
# This is a configuration file for the check_linux_sg_package_config HC plugin.
|
|
||||||
# All lines starting with a '#' are comment lines.
|
|
||||||
# It is recommended to only monitor unique "param1 value2" combinations
|
|
||||||
#******************************************************************************
|
|
||||||
|
|
||||||
#[mypkg1]
|
|
||||||
#param1 value1
|
|
||||||
#param2 value2
|
|
||||||
|
|
||||||
#[mypkg2]
|
|
||||||
#param1 value1
|
|
||||||
#param2 value2
|
|
||||||
|
|
||||||
|
|
||||||
#******************************************************************************
|
|
||||||
# End of FILE
|
|
||||||
#******************************************************************************
|
|
@ -1,7 +1,7 @@
|
|||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
# @(#) check_hpux_sg_cluster_status.conf
|
# @(#) check_serviceguard_cluster_config.conf
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
# This is a configuration file for the check_hpux_sg_cluster_status HC plugin.
|
# This is a configuration file for the check_serviceguard_cluster_config HC plugin.
|
||||||
# All lines starting with a '#' are comment lines.
|
# All lines starting with a '#' are comment lines.
|
||||||
# [default: indicates hardcoded script values if no value is defined here]
|
# [default: indicates hardcoded script values if no value is defined here]
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
@ -9,13 +9,12 @@
|
|||||||
# specify whether to also log passed health checks
|
# specify whether to also log passed health checks
|
||||||
# (warning: this may rapidly grow the HC log)
|
# (warning: this may rapidly grow the HC log)
|
||||||
# [default: no]
|
# [default: no]
|
||||||
log_healthy="no"
|
log_healthy="yes"
|
||||||
|
|
||||||
# list of required cluster statuses
|
|
||||||
# Format:
|
|
||||||
# sg:<parameter>=<value>
|
|
||||||
# Examples:
|
# Examples:
|
||||||
#sg:status=up
|
#[mycluster]
|
||||||
|
#param1 value1
|
||||||
|
#param2 value2
|
||||||
|
|
||||||
|
|
||||||
#******************************************************************************
|
#******************************************************************************
|
@ -1,7 +1,7 @@
|
|||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
# @(#) check_linux_sg_cluster_status.conf
|
# @(#) check_serviceguard_cluster_status.conf
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
# This is a configuration file for the check_linux_sg_cluster_status HC plugin.
|
# This is a configuration file for the check_serviceguard_cluster_status HC plugin.
|
||||||
# All lines starting with a '#' are comment lines.
|
# All lines starting with a '#' are comment lines.
|
||||||
# [default: indicates hardcoded script values if no value is defined here]
|
# [default: indicates hardcoded script values if no value is defined here]
|
||||||
#******************************************************************************
|
#******************************************************************************
|
@ -1,7 +1,7 @@
|
|||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
# @(#) check_hpux_sg_package_status.conf
|
# @(#) check_serviceguard_package_config.conf
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
# This is a configuration file for the check_hpux_sg_package_status HC plugin.
|
# This is a configuration file for the check_serviceguard_package_config HC plugin.
|
||||||
# All lines starting with a '#' are comment lines.
|
# All lines starting with a '#' are comment lines.
|
||||||
# [default: indicates hardcoded script values if no value is defined here]
|
# [default: indicates hardcoded script values if no value is defined here]
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
@ -9,13 +9,16 @@
|
|||||||
# specify whether to also log passed health checks
|
# specify whether to also log passed health checks
|
||||||
# (warning: this may rapidly grow the HC log)
|
# (warning: this may rapidly grow the HC log)
|
||||||
# [default: no]
|
# [default: no]
|
||||||
log_healthy="no"
|
log_healthy="yes"
|
||||||
|
|
||||||
# list of required package statuses
|
|
||||||
# Format:
|
|
||||||
# sg:<package_name>:<parameter>=<value>
|
|
||||||
# Examples:
|
# Examples:
|
||||||
#sg:my_package:status=up
|
#[mypkg1]
|
||||||
|
#param1 value1
|
||||||
|
#param2 value2
|
||||||
|
|
||||||
|
#[mypkg2]
|
||||||
|
#param1 value1
|
||||||
|
#param2 value2
|
||||||
|
|
||||||
|
|
||||||
#******************************************************************************
|
#******************************************************************************
|
@ -30,7 +30,7 @@
|
|||||||
# RETURNS: 0
|
# RETURNS: 0
|
||||||
function version_include_data
|
function version_include_data
|
||||||
{
|
{
|
||||||
typeset _VERSION="2019-03-16" # YYYY-MM-DD
|
typeset _VERSION="2019-04-20" # YYYY-MM-DD
|
||||||
|
|
||||||
print "INFO: $0: ${_VERSION#version_*}"
|
print "INFO: $0: ${_VERSION#version_*}"
|
||||||
|
|
||||||
@ -80,6 +80,38 @@ print -R "${1%?}" 2>/dev/null
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# @(#) FUNCTION: data_get_length_string()
|
||||||
|
# DOES: get length of a string
|
||||||
|
# EXPECTS: string
|
||||||
|
# OUTPUTS: length of string [integer]
|
||||||
|
# RETURNS: 0
|
||||||
|
# REQUIRES: n/a
|
||||||
|
function data_get_length_string
|
||||||
|
{
|
||||||
|
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
|
||||||
|
|
||||||
|
print -R "${#1}" 2>/dev/null
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# @(#) FUNCTION: data_get_substring()
|
||||||
|
# DOES: get a substring of a string
|
||||||
|
# EXPECTS: $1=string; $2=length of substring [integer]
|
||||||
|
# OUTPUTS: substring [string]
|
||||||
|
# RETURNS: 0
|
||||||
|
# REQUIRES: n/a
|
||||||
|
function data_get_substring
|
||||||
|
{
|
||||||
|
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
|
||||||
|
|
||||||
|
print -R "${1}" | cut -f1-${2} 2>/dev/null
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# @(#) FUNCTION: data_contains_string()
|
# @(#) FUNCTION: data_contains_string()
|
||||||
# DOES: checks if a string (haystack) contains a substring (needle).
|
# DOES: checks if a string (haystack) contains a substring (needle).
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
function notify_mail
|
function notify_mail
|
||||||
{
|
{
|
||||||
# ------------------------- CONFIGURATION starts here -------------------------
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
typeset _VERSION="2019-03-16" # YYYY-MM-DD
|
typeset _VERSION="2019-04-20" # YYYY-MM-DD
|
||||||
typeset _SUPPORTED_PLATFORMS="AIX,HP-UX,Linux" # uname -s match
|
typeset _SUPPORTED_PLATFORMS="AIX,HP-UX,Linux" # uname -s match
|
||||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
|
||||||
@ -130,6 +130,7 @@ fi
|
|||||||
eval "cat << __EOT
|
eval "cat << __EOT
|
||||||
$(sed 's/[\$`]/\\&/g;s/<## @\([^ ]*\) ##>/${\1}/g' <${_MAIL_HEADER_TPL})
|
$(sed 's/[\$`]/\\&/g;s/<## @\([^ ]*\) ##>/${\1}/g' <${_MAIL_HEADER_TPL})
|
||||||
__EOT" >>${_TMP1_MAIL_FILE}
|
__EOT" >>${_TMP1_MAIL_FILE}
|
||||||
|
print "" >>${_TMP1_MAIL_FILE}
|
||||||
|
|
||||||
# create body part (from $HC_MSG_VAR)
|
# create body part (from $HC_MSG_VAR)
|
||||||
print "${HC_MSG_VAR}" | while IFS=${MSG_SEP} read _MAIL_MSG_STC _ _MAIL_MSG_TEXT _MAIL_MSG_CUR_VAL _MAIL_MSG_EXP_VAL
|
print "${HC_MSG_VAR}" | while IFS=${MSG_SEP} read _MAIL_MSG_STC _ _MAIL_MSG_TEXT _MAIL_MSG_CUR_VAL _MAIL_MSG_EXP_VAL
|
||||||
@ -175,6 +176,7 @@ done
|
|||||||
eval "cat << __EOT
|
eval "cat << __EOT
|
||||||
$(sed 's/[\$`]/\\&/g;s/<## @\([^ ]*\) ##>/${\1}/g' <${_MAIL_BODY_TPL})
|
$(sed 's/[\$`]/\\&/g;s/<## @\([^ ]*\) ##>/${\1}/g' <${_MAIL_BODY_TPL})
|
||||||
__EOT" >>${_TMP1_MAIL_FILE}
|
__EOT" >>${_TMP1_MAIL_FILE}
|
||||||
|
print "" >>${_TMP1_MAIL_FILE}
|
||||||
|
|
||||||
# HC STDOUT log? (drop the .$$ bit)
|
# HC STDOUT log? (drop the .$$ bit)
|
||||||
_MAIL_STDOUT_LOG="${EVENTS_DIR}/${DIR_PREFIX}/${_MAIL_FAIL_ID}/${_HC_STDOUT_LOG_SHORT%.*}"
|
_MAIL_STDOUT_LOG="${EVENTS_DIR}/${DIR_PREFIX}/${_MAIL_FAIL_ID}/${_HC_STDOUT_LOG_SHORT%.*}"
|
||||||
|
@ -0,0 +1,236 @@
|
|||||||
|
#!/usr/bin/env ksh
|
||||||
|
#******************************************************************************
|
||||||
|
# @(#) check_clusterware_resource_config
|
||||||
|
#******************************************************************************
|
||||||
|
# @(#) Copyright (C) 2019 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it and/or modify
|
||||||
|
# it under the same terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
||||||
|
#******************************************************************************
|
||||||
|
#
|
||||||
|
# DOCUMENTATION (MAIN)
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# @(#) MAIN: check_clusterware_resource_config
|
||||||
|
# DOES: see _show_usage()
|
||||||
|
# EXPECTS: see _show_usage()
|
||||||
|
# REQUIRES: data_comma2space(), dump_logs(), init_hc(), log_hc(), warn()
|
||||||
|
#
|
||||||
|
# @(#) HISTORY:
|
||||||
|
# @(#) 2019-04-20: merged HP-UX+Linux version + fixes [Patrick Van der Veken]
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
||||||
|
#******************************************************************************
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
function check_clusterware_resource_config
|
||||||
|
{
|
||||||
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
|
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
||||||
|
typeset _VERSION="2019-04-20" # YYYY-MM-DD
|
||||||
|
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
|
||||||
|
typeset _MAX_LENGTH_VALUE_STRING=30
|
||||||
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
|
||||||
|
# set defaults
|
||||||
|
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
|
||||||
|
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
|
||||||
|
typeset _ARGS=$(data_comma2space "$*")
|
||||||
|
typeset _ARG=""
|
||||||
|
typeset _MSG=""
|
||||||
|
typeset _STC=0
|
||||||
|
typeset _CFG_HEALTHY=""
|
||||||
|
typeset _LOG_HEALTHY=0
|
||||||
|
typeset _CRSCTL_BIN=""
|
||||||
|
typeset _RES_RUN_FILE="${TMP_DIR}/.$0.res_run.$$"
|
||||||
|
typeset _RES_CFG_FILE="${TMP_DIR}/.$0.res_cfg.$$"
|
||||||
|
typeset _RES_INSTANCE=""
|
||||||
|
typeset _RES_INSTANCES=""
|
||||||
|
typeset _RES_CFG_ENTRY=""
|
||||||
|
typeset _RES_ENTRY=""
|
||||||
|
typeset _RES_MATCH=""
|
||||||
|
typeset _RES_PARAM=""
|
||||||
|
typeset _RES_VALUE=""
|
||||||
|
|
||||||
|
# handle arguments (originally comma-separated)
|
||||||
|
for _ARG in ${_ARGS}
|
||||||
|
do
|
||||||
|
case "${_ARG}" in
|
||||||
|
help)
|
||||||
|
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# set local trap for cleanup
|
||||||
|
# shellcheck disable=SC2064
|
||||||
|
trap "rm -f ${_RES_RUN_FILE}.* ${_RES_CFG_FILE}.* >/dev/null 2>&1; return 1" 1 2 3 15
|
||||||
|
|
||||||
|
# handle configuration file
|
||||||
|
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
|
||||||
|
if [[ ! -r ${_CONFIG_FILE} ]]
|
||||||
|
then
|
||||||
|
warn "unable to read configuration file at ${_CONFIG_FILE}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
_CFG_HEALTHY=$(_CONFIG_FILE="${_CONFIG_FILE}" data_get_lvalue_from_config 'log_healthy')
|
||||||
|
case "${_CFG_HEALTHY}" in
|
||||||
|
yes|YES|Yes)
|
||||||
|
_LOG_HEALTHY=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# do not override hc_arg
|
||||||
|
(( _LOG_HEALTHY > 0 )) || _LOG_HEALTHY=0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# log_healthy
|
||||||
|
(( ARG_LOG_HEALTHY > 0 )) && _LOG_HEALTHY=1
|
||||||
|
if (( _LOG_HEALTHY > 0 ))
|
||||||
|
then
|
||||||
|
if (( ARG_LOG > 0 ))
|
||||||
|
then
|
||||||
|
log "logging/showing passed health checks"
|
||||||
|
else
|
||||||
|
log "showing passed health checks (but not logging)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log "not logging/showing passed health checks"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# look for resource instance names
|
||||||
|
grep -E -e '^\[' ${_CONFIG_FILE} 2>/dev/null | cut -f1 -d']' 2>/dev/null | cut -f2 -d'[' 2>/dev/null |\
|
||||||
|
while read _RES_INSTANCE
|
||||||
|
do
|
||||||
|
_RES_INSTANCES="${_RES_INSTANCES} ${_RES_INSTANCE}"
|
||||||
|
done
|
||||||
|
if [[ -z "${_RES_INSTANCES}" ]]
|
||||||
|
then
|
||||||
|
warn "no resource information configured in ${_CONFIG_FILE}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# get resource information from crsctl
|
||||||
|
_CRSCTL_BIN="$(command -v crsctl 2>>${HC_STDERR_LOG})"
|
||||||
|
if [[ -z "${_CRSCTL_BIN}" || ! -x ${_CRSCTL_BIN} ]]
|
||||||
|
then
|
||||||
|
warn "CRS {crsctl} is not installed here"
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
for _RES_INSTANCE in ${_RES_INSTANCES}
|
||||||
|
do
|
||||||
|
crsctl status resource ${_RES_INSTANCE} -f 2>>${HC_STDERR_LOG} |\
|
||||||
|
tr -d ' \t' >${_RES_RUN_FILE}.${_RES_INSTANCE} 2>/dev/null
|
||||||
|
[[ -s ${_RES_RUN_FILE}.${_RES_INSTANCE} ]] || {
|
||||||
|
_MSG="unable to gather configuration cluster resource ${_RES_INSTANCE}"
|
||||||
|
log_hc "$0" 1 "${_MSG}"
|
||||||
|
# dump debug info
|
||||||
|
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# gather resource information from healthcheck configuration
|
||||||
|
for _RES_INSTANCE in ${_RES_INSTANCES}
|
||||||
|
do
|
||||||
|
awk -v resource="${_RES_INSTANCE}" '
|
||||||
|
# double escape []
|
||||||
|
BEGIN { found = 0; needle = "^\\["resource"\\]$" }
|
||||||
|
|
||||||
|
# skip blank lines
|
||||||
|
/^\s*$/ { next; }
|
||||||
|
# skip comment lines
|
||||||
|
/^#/ { next; }
|
||||||
|
|
||||||
|
# end marker
|
||||||
|
( $0 ~ /^\[.*\]$/ && found ) {
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
# start marker
|
||||||
|
$0 ~ needle {
|
||||||
|
found = 1;
|
||||||
|
};
|
||||||
|
# stanza body
|
||||||
|
( found && $0 !~ /^\[.*\]$/ ) {
|
||||||
|
# print non-compressed and compressed version
|
||||||
|
printf "%s|", $0;
|
||||||
|
gsub(" |\t", "", $0);
|
||||||
|
printf "%s\n", $0;
|
||||||
|
}' < ${_CONFIG_FILE} 2>>${HC_STDERR_LOG} >${_RES_CFG_FILE}.${_RES_INSTANCE}
|
||||||
|
done
|
||||||
|
|
||||||
|
# do resource configuration checks (using the compressed strings)
|
||||||
|
for _RES_INSTANCE in ${_RES_INSTANCES}
|
||||||
|
do
|
||||||
|
while read _RES_ENTRY
|
||||||
|
do
|
||||||
|
# split entry to get the compressed version
|
||||||
|
_RES_CFG_ENTRY=$(print "${_RES_ENTRY}" | cut -f2 -d'|' 2>/dev/null)
|
||||||
|
# get parameter name from non-compressed version
|
||||||
|
_RES_PARAM=$(print "${_RES_ENTRY}" | cut -f1 -d'|' 2>/dev/null | cut -f1 -d'=' 2>/dev/null)
|
||||||
|
# get parameter value from non-compressed version
|
||||||
|
_RES_VALUE=$(print "${_RES_ENTRY}" | cut -f1 -d'|' 2>/dev/null | cut -f2 -d'=' 2>/dev/null)
|
||||||
|
# is it present?
|
||||||
|
_RES_MATCH=$(grep -c "${_RES_CFG_ENTRY}" ${_RES_RUN_FILE}.${_RES_INSTANCE} 2>/dev/null)
|
||||||
|
|
||||||
|
# chop value if needed
|
||||||
|
if (( $(data_get_length_string "${_RES_VALUE}") > _MAX_LENGTH_VALUE_STRING ))
|
||||||
|
then
|
||||||
|
_RES_VALUE=$(data_get_substring "${_RES_VALUE}" ${_MAX_LENGTH_VALUE_STRING})
|
||||||
|
_RES_VALUE="${_RES_VALUE} ..."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# find match between active and desired state?
|
||||||
|
if (( _RES_MATCH == 0 ))
|
||||||
|
then
|
||||||
|
# get parameter name from non-compressed version
|
||||||
|
_MSG="'${_RES_PARAM}' (${_RES_VALUE}) is not correctly configured for ${_RES_INSTANCE}"
|
||||||
|
_STC=1
|
||||||
|
else
|
||||||
|
_MSG="'${_RES_PARAM}' (${_RES_VALUE}) is configured for ${_RES_INSTANCE}"
|
||||||
|
fi
|
||||||
|
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||||
|
then
|
||||||
|
log_hc "$0" ${_STC} "${_MSG}"
|
||||||
|
_STC=0
|
||||||
|
fi
|
||||||
|
done <${_RES_CFG_FILE}.${_RES_INSTANCE}
|
||||||
|
|
||||||
|
# add crsctl output to stdout log
|
||||||
|
print "==== {${_CRSCTL_BIN} status resource ${_RES_INSTANCE} -f} ====" >>${HC_STDOUT_LOG}
|
||||||
|
cat "${_RES_CFG_FILE}.${_RES_INSTANCE}" >>${HC_STDOUT_LOG}
|
||||||
|
done
|
||||||
|
|
||||||
|
# do cleanup
|
||||||
|
rm -f ${_RES_RUN_FILE}.* ${_RES_CFG_FILE}.* >/dev/null 2>&1
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
function _show_usage
|
||||||
|
{
|
||||||
|
cat <<- EOT
|
||||||
|
NAME : $1
|
||||||
|
VERSION : $2
|
||||||
|
CONFIG : $3 with parameters:
|
||||||
|
log_healthy=<yes|no>
|
||||||
|
and formatted stanzas for resource definitions
|
||||||
|
PURPOSE : Checks the configuration of Clusterware resources (parameters/values)
|
||||||
|
(comparing serialized strings from the HC configuration file to the
|
||||||
|
active cluster configuration)
|
||||||
|
|
||||||
|
EOT
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# END of script
|
||||||
|
#******************************************************************************
|
@ -0,0 +1,217 @@
|
|||||||
|
#!/usr/bin/env ksh
|
||||||
|
#******************************************************************************
|
||||||
|
# @(#) check_clusterware_resource_status
|
||||||
|
#******************************************************************************
|
||||||
|
# @(#) Copyright (C) 2019 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
||||||
|
#
|
||||||
|
# This program is a free software; you can redistribute it and/or modify
|
||||||
|
# it under the same terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
||||||
|
#******************************************************************************
|
||||||
|
#
|
||||||
|
# DOCUMENTATION (MAIN)
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# @(#) MAIN: check_clusterware_resource_status
|
||||||
|
# DOES: see _show_usage()
|
||||||
|
# EXPECTS: see _show_usage()
|
||||||
|
# REQUIRES: data_comma2space(), data_contains_string(), data_uc(), dump_logs(),
|
||||||
|
# init_hc(), log_hc(), warn()
|
||||||
|
#
|
||||||
|
# @(#) HISTORY:
|
||||||
|
# @(#) 2019-04-20: merged HP-UX+Linux version [Patrick Van der Veken]
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
||||||
|
#******************************************************************************
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
function check_clusterware_resource_status
|
||||||
|
{
|
||||||
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
|
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
||||||
|
typeset _VERSION="2019-04-20" # YYYY-MM-DD
|
||||||
|
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
|
||||||
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
|
||||||
|
# set defaults
|
||||||
|
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
|
||||||
|
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
|
||||||
|
typeset _ARGS=$(data_comma2space "$*")
|
||||||
|
typeset _ARG=""
|
||||||
|
typeset _MSG=""
|
||||||
|
typeset _STC=0
|
||||||
|
typeset _CFG_HEALTHY=""
|
||||||
|
typeset _LOG_HEALTHY=0
|
||||||
|
typeset _CRS_HOST=""
|
||||||
|
typeset _CRS_NEEDLE=""
|
||||||
|
typeset _CRS_RESOURCE=""
|
||||||
|
typeset _CRS_STATES=""
|
||||||
|
typeset _CRS_STATE=""
|
||||||
|
typeset _CRS_STATES_ENTRY=""
|
||||||
|
typeset _CRS_STATE_ENTRY=""
|
||||||
|
typeset _CRSCTL_BIN=""
|
||||||
|
typeset _CRSCTL_STATUS=""
|
||||||
|
typeset _IS_ONLINE=0
|
||||||
|
typeset _MATCH_RC=0
|
||||||
|
|
||||||
|
# handle arguments (originally comma-separated)
|
||||||
|
for _ARG in ${_ARGS}
|
||||||
|
do
|
||||||
|
case "${_ARG}" in
|
||||||
|
help)
|
||||||
|
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# handle configuration file
|
||||||
|
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
|
||||||
|
if [[ ! -r ${_CONFIG_FILE} ]]
|
||||||
|
then
|
||||||
|
warn "unable to read configuration file at ${_CONFIG_FILE}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
_CFG_HEALTHY=$(_CONFIG_FILE="${_CONFIG_FILE}" data_get_lvalue_from_config 'log_healthy')
|
||||||
|
case "${_CFG_HEALTHY}" in
|
||||||
|
yes|YES|Yes)
|
||||||
|
_LOG_HEALTHY=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# do not override hc_arg
|
||||||
|
(( _LOG_HEALTHY > 0 )) || _LOG_HEALTHY=0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# log_healthy
|
||||||
|
(( ARG_LOG_HEALTHY > 0 )) && _LOG_HEALTHY=1
|
||||||
|
if (( _LOG_HEALTHY > 0 ))
|
||||||
|
then
|
||||||
|
if (( ARG_LOG > 0 ))
|
||||||
|
then
|
||||||
|
log "logging/showing passed health checks"
|
||||||
|
else
|
||||||
|
log "showing passed health checks (but not logging)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log "not logging/showing passed health checks"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check for clusterware
|
||||||
|
_CRSCTL_BIN="$(command -v crsctl 2>>${HC_STDERR_LOG})"
|
||||||
|
if [[ -z "${_CRSCTL_BIN}" || ! -x ${_CRSCTL_BIN} ]]
|
||||||
|
then
|
||||||
|
warn "CRS {crsctl} is not installed here"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# do resource status checks
|
||||||
|
grep -E -e "^crs:" ${_CONFIG_FILE} 2>/dev/null |\
|
||||||
|
while IFS=":" read -r _ _CRS_RESOURCE _CRS_STATES
|
||||||
|
do
|
||||||
|
# get actual resource info
|
||||||
|
(( ARG_DEBUG > 0 )) && debug "checking for resource: ${_CRS_RESOURCE}"
|
||||||
|
_CRSCTL_STATUS=$(crsctl status resource "${_CRS_RESOURCE}" 2>>${HC_STDERR_LOG})
|
||||||
|
if (( $? > 0 )) || [[ -z "${_CRSCTL_STATUS}" ]]
|
||||||
|
then
|
||||||
|
_MSG="unable to run command: {crsctl status resource ${_CRS_RESOURCE}}"
|
||||||
|
log_hc "$0" 1 "${_MSG}"
|
||||||
|
# dump debug info
|
||||||
|
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# loop over host/state entries
|
||||||
|
print "${_CRS_STATES}" | while IFS=',' read -rA _CRS_STATES_ENTRY
|
||||||
|
do
|
||||||
|
_IS_ONLINE=0
|
||||||
|
for _CRS_STATE_ENTRY in "${_CRS_STATES_ENTRY[@]}"
|
||||||
|
do
|
||||||
|
_CRS_HOST=$(print "${_CRS_STATE_ENTRY}" | cut -f1 -d'=' 2>/dev/null)
|
||||||
|
_CRS_STATE=$(print "${_CRS_STATE_ENTRY}" | cut -f2 -d'=' 2>/dev/null)
|
||||||
|
if [[ -z "${_CRS_HOST}" || -z "${_CRS_STATE}" ]]
|
||||||
|
then
|
||||||
|
warn "host/state value(s) for resource ${_CRS_RESOURCE} are/is incorrect in configuration file ${_CONFIG_FILE}"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
(( ARG_DEBUG > 0 )) && debug "checking for host/state: ${_CRS_HOST}/${_CRS_STATE}"
|
||||||
|
|
||||||
|
# get actual resource state
|
||||||
|
CRS_STATE_LINE=$(print "${_CRSCTL_STATUS}" | grep -E -e "^STATE=" 2>/dev/null)
|
||||||
|
|
||||||
|
# set needle (wildcard or host check?)
|
||||||
|
if [[ "${_CRS_HOST}" = "*" ]]
|
||||||
|
then
|
||||||
|
_CRS_NEEDLE=$(data_uc "${_CRS_STATE}")
|
||||||
|
else
|
||||||
|
case "${_CRS_STATE}" in
|
||||||
|
ONLINE|online|Online)
|
||||||
|
_CRS_NEEDLE=$(data_uc "${_CRS_STATE}")
|
||||||
|
_CRS_NEEDLE="${_CRS_NEEDLE} on ${_CRS_HOST}"
|
||||||
|
;;
|
||||||
|
OFFLINE|offline|Offline)
|
||||||
|
_CRS_NEEDLE=$(data_uc "${_CRS_STATE}")
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check for match
|
||||||
|
# if resource is online on at least one node, then CRS will not flag it offline
|
||||||
|
# on any other nodes in which case we just do a NOOP
|
||||||
|
# (ONLINE stanzas must preceed OFFLINE stanzas in the configuration file)
|
||||||
|
if (( _IS_ONLINE > 0 ))
|
||||||
|
then
|
||||||
|
_MATCH_RC=1
|
||||||
|
else
|
||||||
|
data_contains_string "${CRS_STATE_LINE}" "${_CRS_NEEDLE}"
|
||||||
|
_MATCH_RC=$?
|
||||||
|
fi
|
||||||
|
if (( _MATCH_RC >> 0 ))
|
||||||
|
then
|
||||||
|
_MSG="resource ${_CRS_RESOURCE} has a correct state [${_CRS_STATE}@${_CRS_HOST}]"
|
||||||
|
_STC=0
|
||||||
|
_IS_ONLINE=1
|
||||||
|
else
|
||||||
|
_MSG="resource ${_CRS_RESOURCE} has a wrong state [${_CRS_STATE}@${_CRS_HOST}]"
|
||||||
|
_STC=1
|
||||||
|
fi
|
||||||
|
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
||||||
|
then
|
||||||
|
log_hc "$0" ${_STC} "${_MSG}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
# add crsctl output to stdout log
|
||||||
|
print "==== {${_CRSCTL_BIN} status resource ${_CRS_RESOURCE}} ====" >>${HC_STDOUT_LOG}
|
||||||
|
print "${_CRSCTL_STATUS}" >>${HC_STDOUT_LOG}
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
function _show_usage
|
||||||
|
{
|
||||||
|
cat <<- EOT
|
||||||
|
NAME : $1
|
||||||
|
VERSION : $2
|
||||||
|
CONFIG : $3 with parameters:
|
||||||
|
log_healthy=<yes|no>
|
||||||
|
and formatted stanzas:
|
||||||
|
crs:<resource_name>:<*|node>=<ONLINE|OFFLINE>,<*|node>=<ONLINE|OFFLINE>,...
|
||||||
|
PURPOSE : Checks the STATE of CRS resource(s)
|
||||||
|
LOG HEALTHY : Supported
|
||||||
|
|
||||||
|
EOT
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# END of script
|
||||||
|
#******************************************************************************
|
@ -1,195 +0,0 @@
|
|||||||
#!/usr/bin/env ksh
|
|
||||||
#******************************************************************************
|
|
||||||
# @(#) check_hpux_sg_cluster_config
|
|
||||||
#******************************************************************************
|
|
||||||
# @(#) Copyright (C) 2016 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
|
||||||
#
|
|
||||||
# This program is a free software; you can redistribute it and/or modify
|
|
||||||
# it under the same terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
|
||||||
#******************************************************************************
|
|
||||||
#
|
|
||||||
# DOCUMENTATION (MAIN)
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# @(#) MAIN: check_hpux_sg_cluster_status
|
|
||||||
# DOES: see _show_usage()
|
|
||||||
# EXPECTS: see _show_usage()
|
|
||||||
# REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
|
|
||||||
#
|
|
||||||
# @(#) HISTORY:
|
|
||||||
# @(#) 2016-03-08: initial version [Patrick Van der Veken]
|
|
||||||
# @(#) 2016-12-01: more standardized error handling [Patrick Van der Veken]
|
|
||||||
# @(#) 2018-10-28: fixed (linter) errors [Patrick Van der Veken]
|
|
||||||
# @(#) 2018-11-18: do not trap on signal 0 [Patrick Van der Veken]
|
|
||||||
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
|
||||||
#******************************************************************************
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
function check_hpux_sg_cluster_config
|
|
||||||
{
|
|
||||||
# ------------------------- CONFIGURATION starts here -------------------------
|
|
||||||
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
|
||||||
typeset _VERSION="2019-01-24" # YYYY-MM-DD
|
|
||||||
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
|
|
||||||
typeset _SG_DAEMON="/usr/lbin/cmcld"
|
|
||||||
# rubbish that cmgetconf outputs to STDOUT instead of STDERR
|
|
||||||
typeset _SG_CMGETCONF_FILTER="Permission denied|Number of configured"
|
|
||||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
|
||||||
|
|
||||||
# set defaults
|
|
||||||
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
|
|
||||||
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
|
|
||||||
typeset _ARGS=$(data_comma2space "$*")
|
|
||||||
typeset _ARG=""
|
|
||||||
typeset _MSG=""
|
|
||||||
typeset _STC=0
|
|
||||||
typeset _CLUSTER_RUN_FILE="${TMP_DIR}/.$0.cluster_run.$$"
|
|
||||||
typeset _CLUSTER_CFG_FILE="${TMP_DIR}/.$0.cluster_cfg.$$"
|
|
||||||
typeset _CLUSTER_INSTANCE=""
|
|
||||||
typeset _CLUSTER_INSTANCES=""
|
|
||||||
typeset _CLUSTER_ENTRY=""
|
|
||||||
typeset _CLUSTER_CFG_ENTRY=""
|
|
||||||
typeset _CLUSTER_MATCH=""
|
|
||||||
typeset _CLUSTER_PARAM=""
|
|
||||||
typeset _CLUSTER_VALUE=""
|
|
||||||
|
|
||||||
# set local trap for cleanup
|
|
||||||
# shellcheck disable=SC2064
|
|
||||||
trap "rm -f ${_CLUSTER_RUN_FILE}.* ${_CLUSTER_CFG_FILE}.* >/dev/null 2>&1; return 1" 1 2 3 15
|
|
||||||
|
|
||||||
# handle arguments (originally comma-separated)
|
|
||||||
for _ARG in ${_ARGS}
|
|
||||||
do
|
|
||||||
case "${_ARG}" in
|
|
||||||
help)
|
|
||||||
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# handle configuration file
|
|
||||||
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
|
|
||||||
if [[ ! -r ${_CONFIG_FILE} ]]
|
|
||||||
then
|
|
||||||
warn "unable to read configuration file at ${_CONFIG_FILE}"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# look for cluster instance names
|
|
||||||
grep -E -e '^\[' ${_CONFIG_FILE} 2>/dev/null | cut -f1 -d']' | cut -f2 -d'[' |\
|
|
||||||
while read _CLUSTER_INSTANCE
|
|
||||||
do
|
|
||||||
_CLUSTER_INSTANCES="${_CLUSTER_INSTANCES} ${_CLUSTER_INSTANCE}"
|
|
||||||
done
|
|
||||||
if [[ -z "${_CLUSTER_INSTANCES}" ]]
|
|
||||||
then
|
|
||||||
warn "no cluster information configured in ${_CONFIG_FILE}"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check serviceguard status & gather cluster information from running cluster (compressed lines)
|
|
||||||
if [[ ! -x ${_SG_DAEMON} ]]
|
|
||||||
then
|
|
||||||
warn "${_SG_DAEMON} is not installed here"
|
|
||||||
return 1
|
|
||||||
else
|
|
||||||
for _CLUSTER_INSTANCE in ${_CLUSTER_INSTANCES}
|
|
||||||
do
|
|
||||||
cmgetconf -c ${_CLUSTER_INSTANCE} 2>>${HC_STDERR_LOG} |\
|
|
||||||
grep -v -E -e "${_SG_CMGETCONF_FILTER}" | tr -d ' \t' >${_CLUSTER_RUN_FILE}.${_CLUSTER_INSTANCE}
|
|
||||||
[[ -s ${_CLUSTER_RUN_FILE}.${_CLUSTER_INSTANCE} ]] || {
|
|
||||||
_MSG="unable to gather cluster configuration"
|
|
||||||
log_hc "$0" 1 "${_MSG}"
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# gather cluster information from healthcheck configuration
|
|
||||||
for _CLUSTER_INSTANCE in ${_CLUSTER_INSTANCES}
|
|
||||||
do
|
|
||||||
awk -v cluster="${_CLUSTER_INSTANCE}" '
|
|
||||||
BEGIN { found = 0; needle = "^\["cluster"\]" }
|
|
||||||
|
|
||||||
# skip blank lines
|
|
||||||
/^\s*$/ { next; }
|
|
||||||
# skip comment lines
|
|
||||||
/^#/ { next; }
|
|
||||||
|
|
||||||
# end marker
|
|
||||||
( $0 ~ /^\[.*\]/ && found ) {
|
|
||||||
found = 0;
|
|
||||||
}
|
|
||||||
# start marker
|
|
||||||
$0 ~ needle {
|
|
||||||
found = 1;
|
|
||||||
};
|
|
||||||
# stanza body
|
|
||||||
( found && $0 !~ /^\[.*\]/ ) {
|
|
||||||
# print non-compressed and compressed version
|
|
||||||
printf "%s|", $0;
|
|
||||||
gsub(" |\t", "", $0);
|
|
||||||
printf "%s\n", $0;
|
|
||||||
}' < ${_CONFIG_FILE} 2>>${HC_STDERR_LOG} >${_CLUSTER_CFG_FILE}.${_CLUSTER_INSTANCE}
|
|
||||||
done
|
|
||||||
|
|
||||||
# do cluster configuration checks (using the compressed strings)
|
|
||||||
for _CLUSTER_INSTANCE in ${_CLUSTER_INSTANCES}
|
|
||||||
do
|
|
||||||
while read _CLUSTER_ENTRY
|
|
||||||
do
|
|
||||||
# split entry to get the compressed version
|
|
||||||
_CLUSTER_CFG_ENTRY=$(print "${_CLUSTER_ENTRY}" | cut -f2 -d'|')
|
|
||||||
# get parameter name from non-compressed version
|
|
||||||
_CLUSTER_PARAM=$(print "${_CLUSTER_ENTRY}" | cut -f1 -d'|' | awk '{ print $1 }')
|
|
||||||
# get parameter value from non-compressed version
|
|
||||||
_CLUSTER_VALUE=$(print "${_CLUSTER_ENTRY}" | cut -f1 -d'|' | awk '{ print substr($2,1,30)}')
|
|
||||||
# is it present?
|
|
||||||
_CLUSTER_MATCH=$(grep -c "${_CLUSTER_CFG_ENTRY}" ${_CLUSTER_RUN_FILE}.${_CLUSTER_INSTANCE} 2>/dev/null)
|
|
||||||
if (( _CLUSTER_MATCH == 0 ))
|
|
||||||
then
|
|
||||||
# get parameter name from non-compressed version
|
|
||||||
_MSG="'${_CLUSTER_PARAM} (${_CLUSTER_VALUE} ...)' is not correctly configured for ${_CLUSTER_INSTANCE}"
|
|
||||||
_STC=1
|
|
||||||
else
|
|
||||||
_MSG="'${_CLUSTER_PARAM} (${_CLUSTER_VALUE} ...)' is configured for ${_CLUSTER_INSTANCE}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# handle unit result
|
|
||||||
log_hc "$0" ${_STC} "${_MSG}"
|
|
||||||
_STC=0
|
|
||||||
done <${_CLUSTER_CFG_FILE}.${_CLUSTER_INSTANCE}
|
|
||||||
done
|
|
||||||
|
|
||||||
# do cleanup
|
|
||||||
rm -f ${_CLUSTER_RUN_FILE}.* ${_CLUSTER_CFG_FILE}.* >/dev/null 2>&1
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
function _show_usage
|
|
||||||
{
|
|
||||||
cat <<- EOT
|
|
||||||
NAME : $1
|
|
||||||
VERSION : $2
|
|
||||||
CONFIG : $3
|
|
||||||
PURPOSE : Checks the configuration of Serviceguard cluster (SG 11.16+) (comparing
|
|
||||||
serialized strings from the plugin configuration file to the running cluster
|
|
||||||
configuration)
|
|
||||||
|
|
||||||
EOT
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
#******************************************************************************
|
|
||||||
# END of script
|
|
||||||
#******************************************************************************
|
|
@ -1,185 +0,0 @@
|
|||||||
#!/usr/bin/env ksh
|
|
||||||
#******************************************************************************
|
|
||||||
# @(#) check_hpux_sg_cluster_status
|
|
||||||
#******************************************************************************
|
|
||||||
# @(#) Copyright (C) 2016 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
|
||||||
#
|
|
||||||
# This program is a free software; you can redistribute it and/or modify
|
|
||||||
# it under the same terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
|
||||||
#******************************************************************************
|
|
||||||
#
|
|
||||||
# DOCUMENTATION (MAIN)
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# @(#) MAIN: check_hpux_sg_cluster_status
|
|
||||||
# DOES: see _show_usage()
|
|
||||||
# EXPECTS: see _show_usage()
|
|
||||||
# REQUIRES: data_comma2space(), dump_logs(), init_hc(), log_hc(), warn()
|
|
||||||
#
|
|
||||||
# @(#) HISTORY:
|
|
||||||
# @(#) 2016-03-25: initial version [Patrick Van der Veken]
|
|
||||||
# @(#) 2016-12-01: more standardized error handling [Patrick Van der Veken]
|
|
||||||
# @(#) 2017-05-07: made checks more detailed for log_hc() [Patrick Van der Veken]
|
|
||||||
# @(#) 2018-05-20: added dump_logs() [Patrick Van der Veken]
|
|
||||||
# @(#) 2018-10-28: fixed (linter) errors [Patrick Van der Veken]
|
|
||||||
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
|
|
||||||
# @(#) 2019-03-09: changed format of stanzas in configuration file &
|
|
||||||
# @(#) added support for --log-healthy [Patrick Van der Veken]
|
|
||||||
# @(#) 2019-04-08: IFS fix [Patrick Van der Veken]
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
|
||||||
#******************************************************************************
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
function check_hpux_sg_cluster_status
|
|
||||||
{
|
|
||||||
# ------------------------- CONFIGURATION starts here -------------------------
|
|
||||||
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
|
||||||
typeset _VERSION="2019-04-08" # YYYY-MM-DD
|
|
||||||
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
|
|
||||||
typeset _SG_DAEMON="/usr/lbin/cmcld"
|
|
||||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
|
||||||
|
|
||||||
# set defaults
|
|
||||||
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
|
|
||||||
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
|
|
||||||
typeset _ARGS=$(data_comma2space "$*")
|
|
||||||
typeset _ARG=""
|
|
||||||
typeset _MSG=""
|
|
||||||
typeset _STC=0
|
|
||||||
typeset _CFG_HEALTHY=""
|
|
||||||
typeset _LOG_HEALTHY=0
|
|
||||||
typeset _SG_ENTRY=""
|
|
||||||
typeset _SG_MATCH=""
|
|
||||||
typeset _SG_CFG_PARAM=""
|
|
||||||
typeset _SG_CFG_VALUE=""
|
|
||||||
typeset _SG_RUN_VALUE=""
|
|
||||||
typeset _IS_OLD_STYLE=0
|
|
||||||
|
|
||||||
# handle arguments (originally comma-separated)
|
|
||||||
for _ARG in ${_ARGS}
|
|
||||||
do
|
|
||||||
case "${_ARG}" in
|
|
||||||
help)
|
|
||||||
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# handle configuration file
|
|
||||||
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
|
|
||||||
if [[ ! -r ${_CONFIG_FILE} ]]
|
|
||||||
then
|
|
||||||
warn "unable to read configuration file at ${_CONFIG_FILE}"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
_CFG_HEALTHY=$(_CONFIG_FILE="${_CONFIG_FILE}" data_get_lvalue_from_config 'log_healthy')
|
|
||||||
case "${_CFG_HEALTHY}" in
|
|
||||||
yes|YES|Yes)
|
|
||||||
_LOG_HEALTHY=1
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# do not override hc_arg
|
|
||||||
(( _LOG_HEALTHY > 0 )) || _LOG_HEALTHY=0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# check for old-style configuration file (non-prefixed stanzas)
|
|
||||||
_IS_OLD_STYLE=$(grep -c -E -e "^sg:" ${_CONFIG_FILE} 2>/dev/null)
|
|
||||||
if (( _IS_OLD_STYLE == 0 ))
|
|
||||||
then
|
|
||||||
warn "no 'sg:' stanza(s) found in ${_CONFIG_FILE}; possibly an old-style configuration?"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# log_healthy
|
|
||||||
(( ARG_LOG_HEALTHY > 0 )) && _LOG_HEALTHY=1
|
|
||||||
if (( _LOG_HEALTHY > 0 ))
|
|
||||||
then
|
|
||||||
if (( ARG_LOG > 0 ))
|
|
||||||
then
|
|
||||||
log "logging/showing passed health checks"
|
|
||||||
else
|
|
||||||
log "showing passed health checks (but not logging)"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
log "not logging/showing passed health checks"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check & get serviceguard status
|
|
||||||
if [[ ! -x ${_SG_DAEMON} ]]
|
|
||||||
then
|
|
||||||
warn "${_SG_DAEMON} is not installed here"
|
|
||||||
return 1
|
|
||||||
else
|
|
||||||
cmviewcl -v -f line 2>>${HC_STDERR_LOG} | tr '|' ':' >>${HC_STDOUT_LOG}
|
|
||||||
(( $? > 0 )) && {
|
|
||||||
_MSG="unable to run command: {cmviewcl}"
|
|
||||||
log_hc "$0" 1 "${_MSG}"
|
|
||||||
# dump debug info
|
|
||||||
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# do cluster status checks
|
|
||||||
# (replace ':' by '|' for cmcviewcl output)
|
|
||||||
grep -E -e "^sg:" ${_CONFIG_FILE} 2>/dev/null | tr '|' ':' 2>/dev/null |\
|
|
||||||
while IFS=":" read -r _ _SG_ENTRY
|
|
||||||
do
|
|
||||||
# field split
|
|
||||||
_SG_CFG_PARAM="$(print ${_SG_ENTRY} | cut -f1 -d'=')" # field 1
|
|
||||||
_SG_CFG_VALUE="$(print ${_SG_ENTRY} | cut -f2 -d'=')" # field 2
|
|
||||||
|
|
||||||
# check run-time values (anchored grep here!)
|
|
||||||
_SG_MATCH=$(grep -i "^${_SG_CFG_PARAM}" ${HC_STDOUT_LOG} 2>/dev/null)
|
|
||||||
if [[ -n "${_SG_MATCH}" ]]
|
|
||||||
then
|
|
||||||
_SG_RUN_VALUE=$(print "${_SG_MATCH}" | cut -f2 -d'=') # field 2
|
|
||||||
|
|
||||||
if [[ "${_SG_CFG_VALUE}" = "${_SG_RUN_VALUE}" ]]
|
|
||||||
then
|
|
||||||
_MSG="cluster parameter ${_SG_CFG_PARAM} has a correct value [${_SG_RUN_VALUE}]"
|
|
||||||
_STC=0
|
|
||||||
else
|
|
||||||
_MSG="cluster parameter ${_SG_CFG_PARAM} has a wrong value [${_SG_RUN_VALUE}]"
|
|
||||||
_STC=1
|
|
||||||
fi
|
|
||||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
|
||||||
then
|
|
||||||
log_hc "$0" ${_STC} "${_MSG}" "${_SG_RUN_VALUE}" "${_SG_CFG_VALUE}"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
warn "could not determine status for ${_SG_CFG_PARAM} from command output {cmviewcl}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
function _show_usage
|
|
||||||
{
|
|
||||||
cat <<- EOT
|
|
||||||
NAME : $1
|
|
||||||
VERSION : $2
|
|
||||||
CONFIG : $3 with parameters:
|
|
||||||
log_healthy=<yes|no>
|
|
||||||
and formatted stanzas:
|
|
||||||
sg:<param>=<value>
|
|
||||||
PURPOSE : Checks the status of Serviceguard cluster parameters (SG 11.16+)
|
|
||||||
LOG HEALTHY : Supported
|
|
||||||
|
|
||||||
EOT
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
#******************************************************************************
|
|
||||||
# END of script
|
|
||||||
#******************************************************************************
|
|
@ -1,195 +0,0 @@
|
|||||||
#!/usr/bin/env ksh
|
|
||||||
#******************************************************************************
|
|
||||||
# @(#) check_hpux_sg_package_config
|
|
||||||
#******************************************************************************
|
|
||||||
# @(#) Copyright (C) 2016 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
|
||||||
#
|
|
||||||
# This program is a free software; you can redistribute it and/or modify
|
|
||||||
# it under the same terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
|
||||||
#******************************************************************************
|
|
||||||
#
|
|
||||||
# DOCUMENTATION (MAIN)
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# @(#) MAIN: check_hpux_sg_package_config
|
|
||||||
# DOES: see _show_usage()
|
|
||||||
# EXPECTS: see _show_usage()
|
|
||||||
# REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
|
|
||||||
#
|
|
||||||
# @(#) HISTORY:
|
|
||||||
# @(#) 2016-03-08: initial version [Patrick Van der Veken]
|
|
||||||
# @(#) 2016-12-01: more standardized error handling [Patrick Van der Veken]
|
|
||||||
# @(#) 2018-10-28: fixed (linter) errors [Patrick Van der Veken]
|
|
||||||
# @(#) 2018-11-18: do not trap on signal 0 [Patrick Van der Veken]
|
|
||||||
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
|
||||||
#******************************************************************************
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
function check_hpux_sg_package_config
|
|
||||||
{
|
|
||||||
# ------------------------- CONFIGURATION starts here -------------------------
|
|
||||||
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
|
||||||
typeset _VERSION="2019-01-24" # YYYY-MM-DD
|
|
||||||
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
|
|
||||||
typeset _SG_DAEMON="/usr/lbin/cmcld"
|
|
||||||
# rubbish that cmgetconf outputs to STDOUT instead of STDERR
|
|
||||||
typeset _SG_CMGETCONF_FILTER="Permission denied|Number of configured"
|
|
||||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
|
||||||
|
|
||||||
# set defaults
|
|
||||||
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
|
|
||||||
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
|
|
||||||
typeset _ARGS=$(data_comma2space "$*")
|
|
||||||
typeset _ARG=""
|
|
||||||
typeset _MSG=""
|
|
||||||
typeset _STC=0
|
|
||||||
typeset _PKG_RUN_FILE="${TMP_DIR}/.$0.pkg_run.$$"
|
|
||||||
typeset _PKG_CFG_FILE="${TMP_DIR}/.$0.pkg_cfg.$$"
|
|
||||||
typeset _PKG_INSTANCE=""
|
|
||||||
typeset _PKG_INSTANCES=""
|
|
||||||
typeset _PKG_ENTRY=""
|
|
||||||
typeset _PKG_CFG_ENTRY=""
|
|
||||||
typeset _PKG_MATCH=""
|
|
||||||
typeset _PKG_PARAM=""
|
|
||||||
typeset _PKG_VALUE=""
|
|
||||||
|
|
||||||
# handle arguments (originally comma-separated)
|
|
||||||
for _ARG in ${_ARGS}
|
|
||||||
do
|
|
||||||
case "${_ARG}" in
|
|
||||||
help)
|
|
||||||
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# set local trap for cleanup
|
|
||||||
# shellcheck disable=SC2064
|
|
||||||
trap "rm -f ${_PKG_RUN_FILE}.* ${_PKG_CFG_FILE}.* >/dev/null 2>&1; return 1" 1 2 3 15
|
|
||||||
|
|
||||||
# handle configuration file
|
|
||||||
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
|
|
||||||
if [[ ! -r ${_CONFIG_FILE} ]]
|
|
||||||
then
|
|
||||||
warn "unable to read configuration file at ${_CONFIG_FILE}"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# look for package instance names
|
|
||||||
grep -E -e '^\[' ${_CONFIG_FILE} 2>/dev/null | cut -f1 -d']' | cut -f2 -d'[' |\
|
|
||||||
while read _PKG_INSTANCE
|
|
||||||
do
|
|
||||||
_PKG_INSTANCES="${_PKG_INSTANCES} ${_PKG_INSTANCE}"
|
|
||||||
done
|
|
||||||
if [[ -z "${_PKG_INSTANCES}" ]]
|
|
||||||
then
|
|
||||||
warn "no package information configured in ${_CONFIG_FILE}"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check serviceguard status & gather package information from running cluster (compressed lines)
|
|
||||||
if [[ ! -x ${_SG_DAEMON} ]]
|
|
||||||
then
|
|
||||||
warn "${_SG_DAEMON} is not installed here"
|
|
||||||
return 1
|
|
||||||
else
|
|
||||||
for _PKG_INSTANCE in ${_PKG_INSTANCES}
|
|
||||||
do
|
|
||||||
cmgetconf -p ${_PKG_INSTANCE} -v 0 2>>${HC_STDERR_LOG} |\
|
|
||||||
grep -v -E -e "${_SG_CMGETCONF_FILTER}" | tr -d ' \t' >${_PKG_RUN_FILE}.${_PKG_INSTANCE}
|
|
||||||
[[ -s ${_PKG_RUN_FILE}.${_PKG_INSTANCE} ]] || {
|
|
||||||
_MSG="unable to gather package configuration for at least one cluster package"
|
|
||||||
log_hc "$0" 1 "${_MSG}"
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# gather package information from healthcheck configuration
|
|
||||||
for _PKG_INSTANCE in ${_PKG_INSTANCES}
|
|
||||||
do
|
|
||||||
awk -v package="${_PKG_INSTANCE}" '
|
|
||||||
BEGIN { found = 0; needle = "^\["package"\]" }
|
|
||||||
|
|
||||||
# skip blank lines
|
|
||||||
/^\s*$/ { next; }
|
|
||||||
# skip comment lines
|
|
||||||
/^#/ { next; }
|
|
||||||
|
|
||||||
# end marker
|
|
||||||
( $0 ~ /^\[.*\]/ && found ) {
|
|
||||||
found = 0;
|
|
||||||
}
|
|
||||||
# start marker
|
|
||||||
$0 ~ needle {
|
|
||||||
found = 1;
|
|
||||||
};
|
|
||||||
# stanza body
|
|
||||||
( found && $0 !~ /^\[.*\]/ ) {
|
|
||||||
# print non-compressed and compressed version
|
|
||||||
printf "%s|", $0;
|
|
||||||
gsub(" |\t", "", $0);
|
|
||||||
printf "%s\n", $0;
|
|
||||||
}' < ${_CONFIG_FILE} 2>>${HC_STDERR_LOG} >${_PKG_CFG_FILE}.${_PKG_INSTANCE}
|
|
||||||
done
|
|
||||||
|
|
||||||
# do package configuration checks (using the compressed strings)
|
|
||||||
for _PKG_INSTANCE in ${_PKG_INSTANCES}
|
|
||||||
do
|
|
||||||
while read _PKG_ENTRY
|
|
||||||
do
|
|
||||||
# split entry to get the compressed version
|
|
||||||
_PKG_CFG_ENTRY=$(print "${_PKG_ENTRY}" | cut -f2 -d'|')
|
|
||||||
# get parameter name from non-compressed version
|
|
||||||
_PKG_PARAM=$(print "${_PKG_ENTRY}" | awk '{ print $1 }')
|
|
||||||
# get parameter value from non-compressed version
|
|
||||||
_PKG_VALUE=$(print "${_PKG_ENTRY}" | cut -f1 -d'|' | awk '{ print substr($2,1,30)}')
|
|
||||||
# is it present?
|
|
||||||
_PKG_MATCH=$(grep -c "${_PKG_CFG_ENTRY}" ${_PKG_RUN_FILE}.${_PKG_INSTANCE} 2>/dev/null)
|
|
||||||
if (( _PKG_MATCH == 0 ))
|
|
||||||
then
|
|
||||||
# get parameter name from non-compressed version
|
|
||||||
_MSG="'${_PKG_PARAM} (${_PKG_VALUE} ...)' is not correctly configured for ${_PKG_INSTANCE}"
|
|
||||||
_STC=1
|
|
||||||
else
|
|
||||||
_MSG="'${_PKG_PARAM} (${_PKG_VALUE} ...)' is configured for ${_PKG_INSTANCE}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# handle unit result
|
|
||||||
log_hc "$0" ${_STC} "${_MSG}"
|
|
||||||
_STC=0
|
|
||||||
done <${_PKG_CFG_FILE}.${_PKG_INSTANCE}
|
|
||||||
done
|
|
||||||
|
|
||||||
# do cleanup
|
|
||||||
rm -f ${_PKG_RUN_FILE}.* ${_PKG_CFG_FILE}.* >/dev/null 2>&1
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
function _show_usage
|
|
||||||
{
|
|
||||||
cat <<- EOT
|
|
||||||
NAME : $1
|
|
||||||
VERSION : $2
|
|
||||||
CONFIG : $3
|
|
||||||
PURPOSE : Checks the configuration of Serviceguard packages (SG 11.16+) (comparing
|
|
||||||
serialized strings from the HC configuration file to the running cluster
|
|
||||||
configuration)
|
|
||||||
|
|
||||||
EOT
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
#******************************************************************************
|
|
||||||
# END of script
|
|
||||||
#******************************************************************************
|
|
@ -1,187 +0,0 @@
|
|||||||
#!/usr/bin/env ksh
|
|
||||||
#******************************************************************************
|
|
||||||
# @(#) check_hpux_sg_package_status
|
|
||||||
#******************************************************************************
|
|
||||||
# @(#) Copyright (C) 2016 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
|
||||||
#
|
|
||||||
# This program is a free software; you can redistribute it and/or modify
|
|
||||||
# it under the same terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
|
||||||
#******************************************************************************
|
|
||||||
#
|
|
||||||
# DOCUMENTATION (MAIN)
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# @(#) MAIN: check_hpux_sg_package_status
|
|
||||||
# DOES: see _show_usage()
|
|
||||||
# EXPECTS: see _show_usage()
|
|
||||||
# REQUIRES: data_comma2space(), dump_logs(), init_hc(), log_hc(), warn()
|
|
||||||
#
|
|
||||||
# @(#) HISTORY:
|
|
||||||
# @(#) 2016-03-08: initial version [Patrick Van der Veken]
|
|
||||||
# @(#) 2016-12-01: more standardized error handling [Patrick Van der Veken]
|
|
||||||
# @(#) 2017-05-07: made checks more detailed for log_hc() [Patrick Van der Veken]
|
|
||||||
# @(#) 2018-05-20: added dump_logs() [Patrick Van der Veken]
|
|
||||||
# @(#) 2018-10-28: fixed (linter) errors [Patrick Van der Veken]
|
|
||||||
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
|
|
||||||
# @(#) 2019-03-09: changed format of stanzas in configuration file &
|
|
||||||
# @(#) added support for --log-healthy [Patrick Van der Veken]
|
|
||||||
# @(#) 2019-04-08: IFS fix [Patrick Van der Veken]
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
|
||||||
#******************************************************************************
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
function check_hpux_sg_package_status
|
|
||||||
{
|
|
||||||
# ------------------------- CONFIGURATION starts here -------------------------
|
|
||||||
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
|
||||||
typeset _VERSION="2019-04-08" # YYYY-MM-DD
|
|
||||||
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
|
|
||||||
typeset _SG_DAEMON="/usr/lbin/cmcld"
|
|
||||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
|
||||||
|
|
||||||
# set defaults
|
|
||||||
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
|
|
||||||
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
|
|
||||||
typeset _ARGS=$(data_comma2space "$*")
|
|
||||||
typeset _ARG=""
|
|
||||||
typeset _MSG=""
|
|
||||||
typeset _STC=0
|
|
||||||
typeset _CFG_HEALTHY=""
|
|
||||||
typeset _LOG_HEALTHY=0
|
|
||||||
typeset _SG_ENTRY=""
|
|
||||||
typeset _SG_MATCH=""
|
|
||||||
typeset _SG_PACKAGE=""
|
|
||||||
typeset _SG_CFG_PARAM=""
|
|
||||||
typeset _SG_CFG_VALUE=""
|
|
||||||
typeset _SG_RUN_VALUE=""
|
|
||||||
typeset _IS_OLD_STYLE=0
|
|
||||||
|
|
||||||
# handle arguments (originally comma-separated)
|
|
||||||
for _ARG in ${_ARGS}
|
|
||||||
do
|
|
||||||
case "${_ARG}" in
|
|
||||||
help)
|
|
||||||
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# handle configuration file
|
|
||||||
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
|
|
||||||
if [[ ! -r ${_CONFIG_FILE} ]]
|
|
||||||
then
|
|
||||||
warn "unable to read configuration file at ${_CONFIG_FILE}"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
_CFG_HEALTHY=$(_CONFIG_FILE="${_CONFIG_FILE}" data_get_lvalue_from_config 'log_healthy')
|
|
||||||
case "${_CFG_HEALTHY}" in
|
|
||||||
yes|YES|Yes)
|
|
||||||
_LOG_HEALTHY=1
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# do not override hc_arg
|
|
||||||
(( _LOG_HEALTHY > 0 )) || _LOG_HEALTHY=0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# check for old-style configuration file (non-prefixed stanzas)
|
|
||||||
_IS_OLD_STYLE=$(grep -c -E -e "^sg:" ${_CONFIG_FILE} 2>/dev/null)
|
|
||||||
if (( _IS_OLD_STYLE == 0 ))
|
|
||||||
then
|
|
||||||
warn "no 'sg:' stanza(s) found in ${_CONFIG_FILE}; possibly an old-style configuration?"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# log_healthy
|
|
||||||
(( ARG_LOG_HEALTHY > 0 )) && _LOG_HEALTHY=1
|
|
||||||
if (( _LOG_HEALTHY > 0 ))
|
|
||||||
then
|
|
||||||
if (( ARG_LOG > 0 ))
|
|
||||||
then
|
|
||||||
log "logging/showing passed health checks"
|
|
||||||
else
|
|
||||||
log "showing passed health checks (but not logging)"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
log "not logging/showing passed health checks"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check & get serviceguard status
|
|
||||||
if [[ ! -x ${_SG_DAEMON} ]]
|
|
||||||
then
|
|
||||||
warn "${_SG_DAEMON} is not installed here"
|
|
||||||
return 1
|
|
||||||
else
|
|
||||||
cmviewcl -v -f line -l package 2>>${HC_STDERR_LOG} | tr '|' ':' >>${HC_STDOUT_LOG}
|
|
||||||
(( $? > 0)) && {
|
|
||||||
_MSG="unable to run command: {cmviewcl}"
|
|
||||||
log_hc "$0" 1 "${_MSG}"
|
|
||||||
# dump debug info
|
|
||||||
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# do package status checks
|
|
||||||
# (replace ':' by '|' for cmcviewcl output)
|
|
||||||
grep -E -e "^sg:" ${_CONFIG_FILE} 2>/dev/null | tr '|' ':' 2>/dev/null |\
|
|
||||||
while IFS=":" read -r _ _SG_ENTRY
|
|
||||||
do
|
|
||||||
# field split
|
|
||||||
_SG_PACKAGE="$(print ${_SG_ENTRY} | cut -f1 -d':')"
|
|
||||||
_SG_CFG_PARAM="$(print ${_SG_ENTRY} | cut -f2- -d':' | cut -f1 -d'=')" # field 2-,1
|
|
||||||
_SG_CFG_VALUE="$(print ${_SG_ENTRY} | cut -f2- -d':' | cut -f2 -d'=')" # field 2-,2
|
|
||||||
|
|
||||||
# check run-time values (anchored grep here!)
|
|
||||||
_SG_MATCH=$(grep -i "^package:${_SG_PACKAGE}:${_SG_CFG_PARAM}" ${HC_STDOUT_LOG} 2>/dev/null)
|
|
||||||
if [[ -n "${_SG_MATCH}" ]]
|
|
||||||
then
|
|
||||||
_SG_RUN_VALUE=$(print "${_SG_MATCH}" | cut -f3- -d':' | cut -f2 -d'=') # field3-,2
|
|
||||||
|
|
||||||
if [[ "${_SG_CFG_VALUE}" = "${_SG_RUN_VALUE}" ]]
|
|
||||||
then
|
|
||||||
_MSG="package ${_SG_PACKAGE} parameter ${_SG_CFG_PARAM} has a correct value [${_SG_RUN_VALUE}]"
|
|
||||||
_STC=0
|
|
||||||
else
|
|
||||||
_MSG="package ${_SG_PACKAGE} parameter ${_SG_CFG_PARAM} has a wrong value [${_SG_RUN_VALUE}]"
|
|
||||||
_STC=1
|
|
||||||
fi
|
|
||||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
|
||||||
then
|
|
||||||
log_hc "$0" ${_STC} "${_MSG}" "${_SG_RUN_VALUE}" "${_SG_CFG_VALUE}"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
warn "could not determine status for ${_SG_PACKAGE}/${_SG_CFG_PARAM} from command output {cmviewcl}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
function _show_usage
|
|
||||||
{
|
|
||||||
cat <<- EOT
|
|
||||||
NAME : $1
|
|
||||||
VERSION : $2
|
|
||||||
CONFIG : $3 with parameters:
|
|
||||||
log_healthy=<yes|no>
|
|
||||||
and formatted stanzas:
|
|
||||||
sg:<package_name>:<parameter>=<value>
|
|
||||||
PURPOSE : Checks the status of Serviceguard package parameters (SG 11.16+)
|
|
||||||
LOG HEALTHY : Supported
|
|
||||||
|
|
||||||
EOT
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
#******************************************************************************
|
|
||||||
# END of script
|
|
||||||
#******************************************************************************
|
|
@ -1,137 +0,0 @@
|
|||||||
#!/usr/bin/env ksh
|
|
||||||
#******************************************************************************
|
|
||||||
# @(#) check_hpux_sg_qs_status.sh
|
|
||||||
#******************************************************************************
|
|
||||||
# @(#) Copyright (C) 2017 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
|
||||||
#
|
|
||||||
# This program is a free software; you can redistribute it and/or modify
|
|
||||||
# it under the same terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
|
||||||
#******************************************************************************
|
|
||||||
#
|
|
||||||
# DOCUMENTATION (MAIN)
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# @(#) MAIN: check_hpux_sg_qs_status
|
|
||||||
# DOES: see _show_usage()
|
|
||||||
# EXPECTS: n/a
|
|
||||||
# REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
|
|
||||||
#
|
|
||||||
# @(#) HISTORY:
|
|
||||||
# @(#) 2017-05-01: initial version [Patrick Van der Veken]
|
|
||||||
# @(#) 2018-10-28: fixed (linter) errors [Patrick Van der Veken]
|
|
||||||
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
|
|
||||||
# @(#) 2019-03-09: added support for --log-healthy [Patrick Van der Veken]
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
|
||||||
#******************************************************************************
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
function check_hpux_sg_qs_status
|
|
||||||
{
|
|
||||||
# ------------------------- CONFIGURATION starts here -------------------------
|
|
||||||
typeset _VERSION="2019-03-09" # YYYY-MM-DD
|
|
||||||
typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
|
|
||||||
typeset _QS_BIN="/usr/lbin/qsc"
|
|
||||||
typeset _QS_AUTH_FILE="/etc/cmcluster/qs_authfile"
|
|
||||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
|
||||||
|
|
||||||
# set defaults
|
|
||||||
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
|
|
||||||
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
|
|
||||||
typeset _ARGS=$(data_comma2space "$*")
|
|
||||||
typeset _ARG=""
|
|
||||||
typeset _MSG=""
|
|
||||||
typeset _STC=0
|
|
||||||
typeset _LOG_HEALTHY=0
|
|
||||||
|
|
||||||
# handle arguments (originally comma-separated)
|
|
||||||
for _ARG in ${_ARGS}
|
|
||||||
do
|
|
||||||
case "${_ARG}" in
|
|
||||||
help)
|
|
||||||
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# log_healthy
|
|
||||||
(( ARG_LOG_HEALTHY > 0 )) && _LOG_HEALTHY=1
|
|
||||||
if (( _LOG_HEALTHY > 0 ))
|
|
||||||
then
|
|
||||||
if (( ARG_LOG > 0 ))
|
|
||||||
then
|
|
||||||
log "logging/showing passed health checks"
|
|
||||||
else
|
|
||||||
log "showing passed health checks (but not logging)"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
log "not logging/showing passed health checks"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# check QS presence
|
|
||||||
if [[ ! -x ${_QS_BIN} ]]
|
|
||||||
then
|
|
||||||
warn "${_QS_BIN} is not installed here"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ---- process state ----
|
|
||||||
(( $(pgrep -u root -f ${_QS_BIN} 2>>${HC_STDERR_LOG} | wc -l) == 0 )) && _STC=1
|
|
||||||
|
|
||||||
# evaluate results
|
|
||||||
case ${_STC} in
|
|
||||||
0)
|
|
||||||
_MSG="QS is running"
|
|
||||||
;;
|
|
||||||
1)
|
|
||||||
_MSG="QS is not running"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
_MSG="could not determine status of QS"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
|
||||||
then
|
|
||||||
log_hc "$0" ${_STC} "${_MSG}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ---- config state ----
|
|
||||||
if [[ -s ${_QS_AUTH_FILE} ]]
|
|
||||||
then
|
|
||||||
_MSG="QS authorizations file has been configured"
|
|
||||||
_STC=0
|
|
||||||
else
|
|
||||||
_MSG="QS authorizations file is missing or empty (${_QS_AUTH_FILE})"
|
|
||||||
_STC=1
|
|
||||||
fi
|
|
||||||
if (( _LOG_HEALTHY > 0 || _STC > 0 ))
|
|
||||||
then
|
|
||||||
log_hc "$0" ${_STC} "${_MSG}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
function _show_usage
|
|
||||||
{
|
|
||||||
cat <<- EOT
|
|
||||||
NAME : $1
|
|
||||||
VERSION : $2
|
|
||||||
PURPOSE : Checks whether the Serviceguard quorum server is running
|
|
||||||
LOG HEALTHY : Supported
|
|
||||||
|
|
||||||
EOT
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
#******************************************************************************
|
|
||||||
# END of script
|
|
||||||
#******************************************************************************
|
|
@ -340,7 +340,7 @@ then
|
|||||||
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && debug "excluding table: ${_MYSQL_TABLE}"
|
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && debug "excluding table: ${_MYSQL_TABLE}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
# add mysqlcheck output to stdout log_hc
|
# add mysqlcheck output to stdout log
|
||||||
print "==== {${_MYSQLCHECK_BIN} <hidden_opts> --database ${_MYSQL_DB}} ====" >>${HC_STDOUT_LOG}
|
print "==== {${_MYSQLCHECK_BIN} <hidden_opts> --database ${_MYSQL_DB}} ====" >>${HC_STDOUT_LOG}
|
||||||
print "${_MYSQLCHECK_OUTPUT}" >>${HC_STDOUT_LOG}
|
print "${_MYSQLCHECK_OUTPUT}" >>${HC_STDOUT_LOG}
|
||||||
done
|
done
|
||||||
|
58
opt/hc/lib/platform/linux/check_linux_sg_cluster_config.sh → opt/hc/lib/platform/serviceguard/check_serviceguard_cluster_config.sh
Executable file → Normal file
58
opt/hc/lib/platform/linux/check_linux_sg_cluster_config.sh → opt/hc/lib/platform/serviceguard/check_serviceguard_cluster_config.sh
Executable file → Normal file
@ -12,40 +12,35 @@
|
|||||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
||||||
#*****************************************hpux*************************************
|
#******************************************************************************
|
||||||
#
|
#
|
||||||
# DOCUMENTATION (MAIN)
|
# DOCUMENTATION (MAIN)
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# @(#) MAIN: check_linux_sg_cluster_status
|
# @(#) MAIN: check_serviceguard_cluster_status
|
||||||
# DOES: see _show_usage()
|
# DOES: see _show_usage()
|
||||||
# EXPECTS: see _show_usage()
|
# EXPECTS: see _show_usage()
|
||||||
# REQUIRES: data_comma2space(), dump_logs(), init_hc(), log_hc(), warn()
|
# REQUIRES: data_comma2space(), dump_logs(), init_hc(), log_hc(), warn()
|
||||||
#
|
#
|
||||||
# @(#) HISTORY:
|
# @(#) HISTORY:
|
||||||
# @(#) 2017-04-01: initial version [Patrick Van der Veken]
|
# @(#) 2019-04-20: merged HP-UX+Linux version [Patrick Van der Veken]
|
||||||
# @(#) 2018-05-21: added dump_logs() & other fixes [Patrick Van der Veken]
|
|
||||||
# @(#) 2018-10-28: fixed (linter) errors [Patrick Van der Veken]
|
|
||||||
# @(#) 2018-11-18: do not trap on signal 0 [Patrick Van der Veken]
|
|
||||||
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
function check_linux_sg_cluster_config
|
function check_serviceguard_cluster_status
|
||||||
{
|
{
|
||||||
# ------------------------- CONFIGURATION starts here -------------------------
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
||||||
typeset _VERSION="2019-01-24" # YYYY-MM-DD
|
typeset _VERSION="2019-04-20" # YYYY-MM-DD
|
||||||
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
|
typeset _SUPPORTED_PLATFORMS="HP-UX,Linux" # uname -s match
|
||||||
typeset _SG_DAEMON="/opt/cmcluster/bin/cmcld"
|
|
||||||
# rubbish that cmgetconf outputs to STDOUT instead of STDERR
|
# rubbish that cmgetconf outputs to STDOUT instead of STDERR
|
||||||
typeset _SG_CMGETCONF_FILTER="Permission denied|Number of configured"
|
typeset _SG_CMGETCONF_FILTER="Permission denied|Number of configured"
|
||||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
|
||||||
# set defaults
|
# set defaults
|
||||||
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
|
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
|
||||||
PATH=$PATH:/opt/cmcluster/bin
|
PATH=$PATH:/opt/cmcluster/bin # Linux
|
||||||
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
|
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
|
||||||
typeset _ARGS=$(data_comma2space "$*")
|
typeset _ARGS=$(data_comma2space "$*")
|
||||||
typeset _ARG=""
|
typeset _ARG=""
|
||||||
@ -61,10 +56,6 @@ typeset _CLUSTER_MATCH=""
|
|||||||
typeset _CLUSTER_PARAM=""
|
typeset _CLUSTER_PARAM=""
|
||||||
typeset _CLUSTER_VALUE=""
|
typeset _CLUSTER_VALUE=""
|
||||||
|
|
||||||
# set local trap for cleanup
|
|
||||||
# shellcheck disable=SC2064
|
|
||||||
trap "rm -f ${_CLUSTER_RUN_FILE}.* ${_CLUSTER_CFG_FILE}.* >/dev/null 2>&1; return 1" 1 2 3 15
|
|
||||||
|
|
||||||
# handle arguments (originally comma-separated)
|
# handle arguments (originally comma-separated)
|
||||||
for _ARG in ${_ARGS}
|
for _ARG in ${_ARGS}
|
||||||
do
|
do
|
||||||
@ -75,6 +66,10 @@ do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# set local trap for cleanup
|
||||||
|
# shellcheck disable=SC2064
|
||||||
|
trap "rm -f ${_CLUSTER_RUN_FILE}.* ${_CLUSTER_CFG_FILE}.* >/dev/null 2>&1; return 1" 1 2 3 15
|
||||||
|
|
||||||
# handle configuration file
|
# handle configuration file
|
||||||
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
|
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
|
||||||
if [[ ! -r ${_CONFIG_FILE} ]]
|
if [[ ! -r ${_CONFIG_FILE} ]]
|
||||||
@ -96,6 +91,14 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# check serviceguard status & gather cluster information from running cluster (compressed lines)
|
# check serviceguard status & gather cluster information from running cluster (compressed lines)
|
||||||
|
case "${OS_NAME}" in
|
||||||
|
HP-UX)
|
||||||
|
typeset _SG_DAEMON="/usr/lbin/cmcld"
|
||||||
|
;;
|
||||||
|
Linux)
|
||||||
|
typeset _SG_DAEMON="/opt/cmcluster/bin/cmcld"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
if [[ ! -x ${_SG_DAEMON} ]]
|
if [[ ! -x ${_SG_DAEMON} ]]
|
||||||
then
|
then
|
||||||
warn "${_SG_DAEMON} is not installed here"
|
warn "${_SG_DAEMON} is not installed here"
|
||||||
@ -103,15 +106,17 @@ then
|
|||||||
else
|
else
|
||||||
for _CLUSTER_INSTANCE in ${_CLUSTER_INSTANCES}
|
for _CLUSTER_INSTANCE in ${_CLUSTER_INSTANCES}
|
||||||
do
|
do
|
||||||
cmgetconf -c ${_CLUSTER_INSTANCE} 2>>${HC_STDERR_LOG} |\
|
# dump configuration information in compressed format
|
||||||
grep -v -E -e "${_SG_CMGETCONF_FILTER}" | tr -d ' \t' >${_CLUSTER_RUN_FILE}.${_CLUSTER_INSTANCE}
|
cmgetconf -c ${_CLUSTER_INSTANCE} 2>>${HC_STDERR_LOG} |\
|
||||||
[[ -s ${_CLUSTER_RUN_FILE}.${_CLUSTER_INSTANCE} ]] || {
|
grep -v -E -e "${_SG_CMGETCONF_FILTER}" |\
|
||||||
_MSG="unable to gather cluster configuration"
|
tr -d ' \t' >${_CLUSTER_RUN_FILE}.${_CLUSTER_INSTANCE} 2>/dev/null
|
||||||
log_hc "$0" 1 "${_MSG}"
|
[[ -s ${_CLUSTER_RUN_FILE}.${_CLUSTER_INSTANCE} ]] || {
|
||||||
# dump debug info
|
_MSG="unable to gather configuration for cluster instance ${_CLUSTER_INSTANCE}"
|
||||||
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
|
log_hc "$0" 1 "${_MSG}"
|
||||||
return 0
|
# dump debug info
|
||||||
}
|
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
|
||||||
|
return 1
|
||||||
|
}
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -119,7 +124,8 @@ fi
|
|||||||
for _CLUSTER_INSTANCE in ${_CLUSTER_INSTANCES}
|
for _CLUSTER_INSTANCE in ${_CLUSTER_INSTANCES}
|
||||||
do
|
do
|
||||||
awk -v cluster="${_CLUSTER_INSTANCE}" '
|
awk -v cluster="${_CLUSTER_INSTANCE}" '
|
||||||
BEGIN { found = 0; needle = "^\["cluster"\]" }
|
# ^ anchor not supported in all AWKs
|
||||||
|
BEGIN { found = 0; needle = "\["cluster"\]$" }
|
||||||
|
|
||||||
# skip blank lines
|
# skip blank lines
|
||||||
/^\s*$/ { next; }
|
/^\s*$/ { next; }
|
36
opt/hc/lib/platform/linux/check_linux_sg_cluster_status.sh → opt/hc/lib/platform/serviceguard/check_serviceguard_cluster_status.sh
Executable file → Normal file
36
opt/hc/lib/platform/linux/check_linux_sg_cluster_status.sh → opt/hc/lib/platform/serviceguard/check_serviceguard_cluster_status.sh
Executable file → Normal file
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env ksh
|
#!/usr/bin/env ksh
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
# @(#) check_linux_sg_cluster_status
|
# @(#) check_serviceguard_cluster_status
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
# @(#) Copyright (C) 2016 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
# @(#) Copyright (C) 2016 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
||||||
#
|
#
|
||||||
@ -16,37 +16,29 @@
|
|||||||
#
|
#
|
||||||
# DOCUMENTATION (MAIN)
|
# DOCUMENTATION (MAIN)
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# @(#) MAIN: check_linux_sg_cluster_status
|
# @(#) MAIN: check_serviceguard_cluster_status
|
||||||
# DOES: see _show_usage()
|
# DOES: see _show_usage()
|
||||||
# EXPECTS: see _show_usage()
|
# EXPECTS: see _show_usage()
|
||||||
# REQUIRES: data_comma2space(), dump_logs(), init_hc(), log_hc(), warn()
|
# REQUIRES: data_comma2space(), dump_logs(), init_hc(), log_hc(), warn()
|
||||||
#
|
#
|
||||||
# @(#) HISTORY:
|
# @(#) HISTORY:
|
||||||
# @(#) 2017-04-01: initial version [Patrick Van der Veken]
|
# @(#) 2017-04-20: merged HP-UX+Linux version [Patrick Van der Veken]
|
||||||
# @(#) 2017-05-07: made checks more detailed for log_hc() [Patrick Van der Veken]
|
|
||||||
# @(#) 2018-05-20: added dump_logs() [Patrick Van der Veken]
|
|
||||||
# @(#) 2018-05-21: STDERR fixes [Patrick Van der Veken]
|
|
||||||
# @(#) 2018-10-28: fixed (linter) errors [Patrick Van der Veken]
|
|
||||||
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
|
|
||||||
# @(#) 2019-03-09: changed format of stanzas in configuration file &
|
|
||||||
# @(#) added support for --log-healthy [Patrick Van der Veken]
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
function check_linux_sg_cluster_status
|
function check_serviceguard_cluster_status
|
||||||
{
|
{
|
||||||
# ------------------------- CONFIGURATION starts here -------------------------
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
||||||
typeset _VERSION="2019-03-09" # YYYY-MM-DD
|
typeset _VERSION="2019-04-20" # YYYY-MM-DD
|
||||||
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
|
typeset _SUPPORTED_PLATFORMS="HP-UX,Linux" # uname -s match
|
||||||
typeset _SG_DAEMON="/opt/cmcluster/bin/cmcld"
|
|
||||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
|
||||||
# set defaults
|
# set defaults
|
||||||
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
|
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
|
||||||
PATH=$PATH:/opt/cmcluster/bin
|
PATH=$PATH:/opt/cmcluster/bin # Linux
|
||||||
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
|
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
|
||||||
typeset _ARGS=$(data_comma2space "$*")
|
typeset _ARGS=$(data_comma2space "$*")
|
||||||
typeset _ARG=""
|
typeset _ARG=""
|
||||||
@ -112,6 +104,14 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# check & get serviceguard status
|
# check & get serviceguard status
|
||||||
|
case "${OS_NAME}" in
|
||||||
|
HP-UX)
|
||||||
|
typeset _SG_DAEMON="/usr/lbin/cmcld"
|
||||||
|
;;
|
||||||
|
Linux)
|
||||||
|
typeset _SG_DAEMON="/opt/cmcluster/bin/cmcld"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
if [[ ! -x ${_SG_DAEMON} ]]
|
if [[ ! -x ${_SG_DAEMON} ]]
|
||||||
then
|
then
|
||||||
warn "${_SG_DAEMON} is not installed here"
|
warn "${_SG_DAEMON} is not installed here"
|
||||||
@ -130,11 +130,11 @@ fi
|
|||||||
# do cluster status checks
|
# do cluster status checks
|
||||||
# (replace ':' by '|' for cmcviewcl output)
|
# (replace ':' by '|' for cmcviewcl output)
|
||||||
grep -E -e "^sg:" ${_CONFIG_FILE} 2>/dev/null | tr '|' ':' 2>/dev/null |\
|
grep -E -e "^sg:" ${_CONFIG_FILE} 2>/dev/null | tr '|' ':' 2>/dev/null |\
|
||||||
while read -r _ _SG_ENTRY
|
while IFS=":" read -r _ _SG_ENTRY
|
||||||
do
|
do
|
||||||
# field split
|
# field split
|
||||||
_SG_CFG_PARAM="$(print ${_SG_ENTRY} | cut -f1 -d'=' 2>/dev/null)" # field 1
|
_SG_CFG_PARAM=$(print "${_SG_ENTRY}" | cut -f1 -d'=' 2>/dev/null) # field 1
|
||||||
_SG_CFG_VALUE="$(print ${_SG_ENTRY} | cut -f2 -d'=' 2>/dev/null)" # field 2
|
_SG_CFG_VALUE=$(print "${_SG_ENTRY}" | cut -f2 -d'=' 2>/dev/null) # field 2
|
||||||
|
|
||||||
# check run-time values (anchored grep here!)
|
# check run-time values (anchored grep here!)
|
||||||
_SG_MATCH=$(grep -i "^${_SG_CFG_PARAM}" ${HC_STDOUT_LOG} 2>/dev/null)
|
_SG_MATCH=$(grep -i "^${_SG_CFG_PARAM}" ${HC_STDOUT_LOG} 2>/dev/null)
|
60
opt/hc/lib/platform/linux/check_linux_sg_package_config.sh → opt/hc/lib/platform/serviceguard/check_serviceguard_package_config.sh
Executable file → Normal file
60
opt/hc/lib/platform/linux/check_linux_sg_package_config.sh → opt/hc/lib/platform/serviceguard/check_serviceguard_package_config.sh
Executable file → Normal file
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env ksh
|
#!/usr/bin/env ksh
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
# @(#) check_linux_sg_package_config
|
# @(#) check_serviceguard_package_config
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
# @(#) Copyright (C) 2016 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
# @(#) Copyright (C) 2016 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
||||||
#
|
#
|
||||||
@ -16,36 +16,31 @@
|
|||||||
#
|
#
|
||||||
# DOCUMENTATION (MAIN)
|
# DOCUMENTATION (MAIN)
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# @(#) MAIN: check_linux_sg_package_config
|
# @(#) MAIN: check_serviceguard_package_config
|
||||||
# DOES: see _show_usage()
|
# DOES: see _show_usage()
|
||||||
# EXPECTS: see _show_usage()
|
# EXPECTS: see _show_usage()
|
||||||
# REQUIRES: data_comma2space(), dump_logs(), init_hc(), log_hc(), warn()
|
# REQUIRES: data_comma2space(), dump_logs(), init_hc(), log_hc(), warn()
|
||||||
#
|
#
|
||||||
# @(#) HISTORY:
|
# @(#) HISTORY:
|
||||||
# @(#) 2017-04-01: initial version [Patrick Van der Veken]
|
# @(#) 2019-04-20: merged HP-UX+Linux version [Patrick Van der Veken]
|
||||||
# @(#) 2018-05-21: added dump_logs() & other fixes [Patrick Van der Veken]
|
|
||||||
# @(#) 2018-10-28: fixed (linter) errors [Patrick Van der Veken]
|
|
||||||
# @(#) 2018-11-18: do not trap on signal 0 [Patrick Van der Veken]
|
|
||||||
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
function check_linux_sg_package_config
|
function check_serviceguard_package_config
|
||||||
{
|
{
|
||||||
# ------------------------- CONFIGURATION starts here -------------------------
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
||||||
typeset _VERSION="2019-01-24" # YYYY-MM-DD
|
typeset _VERSION="2019-04-20" # YYYY-MM-DD
|
||||||
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
|
typeset _SUPPORTED_PLATFORMS="HP-UX,Linux" # uname -s match
|
||||||
typeset _SG_DAEMON="/opt/cmcluster/bin/cmcld"
|
|
||||||
# rubbish that cmgetconf outputs to STDOUT instead of STDERR
|
# rubbish that cmgetconf outputs to STDOUT instead of STDERR
|
||||||
typeset _SG_CMGETCONF_FILTER="Permission denied|Number of configured"
|
typeset _SG_CMGETCONF_FILTER="Permission denied|Number of configured"
|
||||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
|
||||||
# set defaults
|
# set defaults
|
||||||
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
|
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
|
||||||
PATH=$PATH:/opt/cmcluster/bin
|
PATH=$PATH:/opt/cmcluster/bin # Linux
|
||||||
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
|
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
|
||||||
typeset _ARGS=$(data_comma2space "$*")
|
typeset _ARGS=$(data_comma2space "$*")
|
||||||
typeset _ARG=""
|
typeset _ARG=""
|
||||||
@ -61,10 +56,6 @@ typeset _PKG_MATCH=""
|
|||||||
typeset _PKG_PARAM=""
|
typeset _PKG_PARAM=""
|
||||||
typeset _PKG_VALUE=""
|
typeset _PKG_VALUE=""
|
||||||
|
|
||||||
# set local trap for cleanup
|
|
||||||
# shellcheck disable=SC2064
|
|
||||||
trap "rm -f ${_PKG_RUN_FILE}.* ${_PKG_CFG_FILE}.* >/dev/null 2>&1; return 1" 1 2 3 15
|
|
||||||
|
|
||||||
# handle arguments (originally comma-separated)
|
# handle arguments (originally comma-separated)
|
||||||
for _ARG in ${_ARGS}
|
for _ARG in ${_ARGS}
|
||||||
do
|
do
|
||||||
@ -75,7 +66,11 @@ do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# handle config file
|
# set local trap for cleanup
|
||||||
|
# shellcheck disable=SC2064
|
||||||
|
trap "rm -f ${_PKG_RUN_FILE}.* ${_PKG_CFG_FILE}.* >/dev/null 2>&1; return 1" 1 2 3 15
|
||||||
|
|
||||||
|
# handle configuration file
|
||||||
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
|
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
|
||||||
if [[ ! -r ${_CONFIG_FILE} ]]
|
if [[ ! -r ${_CONFIG_FILE} ]]
|
||||||
then
|
then
|
||||||
@ -96,6 +91,14 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# check serviceguard status & gather package information from running cluster (compressed lines)
|
# check serviceguard status & gather package information from running cluster (compressed lines)
|
||||||
|
case "${OS_NAME}" in
|
||||||
|
HP-UX)
|
||||||
|
typeset _SG_DAEMON="/usr/lbin/cmcld"
|
||||||
|
;;
|
||||||
|
Linux)
|
||||||
|
typeset _SG_DAEMON="/opt/cmcluster/bin/cmcld"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
if [[ ! -x ${_SG_DAEMON} ]]
|
if [[ ! -x ${_SG_DAEMON} ]]
|
||||||
then
|
then
|
||||||
warn "${_SG_DAEMON} is not installed here"
|
warn "${_SG_DAEMON} is not installed here"
|
||||||
@ -103,15 +106,17 @@ then
|
|||||||
else
|
else
|
||||||
for _PKG_INSTANCE in ${_PKG_INSTANCES}
|
for _PKG_INSTANCE in ${_PKG_INSTANCES}
|
||||||
do
|
do
|
||||||
cmgetconf -p ${_PKG_INSTANCE} -v 0 2>>${HC_STDERR_LOG} |\
|
# dump configuration information in compressed format
|
||||||
grep -v -E -e "${_SG_CMGETCONF_FILTER}" | tr -d ' \t' >${_PKG_RUN_FILE}.${_PKG_INSTANCE}
|
cmgetconf -p ${_PKG_INSTANCE} -v 0 2>>${HC_STDERR_LOG} |\
|
||||||
[[ -s ${_PKG_RUN_FILE}.${_PKG_INSTANCE} ]] || {
|
grep -v -E -e "${_SG_CMGETCONF_FILTER}" |\
|
||||||
_MSG="unable to gather package configuration for at least one cluster package"
|
tr -d ' \t' >${_PKG_RUN_FILE}.${_PKG_INSTANCE} 2>/dev/null
|
||||||
log_hc "$0" 1 "${_MSG}"
|
[[ -s ${_PKG_RUN_FILE}.${_PKG_INSTANCE} ]] || {
|
||||||
# dump debug info
|
_MSG="unable to gather configuration for cluster package ${_PKG_INSTANCE}"
|
||||||
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
|
log_hc "$0" 1 "${_MSG}"
|
||||||
return 0
|
# dump debug info
|
||||||
}
|
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
|
||||||
|
return 1
|
||||||
|
}
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -119,7 +124,8 @@ fi
|
|||||||
for _PKG_INSTANCE in ${_PKG_INSTANCES}
|
for _PKG_INSTANCE in ${_PKG_INSTANCES}
|
||||||
do
|
do
|
||||||
awk -v package="${_PKG_INSTANCE}" '
|
awk -v package="${_PKG_INSTANCE}" '
|
||||||
BEGIN { found = 0; needle = "^\["package"\]" }
|
# ^ anchor not supported in all AWKs
|
||||||
|
BEGIN { found = 0; needle = "\["package"\]$" }
|
||||||
|
|
||||||
# skip blank lines
|
# skip blank lines
|
||||||
/^\s*$/ { next; }
|
/^\s*$/ { next; }
|
38
opt/hc/lib/platform/linux/check_linux_sg_package_status.sh → opt/hc/lib/platform/serviceguard/check_serviceguard_package_status.sh
Executable file → Normal file
38
opt/hc/lib/platform/linux/check_linux_sg_package_status.sh → opt/hc/lib/platform/serviceguard/check_serviceguard_package_status.sh
Executable file → Normal file
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env ksh
|
#!/usr/bin/env ksh
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
# @(#) check_linux_sg_package_status
|
# @(#) check_serviceguard_package_status
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
# @(#) Copyright (C) 2016 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
# @(#) Copyright (C) 2016 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
||||||
#
|
#
|
||||||
@ -16,37 +16,29 @@
|
|||||||
#
|
#
|
||||||
# DOCUMENTATION (MAIN)
|
# DOCUMENTATION (MAIN)
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# @(#) MAIN: check_linux_sg_package_status
|
# @(#) MAIN: check_serviceguard_package_status
|
||||||
# DOES: see _show_usage()
|
# DOES: see _show_usage()
|
||||||
# EXPECTS: see _show_usage()
|
# EXPECTS: see _show_usage()
|
||||||
# REQUIRES: data_comma2space(), dump_logs(), init_hc(), log_hc(), warn()
|
# REQUIRES: data_comma2space(), dump_logs(), init_hc(), log_hc(), warn()
|
||||||
#
|
#
|
||||||
# @(#) HISTORY:
|
# @(#) HISTORY:
|
||||||
# @(#) 2017-04-01: initial version [Patrick Van der Veken]
|
# @(#) 2019-04-20: merged HP-UX+Linux version [Patrick Van der Veken]
|
||||||
# @(#) 2017-05-07: made checks more detailed for log_hc() [Patrick Van der Veken]
|
|
||||||
# @(#) 2018-05-20: added dump_logs() [Patrick Van der Veken]
|
|
||||||
# @(#) 2018-05-21: STDERR fixes [Patrick Van der Veken]
|
|
||||||
# @(#) 2018-10-28: fixed (linter) errors [Patrick Van der Veken]
|
|
||||||
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
|
|
||||||
# @(#) 2019-03-09: changed format of stanzas in configuration file &
|
|
||||||
# @(#) added support for --log-healthy [Patrick Van der Veken]
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
function check_linux_sg_package_status
|
function check_serviceguard_package_status
|
||||||
{
|
{
|
||||||
# ------------------------- CONFIGURATION starts here -------------------------
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
||||||
typeset _VERSION="2019-03-09" # YYYY-MM-DD
|
typeset _VERSION="2019-04-20" # YYYY-MM-DD
|
||||||
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
|
typeset _SUPPORTED_PLATFORMS="HP-UX,Linux" # uname -s match
|
||||||
typeset _SG_DAEMON="/opt/cmcluster/bin/cmcld"
|
|
||||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
|
||||||
# set defaults
|
# set defaults
|
||||||
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
|
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
|
||||||
PATH=$PATH:/opt/cmcluster/bin
|
PATH=$PATH:/opt/cmcluster/bin # Linux
|
||||||
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
|
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
|
||||||
typeset _ARGS=$(data_comma2space "$*")
|
typeset _ARGS=$(data_comma2space "$*")
|
||||||
typeset _ARG=""
|
typeset _ARG=""
|
||||||
@ -113,6 +105,14 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# check & get serviceguard status
|
# check & get serviceguard status
|
||||||
|
case "${OS_NAME}" in
|
||||||
|
HP-UX)
|
||||||
|
typeset _SG_DAEMON="/usr/lbin/cmcld"
|
||||||
|
;;
|
||||||
|
Linux)
|
||||||
|
typeset _SG_DAEMON="/opt/cmcluster/bin/cmcld"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
if [[ ! -x ${_SG_DAEMON} ]]
|
if [[ ! -x ${_SG_DAEMON} ]]
|
||||||
then
|
then
|
||||||
warn "${_SG_DAEMON} is not installed here"
|
warn "${_SG_DAEMON} is not installed here"
|
||||||
@ -131,12 +131,12 @@ fi
|
|||||||
# do package status checks
|
# do package status checks
|
||||||
# (replace ':' by '|' for cmcviewcl output)
|
# (replace ':' by '|' for cmcviewcl output)
|
||||||
grep -E -e "^sg:" ${_CONFIG_FILE} 2>/dev/null | tr '|' ':' 2>/dev/null |\
|
grep -E -e "^sg:" ${_CONFIG_FILE} 2>/dev/null | tr '|' ':' 2>/dev/null |\
|
||||||
while read -r _ _SG_ENTRY
|
while IFS=":" read -r _ _SG_ENTRY
|
||||||
do
|
do
|
||||||
# field split
|
# field split
|
||||||
_SG_PACKAGE="$(print ${_SG_ENTRY} | cut -f1 -d':')"
|
_SG_PACKAGE=$(print "${_SG_ENTRY}" | cut -f1 -d':')
|
||||||
_SG_CFG_PARAM="$(print ${_SG_ENTRY} | cut -f2- -d':' 2>/dev/null | cut -f1 -d'=' 2>/dev/null)" # field 2-,1
|
_SG_CFG_PARAM=$(print "${_SG_ENTRY}" | cut -f2- -d':' 2>/dev/null | cut -f1 -d'=' 2>/dev/null) # field 2-,1
|
||||||
_SG_CFG_VALUE="$(print ${_SG_ENTRY} | cut -f2- -d':' 2>/dev/null | cut -f2 -d'=' 2>/dev/null)" # field 2-,2
|
_SG_CFG_VALUE=$(print "${_SG_ENTRY}" | cut -f2- -d':' 2>/dev/null | cut -f2 -d'=' 2>/dev/null) # field 2-,2
|
||||||
|
|
||||||
# check run-time values (anchored grep here!)
|
# check run-time values (anchored grep here!)
|
||||||
_SG_MATCH=$(grep -i "^package:${_SG_PACKAGE}:${_SG_CFG_PARAM}" ${HC_STDOUT_LOG} 2>/dev/null)
|
_SG_MATCH=$(grep -i "^package:${_SG_PACKAGE}:${_SG_CFG_PARAM}" ${HC_STDOUT_LOG} 2>/dev/null)
|
27
opt/hc/lib/platform/linux/check_linux_sg_qs_status.sh → opt/hc/lib/platform/serviceguard/check_serviceguard_qs_status.sh
Executable file → Normal file
27
opt/hc/lib/platform/linux/check_linux_sg_qs_status.sh → opt/hc/lib/platform/serviceguard/check_serviceguard_qs_status.sh
Executable file → Normal file
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env ksh
|
#!/usr/bin/env ksh
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
# @(#) check_linux_sg_qs_status.sh
|
# @(#) check_serviceguard_qs_status.sh
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
# @(#) Copyright (C) 2017 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
# @(#) Copyright (C) 2017 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
||||||
#
|
#
|
||||||
@ -16,28 +16,23 @@
|
|||||||
#
|
#
|
||||||
# DOCUMENTATION (MAIN)
|
# DOCUMENTATION (MAIN)
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# @(#) MAIN: check_linux_sg_qs_status
|
# @(#) MAIN: check_serviceguard_qs_status
|
||||||
# DOES: see _show_usage()
|
# DOES: see _show_usage()
|
||||||
# EXPECTS: n/a
|
# EXPECTS: n/a
|
||||||
# REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
|
# REQUIRES: data_comma2space(), init_hc(), log_hc(), warn()
|
||||||
#
|
#
|
||||||
# @(#) HISTORY:
|
# @(#) HISTORY:
|
||||||
# @(#) 2017-05-01: initial version [Patrick Van der Veken]
|
# @(#) 2019-04-20: merged HP-UX+Linux version [Patrick Van der Veken]
|
||||||
# @(#) 2018-05-21: STDERR fixes [Patrick Van der Veken]
|
|
||||||
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
|
|
||||||
# @(#) 2019-03-09: added support for --log-healthy [Patrick Van der Veken]
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
function check_linux_sg_qs_status
|
function check_serviceguard_qs_status
|
||||||
{
|
{
|
||||||
# ------------------------- CONFIGURATION starts here -------------------------
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
typeset _VERSION="2019-03-09" # YYYY-MM-DD
|
typeset _VERSION="2019-04-20" # YYYY-MM-DD
|
||||||
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
|
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
|
||||||
typeset _QS_BIN="/opt/qs/bin/qsc"
|
|
||||||
typeset _QS_AUTH_FILE="/opt/qs/conf/qs_authfile"
|
|
||||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
|
||||||
# set defaults
|
# set defaults
|
||||||
@ -73,6 +68,18 @@ else
|
|||||||
log "not logging/showing passed health checks"
|
log "not logging/showing passed health checks"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# set OS specific parameters
|
||||||
|
case "${OS_NAME}" in
|
||||||
|
HP-UX)
|
||||||
|
typeset _QS_BIN="/usr/lbin/qsc"
|
||||||
|
typeset _QS_AUTH_FILE="/etc/cmcluster/qs_authfile"
|
||||||
|
;;
|
||||||
|
Linux)
|
||||||
|
typeset _QS_BIN="/opt/qs/bin/qsc"
|
||||||
|
typeset _QS_AUTH_FILE="/opt/qs/conf/qs_authfile"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# check QS presence
|
# check QS presence
|
||||||
if [[ ! -x ${_QS_BIN} ]]
|
if [[ ! -x ${_QS_BIN} ]]
|
||||||
then
|
then
|
Loading…
x
Reference in New Issue
Block a user