[Pacemaker] Re: How can stonith-plugins send messages to ha-log?

Dejan Muhamedagic dejanmm at fastmail.fm
Thu Sep 25 11:46:56 UTC 2008


Hi Takenaka-san,

On Thu, Sep 25, 2008 at 05:03:39PM +0900, Takenaka Kazuhiro wrote:
> Hi, Dejan
>
> Thanks for your reply.
>
> >> > If there is a similar function to 'ocf_log' for stonith-plugins,
> >> > I think it must be handy. Or I should simply have my stonith-plugins
> >> > use 'ocf_log'?
> >
> > Yes.
>
> I suspected a bit that 'stonithd' might not pass some of enviroment
> valiables to plugins, So I tried to check it out and found that
> 'HA_LOGD' wasn't given to plugins.
>
> I wrote the following statements into my plugin.
>
> . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
> ha_logger -t INFO -D ha-log "Sending a message by ha_logger"
> ocf_log INFO "Sending a message by ocf_log"
>
> Then I ran my cluster and watched /var/log/ha-log. The messages of
> 'ha_logger' appeared in 'ha-log', but those of 'ocf_log' did not.
> Because 'ha_log' (called by ocf_log) doesn't use 'ha_logger' when
> 'HA_LOGD' isn't defined.
>
> One way is to change 'stonithd' to pass 'HA_LOGD' to plugins.

Yes, but I'd still prefer to capture the messages on
stdout/stderr.

> Or plugins should use 'ha_logger' directly?

That probably won't do, since the setups without ha_logd are
possible.

> > Though the preferable way would be to have the parent plugin
> > (external.c) collect the output and send it to the logger, in the
> > same way the lrmd does with resource agents.
>
> I think the way you suggested is also a possible choice.
>
> Actually, some existing plugins expect this function. They use 'echo'
> to put their messages. But currently, those messages are sent to
> 'ha-debug', not 'ha-log'.

I suspect that that would be the simplest way, i.e. to enable
logging of stdout/stderr from the external stonith plugins. Note
also that the plugins may be used from the command line, through
the stonith program. In that case it wouldn't be optimal to send
messages to the logs.

I'd suggest to open an enhancement bugzilla.

Thanks,

Dejan

>> Hi,
>>
>> On Wed, Sep 24, 2008 at 04:14:03PM +0900, Takenaka Kazuhiro wrote:
>>> > Hi all.
>>> > > I looked through stonith-plugins in /usr/lib/stonith/plugins/external
>>> > to find out stonith-plugins' official way to send their messages to
>>> > ha-log, but I couldn't find it.
>>> > > If there is a similar function to 'ocf_log' for stonith-plugins,
>>> > I think it must be handy. Or I should simply have my stonith-plugins
>>> > use 'ocf_log'?
>>
>> Yes.
>>
>> Though the preferable way would be to have the parent plugin
>> (external.c) collect the output and send it to the logger, in the
>> same way the lrmd does with resource agents.
>>
>> Thanks,
>>
>> Dejan
>>
>>> > Best regards.
>>> > -- > Takenaka Kazuhiro <takenaka.kazuhiro at oss.ntt.co.jp>
>>> > > _______________________________________________
>>> > Pacemaker mailing list
>>> > Pacemaker at clusterlabs.org
>>> > http://list.clusterlabs.org/mailman/listinfo/pacemaker
>>
>> _______________________________________________
>> Pacemaker mailing list
>> Pacemaker at clusterlabs.org
>> http://list.clusterlabs.org/mailman/listinfo/pacemaker
>
> -- 
> Takenaka Kazuhiro <takenaka.kazuhiro at oss.ntt.co.jp>
>
> _______________________________________________
> Pacemaker mailing list
> Pacemaker at clusterlabs.org
> http://list.clusterlabs.org/mailman/listinfo/pacemaker




More information about the Pacemaker mailing list