Where can I find resources to help me create a custom resource agent scripts for Red Hat High Availability clusters?
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( orclurgmgrd)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
rgmanagerorpacemaker.
Resolution
- Open Cluster Framework (OCF) definitions, specifications and documentation are available here:
- Note there are 2 variations from the OCF standard used by
rgmanager(orclurgmgrd):rgmanagerdoes not call monitor; it only calls status.rgmanagerlooks for resource agents in/usr/share/cluster.
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.el8or 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.el9or 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
- Open Cluster Framework is a standard that extends Content from clusterlabs.org is not included.LSB Resource Agents.
- Custom resource agents should be OCF-compliant to ensure they are compatible with
rgmanagerorpacemaker.
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.
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.