Creating custom service for redhat cluster

Often you need to add new services to your redhat clusters and unfortunately you don’t have a ready to use OCF resource agent eg:Jboss.

The redhat docs are not useful (forget about, forever) so i had to discover the way by myself; here the results.

The resource agents

OCF defines some standards like node comunication and messages (here the list), it defines also the way resource agents manage services through cluster commands (start,stop,status,etc) and return codes; described here.

You can see from docs the way your agent have to respond to commands, this is also defined inside the meta-data file that describes all parameters your agent need.

Pay attention to the meta-data command, it must return an XML the describes the agents parameters, inside the scripts these parameters have the format: $OCF_RESKEY_parameterName.


Cluster.conf and ccs

Now we have to insert your new resource into cluster.conf to sync your configuration with ricci/luci.

Cluster.conf must be compliant to the /usr/share/clustercluster.rng schema, add the following to the file for a test:

 <define name="CUSTOMRES">
    <element name="customres" rha:description="Custom resource">
        <!-- rgmanager specific stuff -->
        <attribute name="ref" rha:description="Reference to existing resource in the resources section."/>
        <attribute name="name" rha:description="Instance name"/>
        <attribute name="user" rha:description="Custom user"/>
        <attribute name="home" rha:description="Custom home"/>
        <attribute name="__independent_subtree" rha:description="Treat this and all children as an independent subtree."/>
        <attribute name="__enforce_timeouts" rha:description="Consider a timeout for operations as fatal."/>
        <attribute name="__max_failures" rha:description="Maximum number of failures before returning a failure to a status check."/>
        <attribute name="__failure_expire_time" rha:description="Amount of time before a failure is forgotten."/>
        <attribute name="__max_restarts" rha:description="Maximum number restarts for an independent subtree before giving up."/>
        <attribute name="__restart_expire_time" rha:description="Amount of time before a failure is forgotten for an independent subtree."/>
        <ref name="CHILDREN"/>

10 Replies to “Creating custom service for redhat cluster”

  1. Hello Simone,

    I have been trying to create a custom resource agent for my WS MQ queue managers. Although I have followed your directions precisely nut it seems that I am not able to make the resource appear in Luci Web app.
    I have created the and saved it in the /usr/share/cluster directory and updated the /etc/cluster/cluster.conf file with the appropriate section as you have suggested.
    I did not understand what updates you meant by ccs (which file?)
    Unfortunately the new resource agent was not advertised into Luci.
    It is very important for me to complete successful this job so I need some help here please

    Thank you in advance

    Dimitris Grammatikos

  2. You have to edit the schema file /usr/share/clustercluster.rng to add a custom resource…

    I suggest you (if you are in hurry) to use the “script” resource type to use your script.

  3. Hello Simone,

    though I have to second that the official docs from treating RHCS cluster administration are of little help when it comes to extending the pack of distributed resource agents (RAs) in /usr/share/cluster by one’s own custom RAs, I find your little howto a bit too terse to be much more helpful than the former either.

    I also struggled a bit until I found out that one needs to modify the file that defines the XML schema applicable in the cluster.conf file, or otherwise the XML parser that is invoked prior to checking in a new version of cluster.conf via the “ccs_tool update /etc/cluster/cluster.conf” command.
    (n.b. I don’t use Ricci/Luci for cluster administration at all, so I don’t know if beyond that some more fiddling with some other RHCS Python code is required before one’s custom RA would show up in Luci).

    Anyway, besides adapting it is of course also required to write the custom RA itself before anything useful will happen.
    You correctly mentioned that if one was in a hurry one should better resort to the generic RA
    The advantage of a custom RA for an application/service that hasn’t been covered by the RH developers yet is that you can pass it appropriate parameters that you defined in the XML schema and the RA’s meta-data dump to make the configuration more flexible rather than hard coding stuff in a “script” RA script.
    A good reference how such a custom RA should be written can be found in Florian Haas’ “OCF RA Developer’s Guide”:


    1. Hi Ralph,
      my intent wasn’t to write a complete guide, i liked to give only a simple hint on “where to put hands”.
      I think if someone needs a custom RA integrated with Luci/Ricci/ccs he is skilled enough to write a script; i think the integration itself with RHCS is not documented (even in the link you u posted, which i already know).

  4. Very great post. I simply stumbled upon your weblog and wanted to say
    that I’ve truly enjoyed browsing your blog posts. After all I will be subscribing on your feed and I’m hoping
    you write once more soon!

  5. Howdy would you mind letting me know which hosting company you’re using?
    I’ve loaded your blog in 3 completely different web browsers and I must say this blog loads a lot quicker then most.
    Can you suggest a good hosting provider at a honest price?
    Kudos, I appreciate it!

  6. My developer is trying to convince me to move to .net from PHP.

    I have always disliked the idea because of the costs. But he’s
    tryiong none the less. I’ve been using Movable-type on numerous websites for about a year and am worried about switching
    to another platform. I have heard very good things about Is there a way I can import all my wordpress content
    into it? Any help would be really appreciated!

  7. whoah this blog is magnificent i like studying your articles.
    Keep up tthe ood work! You realize, a lott of persons
    are searchjing round for this info, you could help them greatly.

Leave a Reply

Your e-mail address will not be published. Required fields are marked *