[Linux-HA] What should 'monitor' do?

Alan Robertson alanr at unix.sh
Tue Oct 18 14:23:50 MDT 2005

Sun, Xun wrote:
> Hi Adam,
> 在2005年10月05日的21:52,Adam Moffett写道:
>>If I create a resource script with a monitor action, what should it 
>>report when asked to 'monitor'?
> Do you mean ocf resource script? If so, the only thing that matters is
> the return code. All your 'monitor' operation needs to do is:
> If resource is working, then
> 	return $OCF_SUCCESS
> else
> 	return $OCF_NOT_RUNNING
>>I looked at the IPaddr resource and it reports either "OK" or "down".  
>>Whereas the Apache resource either returns a status of 1 (true) or 
>>something like "httpd not running".
> In shell world, 0 means true, and nonzero (not necessarily 1) means
> false.
>>So I'm guessing there's multiple results that can mean the resource is 
>>doing alright and anything else means the resource is not alright.  Is 
>>that accurate?
>>How is this better/different from the "status" operation?
> No operation is better than the other. But 'monitor' operation is used
> by resource manager to monitor the resource, while 'status' is not a
> mandatory operation.

The real difference is that monitor is our "own" resource action, and we 
can make it do anything we want it to do.  And, monitor can also be 
given various levels of "depth" for monitoring, whereas status has a 
well-defined meaning that we can't change.

     Alan Robertson <alanr at unix.sh>

"Openness is the foundation and preservative of friendship...  Let me 
claim from you at all times your undisguised opinions." - William 

More information about the Linux-HA mailing list