Lidor Aviman
Lidor Aviman

Reputation: 91

HA - Pacemaker - How to insert custom error message to my custom resource failure ?

I using Pacemaker + Corosync in Centos7 , I create my own resource agent and create a custom resource that run some scripts that I have.

inside my resource agent I have monitor function that checking something each x minutes and when this monitor function failed I return "OCF_ERR_GENERIC" and therefore all the reosurce failed.

When I execute the command "PCS status" I can see that the resource stopped/Failed and also can see in the Failed Actions a message about what failed with "unknown error":

[root@pcmk01 opt]# pcs status
Cluster name: opt_cluster
Stack: corosync
Current DC: pcmk02-cr (version 1.1.15-11.el7_3.2-e174ec8) - partition with quorum
Last updated: Mon Jan 30 10:21:36 2017          Last change: Mon Jan 30 10:15:46 2017 by hacluster via crmd on pcmk02-cr

2 nodes and 5 resources configured

Online: [ pcmk01-cr pcmk02-cr ]

Full list of resources:

 Master/Slave Set: myoptClone01 [myopt_data01]
     Masters: [ pcmk01-cr ]
     Slaves: [ pcmk02-cr ]
 myopt_fs01     (ocf::heartbeat:Filesystem):    Started pcmk01-cr
 myopt_VIP01    (ocf::heartbeat:IPaddr2):       Started pcmk01-cr
 ServicesResource        (ocf::heartbeat:RADviewServices):       Stopped

Failed Actions:
* ServicesResource_monitor_120000 on pcmk02-cr **'unknown error'** (1): call=141, status=complete, exitreason='none',
    last-rc-change='Mon Jan 30 10:19:36 2017', queued=0ms, exec=142ms

Is there a way to insert my own error message instead of this "unknown error" message???

Upvotes: 1

Views: 548

Answers (1)

Dok
Dok

Reputation: 446

I don't believe there is anyway to get a more descriptive error within the output of crm_mon or pcs status. However, the errors within these outputs do put a timestamp on the failure. Within your custom resource agent you can output whatever you please to the logs during errors. You may then check the logs around the timestamp shown in the pcs status output to get more precise information regarding the failure.

Upvotes: 2

Related Questions