#!@BASH_SHELL@ # # Copyright (C) 2021 Red Hat, Inc. All rights reserved. # # Authors: Christine Caulfield # Fabio M. Di Nitto # # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # # This program is distributed in the hope that it would be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # Further, this software is distributed without any warranty that it is # free of the rightful claim of any third person regarding infringement # or the like. Any license provided herein, whether implied or # otherwise, applies only to this software file. Patent licenses, if # any, provided herein do not apply to combinations of this program with # other software, or any other product whatsoever. # # You should have received a copy of the GNU General Public License # along with this program; if not, write the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. # # # Checks storage I/O status of all given drives and writes the #health-storage # status into the CIB # Implementation is heavily based on ocf:pacemaker:HealtSMART # # It sends a single block on IO to a radom location on the device and reports any errors returned. # If the IO hangs, that will also be returned. (bear in mind tha tmay also hang the C app in some # instances). # # It's worth making a note in the RA description that the smartmon RA is also recommended (this # does not replace it), and that Pacemaker health checking should be configued. # # https://clusterlabs.org/pacemaker/doc/2.1/Pacemaker_Explained/singlehtml/index.html#tracking-node-health ####################################################################### ####################################################################### # Initialization: : ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat} . ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs # STORAGEMON=$HA_BIN/storage_mon ATTRDUP=/usr/sbin/attrd_updater OCF_RESKEY_CRM_meta_interval_default="0" OCF_RESKEY_io_timeout_default="10" OCF_RESKEY_inject_errors_default="" OCF_RESKEY_state_file_default="${HA_RSCTMP%%/}/storage-mon-${OCF_RESOURCE_INSTANCE}.state" # Explicitly list all environment variables used, to make static analysis happy : ${OCF_RESKEY_CRM_meta_interval:=${OCF_RESKEY_CRM_meta_interval_default}} : ${OCF_RESKEY_drives:=""} : ${OCF_RESKEY_io_timeout:=${OCF_RESKEY_io_timeout_default}} : ${OCF_RESKEY_inject_errors:=${OCF_RESKEY_inject_errors_default}} : ${OCF_RESKEY_state_file:=${OCF_RESKEY_state_file_default}} ####################################################################### meta_data() { cat < 1.0 System health agent that checks the storage I/O status of the given drives and updates the #health-storage attribute. Usage is highly recommended in combination with storage-mon monitoring agent. The agent currently support a maximum of 25 devices per instance. storage I/O health status Location to store the resource state in. State file The drive(s) to check as a SPACE separated list. Enter the full path to the device, e.g. "/dev/sda". Drives to check Specify disk I/O timeout in seconds. Minimum 1, recommeded 10 (default). Disk I/O timeout Used only for testing! Specify % of I/O errors to simulate drives failures. Specify % of I/O errors to simulate drives failures END return $OCF_SUCCESS } ####################################################################### storage-mon_usage() { cat <