Where can I find resources to help me create a custom resource agent scripts for Red Hat High Availability clusters?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux (RHEL) including:
    • Red Hat Enterprise Linux Server 5 and 6 with the High Availability Add on or Resilient Storage Add on
    • Red Hat Enterprise Linux Server 6, 7,8, 9 with the High Availability Add on or Resilient Storage Add on with Pacemaker
  • Resources managed by either:
    • rgmanager ( or clurgmgrd)
    • pacemaker

Issue

  • Where can I find resources to help me write custom resource agent scripts for Red Hat Cluster Suite clusters?
  • Need assistance for creating a custom script resource agent to be used rgmanager or pacemaker.

Resolution


Red Hat Enterprise Linux 8

  • The issue (bugzilla bug: 2103370) has been resolved with the errata RHBA-2022:7443 with the following package(s): resource-agents-4.9.0-29.el8, resource-agents-paf-4.9.0-29.el8, resource-agents-aliyun-4.9.0-29.el8, resource-agents-gcp-4.9.0-29.el8 or later.

Red Hat Enterprise Linux 9

  • The issue (bugzilla bug: 2103374) has been resolved with the errata RHBA-2022:7932 with the following package(s): resource-agents-paf-4.10.0-23.el9, resource-agents-4.10.0-23.el9, resource-agents-cloud-4.10.0-23.el9 or later.

With the following errata a new tool called ocf-tester is included with the resource-agents package. This tool allows you to test if a custom or 3rd party resource-agent is OCF compliant.

Testing a resource-agent that passes the testing:

# ocf-tester -n apachetest /usr/lib/ocf/resource.d/heartbeat/apache
Beginning tests for /usr/lib/ocf/resource.d/heartbeat/apache...
* Your agent does not support the notify action (optional)
* Your agent does not support the demote action (optional)
* Your agent does not support the promote action (optional)
* Your agent does not support promotable clones (optional)
* Your agent does not support the reload action (optional)
/usr/lib/ocf/resource.d/heartbeat/apache passed all tests

Testing a resource-agent that fails the testings because it is missing configuration files.

# ocf-tester -n testname -o httpd=/usr/sbin/nginx /usr/lib/ocf/resource.d/heartbeat/nginx 
Beginning tests for /usr/lib/ocf/resource.d/heartbeat/nginx...
* rc=2: Validation failed.  Did you supply enough options with -o ?
ls: cannot access '/etc/nginx/conf.d/*.conf': No such file or directory
ls: cannot access '/etc/nginx/default.d/*.conf': No such file or directory
ls: cannot access '/etc/nginx/conf.d/*.conf': No such file or directory
ls: cannot access '/etc/nginx/default.d/*.conf': No such file or directory
ERROR: Invalid STATUSURL http://localhost:80
Aborting tests

Root Cause

Diagnostic Steps

This solution may apply to you if you need to create a custom resource agent for a service that will be managed by rgmanager or pacemaker.

SBR
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.