Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux-HA: Dev

An OCF RA for syslog-ng

 

 

Linux-HA dev RSS feed   Index | Next | Previous | View Threaded


takenaka.kazuhiro at oss

Mar 18, 2009, 9:27 PM

Post #1 of 22 (5016 views)
Permalink
An OCF RA for syslog-ng

Hello All,

I made an OCF RA for syslog-ng and attached it to this message.

I confirmed that it can work with no problem in the following cases.

* Creating a resource instance
- This RA can invoke a new syslog-ng process as an OCF resource
with starting Heartbeat. This works independently of the system
syslog-ng process.
"system process" means that it's managed by RC script.

* Terminating a resource instance
- This RA can revoke a working syslog-ng process as an OCF resource
with stopping Heartbeat. This works independently of the system
syslog-ng process.

* Failing over a resource instance at its start failure
- When the syslog-ng command returns a error status due to a wrong
syslog-ng configuration file, this RA can exit with an error status.
Then a resource instance restarts on the SBY node.

* Failing over a resource instance at its monitor failure
- When a syslog-ng of a working resource instance disappears,
this RA returns an error status as a result of its monitor action.
Then a resource instance restarts on the SBY node.

* Relocation
- If the crm_resource command is performed to relocate a working
syslog-ng resource, this RA can respond the request.

These tests were carried out under the following enviroment.

2 node cluster(ACT/SBY) with
Redhat 5.2(i386)
heartbeat 2.1.4
syslog-ng 2.1.3

I appreciate any comments.

Best reagard.
--
Takenaka Kazuhiro <takenaka.kazuhiro [at] oss>
Attachments: syslog-ng (13.5 KB)


dejanmm at fastmail

Mar 19, 2009, 1:30 AM

Post #2 of 22 (4878 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

Hi Takenaka-san,

Many thanks for the contribution. I will take a look at it and
probably get back to you with comments.

Cheers,

Dejan

On Thu, Mar 19, 2009 at 01:27:19PM +0900, Takenaka Kazuhiro wrote:
> Hello All,
>
> I made an OCF RA for syslog-ng and attached it to this message.
>
> I confirmed that it can work with no problem in the following cases.
>
> * Creating a resource instance
> - This RA can invoke a new syslog-ng process as an OCF resource
> with starting Heartbeat. This works independently of the system
> syslog-ng process.
> "system process" means that it's managed by RC script.
>
> * Terminating a resource instance
> - This RA can revoke a working syslog-ng process as an OCF resource
> with stopping Heartbeat. This works independently of the system
> syslog-ng process.
>
> * Failing over a resource instance at its start failure
> - When the syslog-ng command returns a error status due to a wrong
> syslog-ng configuration file, this RA can exit with an error status.
> Then a resource instance restarts on the SBY node.
>
> * Failing over a resource instance at its monitor failure
> - When a syslog-ng of a working resource instance disappears,
> this RA returns an error status as a result of its monitor action.
> Then a resource instance restarts on the SBY node.
>
> * Relocation
> - If the crm_resource command is performed to relocate a working
> syslog-ng resource, this RA can respond the request.
>
> These tests were carried out under the following enviroment.
>
> 2 node cluster(ACT/SBY) with
> Redhat 5.2(i386)
> heartbeat 2.1.4
> syslog-ng 2.1.3
>
> I appreciate any comments.
>
> Best reagard.
> --
> Takenaka Kazuhiro <takenaka.kazuhiro [at] oss>
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


keisuke.mori+ha at gmail

Jun 11, 2009, 2:16 AM

Post #3 of 22 (4461 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

Hi Dejan,

Do you have any chance to take a look at the syslog-ng OCF RA which
was posted by Takenaka-san before?

http://www.gossamer-threads.com/lists/linuxha/dev/54425

If you are OK, I will commit this to the -dev repository.

Thanks,
--
Keisuke MORI
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


dejanmm at fastmail

Jun 11, 2009, 3:26 AM

Post #4 of 22 (4471 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

Hi Keisuke-san,

On Thu, Jun 11, 2009 at 06:16:26PM +0900, Keisuke MORI wrote:
> Hi Dejan,
>
> Do you have any chance to take a look at the syslog-ng OCF RA which
> was posted by Takenaka-san before?
>
> http://www.gossamer-threads.com/lists/linuxha/dev/54425
>
> If you are OK, I will commit this to the -dev repository.

Yes, I'll take a look right away. Sorry for such a delay.

Cheers,

Dejan

> Thanks,
> --
> Keisuke MORI
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev [at] lists
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


dejanmm at fastmail

Jun 11, 2009, 4:18 AM

Post #5 of 22 (4450 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

Hi Keisuke-san,

On Thu, Jun 11, 2009 at 06:16:26PM +0900, Keisuke MORI wrote:
> Hi Dejan,
>
> Do you have any chance to take a look at the syslog-ng OCF RA which
> was posted by Takenaka-san before?
>
> http://www.gossamer-threads.com/lists/linuxha/dev/54425

Attaching the script with comments. Please use diff.

Cheers,

Dejan

> If you are OK, I will commit this to the -dev repository.
>
> Thanks,
> --
> Keisuke MORI
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev [at] lists
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
Attachments: syslog-ng (14.1 KB)


keisuke.mori+ha at gmail

Jun 11, 2009, 4:29 AM

Post #6 of 22 (4445 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

Hi Dejan,

Thank you for your comments.
I will repost the RA after I revise it with your comments.

Thanks,

2009/6/11 Dejan Muhamedagic <dejanmm [at] fastmail>:
> Hi Keisuke-san,
>
> On Thu, Jun 11, 2009 at 06:16:26PM +0900, Keisuke MORI wrote:
>> Hi Dejan,
>>
>> Do you have any chance to take a look at the syslog-ng OCF RA which
>> was posted by Takenaka-san before?
>>
>> http://www.gossamer-threads.com/lists/linuxha/dev/54425
>
> Attaching the script with comments. Please use diff.
>
> Cheers,
>
> Dejan
>
>> If you are OK, I will commit this to the -dev repository.
>>
>> Thanks,
>> --
>> Keisuke MORI
>> _______________________________________________________
>> Linux-HA-Dev: Linux-HA-Dev [at] lists
>> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
>> Home Page: http://linux-ha.org/
>
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev [at] lists
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
>
>



--
Keisuke MORI
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


nakahira at intellilink

Sep 18, 2009, 1:19 AM

Post #7 of 22 (3984 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

Hi, Dejan

I'm sorry I didn't get back to you sooner as a JBoss RA.
I took over mori-san and takenaka-san's work.

I revised a syslog-ng RA referring to your comments.
The modification and my comments is written in the attached RA.

Best Regards,
NAKAHIRA Kazutomo


Keisuke MORI wrote:
> Hi Dejan,
>
> Thank you for your comments.
> I will repost the RA after I revise it with your comments.
>
> Thanks,
>
> 2009/6/11 Dejan Muhamedagic <dejanmm [at] fastmail>:
>> Hi Keisuke-san,
>>
>> On Thu, Jun 11, 2009 at 06:16:26PM +0900, Keisuke MORI wrote:
>>> Hi Dejan,
>>>
>>> Do you have any chance to take a look at the syslog-ng OCF RA which
>>> was posted by Takenaka-san before?
>>>
>>> http://www.gossamer-threads.com/lists/linuxha/dev/54425
>> Attaching the script with comments. Please use diff.
>>
>> Cheers,
>>
>> Dejan
>>
>>> If you are OK, I will commit this to the -dev repository.
>>>
>>> Thanks,
>>> --
>>> Keisuke MORI
>>> _______________________________________________________
>>> Linux-HA-Dev: Linux-HA-Dev [at] lists
>>> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
>>> Home Page: http://linux-ha.org/
>> _______________________________________________________
>> Linux-HA-Dev: Linux-HA-Dev [at] lists
>> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
>> Home Page: http://linux-ha.org/
>>
>>
>
>
>


--
----------------------------------------
NAKAHIRA Kazutomo
NTT DATA INTELLILINK CORPORATION
Open Source Business Unit
Software Services Integration Business Division
Attachments: syslog-ng (11.9 KB)


r.bhatia at ipax

Sep 18, 2009, 6:38 AM

Post #8 of 22 (3986 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

hi,

On 09/18/2009 10:19 AM, NAKAHIRA Kazutomo wrote:
> Hi, Dejan
>
> I'm sorry I didn't get back to you sooner as a JBoss RA.
> I took over mori-san and takenaka-san's work.
>
> I revised a syslog-ng RA referring to your comments.
> The modification and my comments is written in the attached RA.

1. taking a quick look, this ocf ra seems generic enough to serve for
other syslog daemons (e.g. rsyslog) as well.

2. i suggest you rename OCF_RESKEY_syslog_ng_exe to
OCF_RESKEY_syslog_ng_binary or OCF_RESKEY_syslog_binary (see 1.)
(and possibly other ocf parameters) to be more consistent with other
ocf ra's.

what do you think?

cheers,
raoul
--
____________________________________________________________________
DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax
Technischer Leiter

IPAX - Aloy Bhatia Hava OEG web. http://www.ipax.at
Barawitzkagasse 10/2/2/11 email. office [at] ipax
1190 Wien tel. +43 1 3670030
FN 277995t HG Wien fax. +43 1 3670030 15
____________________________________________________________________
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


dejanmm at fastmail

Sep 21, 2009, 4:59 AM

Post #9 of 22 (3941 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

Hi Kazutomo-san,

On Fri, Sep 18, 2009 at 05:19:28PM +0900, NAKAHIRA Kazutomo wrote:
> Hi, Dejan
>
> I'm sorry I didn't get back to you sooner as a JBoss RA.
> I took over mori-san and takenaka-san's work.
>
> I revised a syslog-ng RA referring to your comments.
> The modification and my comments is written in the attached RA.

When sourcing ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
you should use '.' not '..'.

In the stop procedure, you use the QUIT signal. That's going to
produce a coredump of the process. Is that actually intended? Why
not use KILL after TERM?

On formatting: sometimes spaces are used and sometimes tabs for
indentation. Can you please use either one or the other
(preferably the latter).

Cheers,

Dejan

> Best Regards,
> NAKAHIRA Kazutomo
>
>
> Keisuke MORI wrote:
>> Hi Dejan,
>>
>> Thank you for your comments.
>> I will repost the RA after I revise it with your comments.
>>
>> Thanks,
>>
>> 2009/6/11 Dejan Muhamedagic <dejanmm [at] fastmail>:
>>> Hi Keisuke-san,
>>>
>>> On Thu, Jun 11, 2009 at 06:16:26PM +0900, Keisuke MORI wrote:
>>>> Hi Dejan,
>>>>
>>>> Do you have any chance to take a look at the syslog-ng OCF RA which
>>>> was posted by Takenaka-san before?
>>>>
>>>> http://www.gossamer-threads.com/lists/linuxha/dev/54425
>>> Attaching the script with comments. Please use diff.
>>>
>>> Cheers,
>>>
>>> Dejan
>>>
>>>> If you are OK, I will commit this to the -dev repository.
>>>>
>>>> Thanks,
>>>> --
>>>> Keisuke MORI
>>>> _______________________________________________________
>>>> Linux-HA-Dev: Linux-HA-Dev [at] lists
>>>> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
>>>> Home Page: http://linux-ha.org/
>>> _______________________________________________________
>>> Linux-HA-Dev: Linux-HA-Dev [at] lists
>>> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
>>> Home Page: http://linux-ha.org/
>>>
>>>
>>
>>
>>
>
>
> --
> ----------------------------------------
> NAKAHIRA Kazutomo
> NTT DATA INTELLILINK CORPORATION
> Open Source Business Unit
> Software Services Integration Business Division

> #!/bin/bash
> #
> # Description: Manages a syslog-ng instance, provided by NTT OSSC as an
> # OCF High-Availability resource under Heartbeat/LinuxHA control
> #
> # Copyright (c) 2009 NIPPON TELEGRAPH AND TELEPHONE CORPORATION
> #
> ##############################################################################
> # OCF parameters:
> # OCF_RESKEY_syslog_ng_exe : Executable file
> # OCF_RESKEY_configfile : Configuration file
> # OCF_RESKEY_start_opts : Extra options
> # OCF_RESKEY_kill_term_timeout: Number of seconds to await to confirm a
> # normal stop method
> # OCF_RESKEY_kill_quit_timeout: Number of times to try forcible
> # stop methods
> #
> # Only OCF_RESKEY_configfile must be specified. Each of the rests
> # has its default value or refers OCF_RESKEY_configfile to make
> # its value when no explicit value is given.
> #
> # Further infomation for setup:
> # There are sample configurations at the end of this file.
> #
> ###############################################################################
>
> .. ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
>
> usage()
> {
> cat <<-!
> usage: $0 action
>
> action:
> start : start a new syslog-ng instance
>
> stop : stop the running syslog-ng instance
>
> status : return the status of syslog-ng, run or down
>
> monitor : return TRUE if the syslog-ng appears to be working.
>
> meta-data : show meta data message
>
> validate-all: validate the instance parameters
> !
> return $OCF_ERR_ARGS
> }
>
> metadata_syslog_ng()
> {
> cat <<END
> <?xml version="1.0"?>
> <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
> <resource-agent name="syslog_ng">
> <version>1.0</version>
>
> <longdesc lang="en">
> This script manages a syslog-ng instance as an HA resource.
> </longdesc>
> <shortdesc lang="en">Syslog-ng resource agent</shortdesc>
>
> <parameters>
>
> <parameter name="syslog_ng_exe" unique="0">
> <longdesc lang="en">
> This parameter specifies syslog-ng's executable file.
> </longdesc>
> <shortdesc>Executable file</shortdesc>
> <content type="string" default=""/>
> </parameter>
>
> <parameter name="configfile" unique="0" required="1">
> <longdesc lang="en">
> This parameter specifies a configuration file
> for a syslog-ng instance managed by this RA.
> </longdesc>
> <shortdesc>Configuration file</shortdesc>
> <content type="string" default=""/>
> </parameter>
>
> <parameter name="start_opts" unique="0">
> <longdesc lang="en">
> This parameter specifies extra options for a
> syslog-ng instance managed by this RA. When no value is given, no extra
> options is used. Don't use option '-F'. It causes a stuck of a start action.
> </longdesc>
> <shortdesc>Start options</shortdesc>
> <content type="string" default=""/>
> </parameter>
>
> <parameter name="kill_term_timeout" unique="0">
> <longdesc lang="en">
> On a stop action, a normal stop method(pkill -TERM) is firstly used.
> And then the confirmation of its completion is waited for
> the specified seconds by this parameter.
> The default value is 10.
> </longdesc>
> <shortdesc>Number of seconds to await to confirm a normal stop method</shortdesc>
> <content type="integer" default="10"/>
> </parameter>
>
> <parameter name="kill_quit_timeout" unique="0">
> <longdesc lang="en">
> On a stop action, if a normal stop method ends up with a failure,
> more forcible methods are taken. These methods are repeated the
> specified numbers by this parameter.
> The default value is 10.
> If every normal or forcible stop methods run into a failure,
> the KILL signal is used as a final method to stop.
> </longdesc>
> <shortdesc>Number of times to try forcible stop methods</shortdesc>
> <content type="integer" default="10"/>
> </parameter>
>
> </parameters>
>
> <actions>
> <action name="start" timeout="60s" />
> <action name="stop" timeout="120s" />
> <action name="status" timeout="60" />
> <action name="monitor" depth="0" timeout="30s" interval="10s" start-delay="0" />
> <action name="meta-data" timeout="5s" />
> <action name="validate-all" timeout="5"/>
> </actions>
> </resource-agent>
> END
> return $OCF_SUCCESS
> }
>
> monitor_syslog_ng()
> {
> set -- $(pgrep -f "$PROCESS_PATTERN" 2>/dev/null)
> case $# in
> 0) ocf_log debug "No syslog-ng process for $CONFIGFILE"
> return $OCF_NOT_RUNNING;;
> 1) return $OCF_SUCCESS;;
> esac
> ocf_log err "mutiple syslog-ng process for $CONFIGFILE"
> return $OCF_ERR_GENERIC
> }
>
> start_syslog_ng()
> {
> monitor_syslog_ng
> if [[ $? = "$OCF_SUCCESS" ]]; then
> return $OCF_SUCCESS
> fi
>
> # set -- $SYSLOG_NG_OPTS
> # ocf_run "$SYSLOG_NG_EXE" -f "$SYSLOG_NG_CONF" "$@"
> # reduce to this?
> ocf_run "$SYSLOG_NG_EXE" -f "$CONFIGFILE" $START_OPTS
> ocf_status=$?
> if [[ "$ocf_status" != "$OCF_SUCCESS" ]]; then
> return $ocf_status
> fi
>
> while true; do
> monitor_syslog_ng
> if [[ $? = "$OCF_SUCCESS" ]]; then
> return $OCF_SUCCESS
> fi
> sleep 1
> done
> }
>
> stop_syslog_ng()
> {
> pkill -TERM -f "$PROCESS_PATTERN"
>
> typeset lapse_sec=0
> while pgrep -f "$PROCESS_PATTERN" > /dev/null; do
> sleep 1
> lapse_sec=$(( lapse_sec + 1 ))
> ocf_log debug "stop_syslog_ng[$SYSLOG_NG_NAME]: stop NORM $lapse_sec/$KILL_TERM_TIMEOUT"
> if [ $lapse_sec -ge $KILL_TERM_TIMEOUT ]; then
> break
> fi
> done
>
> lapse_sec=0
> while pgrep -f "$PROCESS_PATTERN" > /dev/null; do
> sleep 1
> lapse_sec=$(( lapse_sec + 1 ))
> ocf_log debug "stop_syslog_ng[$SYSLOG_NG_NAME]: suspend syslog_ng by SIGQUIT ($lapse_sec/$KILL_QUIT_TIMEOUT)"
> pkill -QUIT -f "$PROCESS_PATTERN"
> # 2009/09/18 Nakahira
> # Add timeout procedure
> if [ $lapse_sec -ge $KILL_QUIT_TIMEOUT ]; then
> break
> fi
> done
>
> # if the process can't be removed, then the following part is
> # not going to be executed (the RA will be killed by lrmd on
> # timeout) and the pidfile will remain; don't know if that
> # has any consequences
> # 2009/09/18 Nakahira
> # If the syslog-ng process hangs, syslog-ng RA waits $KILL_TERM_TIMEOUT
> # seconds and tries kill QUIT for $KILL_QUIT_TIMEOUT seconds.
> # The stop timeout of RA should be
> # longer than $KILL_TERM_TIMEOUT + $KILL_QUIT_TIMEOUT.
> lapse_sec=0
> while pgrep -f "$PROCESS_PATTERN" > /dev/null; do
> pkill -KILL -f "$PROCESS_PATTERN"
> sleep 1
> lapse_sec=$(( lapse_sec + 1 ))
> ocf_log debug "stop_syslog_ng[$SYSLOG_NG_NAME]: suspend syslog_ng by SIGKILL ($lapse_sec/@@@)"
> done
>
> return $OCF_SUCCESS
> }
>
> status_syslog_ng()
> {
> # ???? why not monitor and then print running or stopped
> monitor_syslog_ng
> rc=$?
> if [ $rc = $OCF_SUCCESS ]; then
> echo "Syslog-ng service is running."
> elif [ $rc = $OCF_NOT_RUNNING ]; then
> echo "Syslog-ng service is stopped."
> else
> echo "Mutiple syslog-ng process for $CONFIGFILE."
> fi
> return $rc
> }
>
> validate_all_syslog_ng()
> {
> ocf_log info "validate_all_syslog_ng[$SYSLOG_NG_NAME]"
> return $OCF_SUCCESS
> }
>
> if [[ "$1" = "meta-data" ]]; then
> metadata_syslog_ng
> exit $?
> fi
>
> CONFIGFILE="${OCF_RESKEY_configfile}"
> if [[ -z "$CONFIGFILE" ]]; then
> ocf_log err "undefined parameter:configfile"
> exit $OCF_ERR_CONFIGURED
> fi
>
> SYSLOG_NG_NAME=${CONFIGFILE##*/}
> SYSLOG_NG_NAME=${SYSLOG_NG_NAME%.*}
>
> SYSLOG_NG_EXE="${OCF_RESKEY_syslog_ng_exe-/sbin/syslog-ng}"
> # why not default to /sbin/syslog-ng?
> #if [[ -z "$SYSLOG_NG_EXE" ]]; then
> # ocf_log err "Undefined parameter:syslog_ng_exe"
> # exit $OCF_ERR_CONFIGURED
> #fi
> if [[ ! -x "$SYSLOG_NG_EXE" ]]; then
> ocf_log err "Invalid value:syslog_ng_exe:$SYSLOG_NG_EXE"
> exit $OCF_ERR_CONFIGURED
> fi
>
> # actually, the pidfile has no function; the status is checked by
> # testing for a running process only
>
> KILL_TERM_TIMEOUT="${OCF_RESKEY_kill_term_timeout-10}"
> if ! ocf_is_decimal "$KILL_TERM_TIMEOUT"; then
> ocf_log err "Invalid value:kill_term_timeout:$KILL_TERM_TIMEOUT"
> exit $OCF_ERR_CONFIGURED
> fi
>
> KILL_QUIT_TIMEOUT="${OCF_RESKEY_kill_quit_timeout-10}"
> if ! ocf_is_decimal "$KILL_QUIT_TIMEOUT"; then
> ocf_log err "Invalid value:kill_quit_timeout:$KILL_QUIT_TIMEOUT"
> exit $OCF_ERR_CONFIGURED
> fi
>
> START_OPTS=${OCF_RESKEY_start_opts}
> PROCESS_PATTERN="$SYSLOG_NG_EXE -f $CONFIGFILE"
>
> COMMAND=$1
>
> case "$COMMAND" in
> start)
> ocf_log debug "[$SYSLOG_NG_NAME] Enter syslog_ng start"
> start_syslog_ng
> func_status=$?
> ocf_log debug "[$SYSLOG_NG_NAME] Leave syslog_ng start $func_status"
> exit $func_status
> ;;
> stop)
> ocf_log debug "[$SYSLOG_NG_NAME] Enter syslog_ng stop"
> stop_syslog_ng
> func_status=$?
> ocf_log debug "[$SYSLOG_NG_NAME] Leave syslog_ng stop $func_status"
> exit $func_status
> ;;
> status)
> status_syslog_ng
> exit $?
> ;;
> monitor)
> #ocf_log debug "[$SYSLOG_NG_NAME] Enter syslog_ng monitor"
> monitor_syslog_ng
> func_status=$?
> #ocf_log debug "[$SYSLOG_NG_NAME] Leave syslog_ng monitor $func_status"
> exit $func_status
> ;;
> validate-all)
> validate_all_syslog_ng
> exit $?
> ;;
> *)
> usage
> ;;
> esac
>
> # vim: set sw=4 ts=4 :
>
> ### A sample snippet of cib.xml for a syslog-ng resource
> ##
> # <primitive id="prmApSyslog-ng" class="ocf" type="syslog-ng" provider="heartbeat">
> # <instance_attributes id="prmDummyB_instance_attrs">
> # <attributes>
> # <nvpair id="atr:Syslog-ng:syslog-ng:syslog_ng_exe" name="syslog_ng_exe" value="/sbin/syslog-ng"/>
> # <nvpair id="atr:Syslog-ng:syslog-ng:configfile" name="configfile" value="/etc/syslog-ng/syslog-ng-ext.conf"/>
> # </attributes>
> # </instance_attributes>
> # <operations>
> # <op id="op:prmSyslog-ng:start" name="start" timeout="60s" on_fail="restart"/>
> # <op id="op:prmSyslog-ng:monitor" name="monitor" interval="10s" timeout="60s" on_fail="restart"/>
> # <op id="op:prmSyslog-ng:stop" name="stop" timeout="60s" on_fail="block"/>
> # </operations>
> # </primitive>
>
> ### A sample syslog-ng configuration file for a log collecting host
> ###
> ### This sample is for a log collecting host by syslog-ng.
> ### A syslog-ng process configurated by this sample accepts all messages
> ### from a certain network. Any message from the network is preserved into
> ### a file for security infomation. Restricting messages to "authpriv" from
> ### the network is done on log sending hosts. (See the sample below)
> ### Any internal message of the syslog-ng process is preserved into its
> ### dedicated file. And any "authpriv" internal message of the syslog-ng
> ### process is also preserved into the security infomation file.
> ###
> ### Change "f_incoming" to suit your enviroment.
> ### If you use it as a configuration file for the sample cib.xml above,
> ### save it into "/etc/syslog-ng/syslog-ng-ext.conf".
> ##
> #options {
> # sync (0);
> # time_reopen (10);
> # log_fifo_size (1000);
> # long_hostnames (off);
> # use_dns (yes);
> # use_fqdn (no);
> # create_dirs (no);
> # keep_hostname (yes); };
> #
> #source s_internal { internal(); };
> #source s_incoming { udp(port(514)); };
> #filter f_internal { facility(authpriv); };
> #filter f_incoming { netmask("172.20.0.0/255.255.192.0"); };
> #
> #destination d_internal { file("/var/log/syslog-ng-ext.log" perm(0640));};
> #destination d_incoming {
> # file("/var/log/secure-ext.log" create_dirs(yes) perm(0640)); };
> #
> #log { source(s_internal); destination(d_internal); };
> #log { source(s_internal); filter(f_internal); destination(d_incoming); };
> #log { source(s_incoming); filter(f_incoming); destination(d_incoming); };
>
> ### A sample snippet of syslog-ng configuration file for a log sending host
> ###
> ### This sample is for a log sending host that uses syslog-ng.
> ###
> ### Replace "syslog-ng-ext" to the IP address or the hostname of your
> ### log collecting host and append it to "syslog-ng.conf" of each log sending
> ### host. See the install default syslog-ng.conf to know what "s_sys" and
> ### "f_auth" are.
> ##
> #destination d_outgoing { udp("syslog-ng-ext" port(514)); };
> #log { source(s_sys); filter(f_auth); destination(d_outgoing); };
>
> ### A sample snippet of syslog configuration file for a log sending host
> ###
> ### This sample is for a log sending host that uses syslog.
> ###
> ### Replace "syslog-ng-ext" to the IP address or the hostname of your
> ### log collecting host and append it to "syslog.conf" of each log sending
> ### host.
> ##
> # authpriv.* @syslog-ng-ext

> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev [at] lists
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/

_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


r.bhatia at ipax

Nov 10, 2009, 4:02 AM

Post #10 of 22 (3109 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

On 09/21/2009 01:59 PM, Dejan Muhamedagic wrote:
> Hi Kazutomo-san,
>
> On Fri, Sep 18, 2009 at 05:19:28PM +0900, NAKAHIRA Kazutomo wrote:
>> Hi, Dejan
>>
>> I'm sorry I didn't get back to you sooner as a JBoss RA.
>> I took over mori-san and takenaka-san's work.
>>
>> I revised a syslog-ng RA referring to your comments.
>> The modification and my comments is written in the attached RA.
>
> When sourcing ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
> you should use '.' not '..'.
>
> In the stop procedure, you use the QUIT signal. That's going to
> produce a coredump of the process. Is that actually intended? Why
> not use KILL after TERM?
>
> On formatting: sometimes spaces are used and sometimes tabs for
> indentation. Can you please use either one or the other
> (preferably the latter).

hi,

what is the current status on this one?

cheers,
raoul
--
____________________________________________________________________
DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax
Technischer Leiter

IPAX - Aloy Bhatia Hava OEG web. http://www.ipax.at
Barawitzkagasse 10/2/2/11 email. office [at] ipax
1190 Wien tel. +43 1 3670030
FN 277995t HG Wien fax. +43 1 3670030 15
____________________________________________________________________
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


dejanmm at fastmail

Nov 10, 2009, 4:23 AM

Post #11 of 22 (3132 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

Hi,

On Tue, Nov 10, 2009 at 01:02:06PM +0100, Raoul Bhatia [IPAX] wrote:
> On 09/21/2009 01:59 PM, Dejan Muhamedagic wrote:
> > Hi Kazutomo-san,
> >
> > On Fri, Sep 18, 2009 at 05:19:28PM +0900, NAKAHIRA Kazutomo wrote:
> >> Hi, Dejan
> >>
> >> I'm sorry I didn't get back to you sooner as a JBoss RA.
> >> I took over mori-san and takenaka-san's work.
> >>
> >> I revised a syslog-ng RA referring to your comments.
> >> The modification and my comments is written in the attached RA.
> >
> > When sourcing ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
> > you should use '.' not '..'.
> >
> > In the stop procedure, you use the QUIT signal. That's going to
> > produce a coredump of the process. Is that actually intended? Why
> > not use KILL after TERM?
> >
> > On formatting: sometimes spaces are used and sometimes tabs for
> > indentation. Can you please use either one or the other
> > (preferably the latter).
>
> hi,
>
> what is the current status on this one?

Apparently waiting for some response from Kazutomo-san.

Thanks,

Dejan

> cheers,
> raoul
> --
> ____________________________________________________________________
> DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax
> Technischer Leiter
>
> IPAX - Aloy Bhatia Hava OEG web. http://www.ipax.at
> Barawitzkagasse 10/2/2/11 email. office [at] ipax
> 1190 Wien tel. +43 1 3670030
> FN 277995t HG Wien fax. +43 1 3670030 15
> ____________________________________________________________________
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev [at] lists
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


nakahira at intellilink

Nov 13, 2009, 2:14 AM

Post #12 of 22 (3072 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

Hi, Dejan and Raoul

I hope you will forgive me for being so slow to answer.
# I have some other works and it takes time.

> 1. taking a quick look, this ocf ra seems generic enough to serve for
> other syslog daemons (e.g. rsyslog) as well.
I think so. But I have no time to test other syslog daemons now.
Currently I suggest this RA for the syslog-ng, but I hope that
this RA supports other syslog daemon in the future.

> 2. i suggest you rename OCF_RESKEY_syslog_ng_exe to
> OCF_RESKEY_syslog_ng_binary or OCF_RESKEY_syslog_binary (see 1.)
> (and possibly other ocf parameters) to be more consistent with other
> ocf ra's.
I agree and fix OCF_RESKEY_syslog_ng_exe to OCF_RESKEY_syslog_ng_binary.

> When sourcing ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
> you should use '.' not '..'.
I wrote '.' as a source command in the original file.
But it translated to '..' automatically by the my mailer
or our company's mail server.(It is so strange)
Please revise '..' to '.' if it translated again.

> In the stop procedure, you use the QUIT signal. That's going to
> produce a coredump of the process. Is that actually intended? Why
> not use KILL after TERM?
Using "kill -QUIT" is actually intended in this RA.
QUIT signal for JVM process dose not stop target process, but
QUIT signal for common linux process stop target process.

The syslog-ng RA's stop sequence is below.
1. Execute "kill -TERM" and wait KILL_TERM_TIMEOUT seconds
until syslog-ng porcess stopped.
2. If sylog-ng process dose not stopped, then Execute
"kill -QUIT" KILL_QUIT_TIMEOUT times at intervals of
1 second until syslog-ng porcess stopped.
3. If syslog-ng process still alive, then Execete
"kill -KILL" at intervals of 1 second
until syslog-ng porcess stopped.

> On formatting: sometimes spaces are used and sometimes tabs for
> indentation. Can you please use either one or the other
> (preferably the latter).
I agree. I substituted all indentation spaces to tabs.

A re-revised syslog-ng RA is attached.

Best Regards,
NAKAHIRA Kazutomo

Dejan Muhamedagic wrote:
> Hi,
>
> On Tue, Nov 10, 2009 at 01:02:06PM +0100, Raoul Bhatia [IPAX] wrote:
>> On 09/21/2009 01:59 PM, Dejan Muhamedagic wrote:
>>> Hi Kazutomo-san,
>>>
>>> On Fri, Sep 18, 2009 at 05:19:28PM +0900, NAKAHIRA Kazutomo wrote:
>>>> Hi, Dejan
>>>>
>>>> I'm sorry I didn't get back to you sooner as a JBoss RA.
>>>> I took over mori-san and takenaka-san's work.
>>>>
>>>> I revised a syslog-ng RA referring to your comments.
>>>> The modification and my comments is written in the attached RA.
>>> When sourcing ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
>>> you should use '.' not '..'.
>>>
>>> In the stop procedure, you use the QUIT signal. That's going to
>>> produce a coredump of the process. Is that actually intended? Why
>>> not use KILL after TERM?
>>>
>>> On formatting: sometimes spaces are used and sometimes tabs for
>>> indentation. Can you please use either one or the other
>>> (preferably the latter).
>> hi,
>>
>> what is the current status on this one?
>
> Apparently waiting for some response from Kazutomo-san.
>
> Thanks,
>
> Dejan
>
>> cheers,
>> raoul
>> --
>> ____________________________________________________________________
>> DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax
>> Technischer Leiter
>>
>> IPAX - Aloy Bhatia Hava OEG web. http://www.ipax.at
>> Barawitzkagasse 10/2/2/11 email. office [at] ipax
>> 1190 Wien tel. +43 1 3670030
>> FN 277995t HG Wien fax. +43 1 3670030 15
>> ____________________________________________________________________
>> _______________________________________________________
>> Linux-HA-Dev: Linux-HA-Dev [at] lists
>> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
>> Home Page: http://linux-ha.org/
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev [at] lists
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/


--
----------------------------------------
NAKAHIRA Kazutomo
NTT DATA INTELLILINK CORPORATION
Open Source Business Unit
Software Services Integration Business Division
Attachments: syslog-ng (11.8 KB)


r.bhatia at ipax

Nov 13, 2009, 2:28 AM

Post #13 of 22 (3064 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

Hi Kazutomo-san,

thank you for your updates. i think it would be ok to commit the
current ra and submit patches as needed. thank you for your efforts!

On 11/13/2009 11:14 AM, NAKAHIRA Kazutomo wrote:
>> On formatting: sometimes spaces are used and sometimes tabs for
>> indentation. Can you please use either one or the other
>> (preferably the latter).
> I agree. I substituted all indentation spaces to tabs.

as a side note, i like spaces more. and a lot of ras use spaces, though
taking a closer look, indentation is quite messed up in some ras (e.g.
mysql) ;)

cheers,
raoul
--
____________________________________________________________________
DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax
Technischer Leiter

IPAX - Aloy Bhatia Hava OEG web. http://www.ipax.at
Barawitzkagasse 10/2/2/11 email. office [at] ipax
1190 Wien tel. +43 1 3670030
FN 277995t HG Wien fax. +43 1 3670030 15
____________________________________________________________________
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


dejanmm at fastmail

Nov 13, 2009, 2:51 AM

Post #14 of 22 (3060 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

Hi,

On Fri, Nov 13, 2009 at 11:28:28AM +0100, Raoul Bhatia [IPAX] wrote:
> Hi Kazutomo-san,
>
> thank you for your updates. i think it would be ok to commit the
> current ra and submit patches as needed. thank you for your efforts!
>
> On 11/13/2009 11:14 AM, NAKAHIRA Kazutomo wrote:
> >> On formatting: sometimes spaces are used and sometimes tabs for
> >> indentation. Can you please use either one or the other
> >> (preferably the latter).
> > I agree. I substituted all indentation spaces to tabs.
>
> as a side note, i like spaces more.

/me prefers tabs :) That's really a matter of preference, though
I'd say that it is more common to use tabs for programming
(apart from Python). What I really don't like is a mix of the
two.

> and a lot of ras use spaces, though
> taking a closer look, indentation is quite messed up in some ras (e.g.
> mysql) ;)

Yes, probably elsewhere too, but once it's in the repository
fixing the spacing doesn't make sense since we lose part of the
history (i.e. annotate won't show useful information). In
general, one should follow the style of the author.

Thanks,

Dejan

> cheers,
> raoul
> --
> ____________________________________________________________________
> DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax
> Technischer Leiter
>
> IPAX - Aloy Bhatia Hava OEG web. http://www.ipax.at
> Barawitzkagasse 10/2/2/11 email. office [at] ipax
> 1190 Wien tel. +43 1 3670030
> FN 277995t HG Wien fax. +43 1 3670030 15
> ____________________________________________________________________
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev [at] lists
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


dejanmm at fastmail

Nov 13, 2009, 3:23 AM

Post #15 of 22 (3057 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

Hi Kazutomo-san,

On Fri, Nov 13, 2009 at 07:14:18PM +0900, NAKAHIRA Kazutomo wrote:
> Hi, Dejan and Raoul
>
> I hope you will forgive me for being so slow to answer.
> # I have some other works and it takes time.

That's fine.

[...]
> >When sourcing ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
> >you should use '.' not '..'.
> I wrote '.' as a source command in the original file.
> But it translated to '..' automatically by the my mailer
> or our company's mail server.(It is so strange)

Most funny. Attachment shouldn't be messed with really.

> Please revise '..' to '.' if it translated again.

OK.

> >In the stop procedure, you use the QUIT signal. That's going to
> >produce a coredump of the process. Is that actually intended? Why
> >not use KILL after TERM?
> Using "kill -QUIT" is actually intended in this RA.
> QUIT signal for JVM process dose not stop target process, but

What does JVM has to do with syslog?

> QUIT signal for common linux process stop target process.

From signal(7):

SIGQUIT 3 Core Quit from keyboard

i.e. there could be core dumps and I'm not sure if that's
what you intend.

> The syslog-ng RA's stop sequence is below.
> 1. Execute "kill -TERM" and wait KILL_TERM_TIMEOUT seconds
> until syslog-ng porcess stopped.
> 2. If sylog-ng process dose not stopped, then Execute
> "kill -QUIT" KILL_QUIT_TIMEOUT times at intervals of
> 1 second until syslog-ng porcess stopped.
> 3. If syslog-ng process still alive, then Execete
> "kill -KILL" at intervals of 1 second
> until syslog-ng porcess stopped.

One KILL should be enough as that is actually not delivered to
the process at all, but the process gets removed from the system,
unless it's in the D state, i.e. waiting for some device. But
that's not really important.

> >On formatting: sometimes spaces are used and sometimes tabs for
> >indentation. Can you please use either one or the other
> >(preferably the latter).
> I agree. I substituted all indentation spaces to tabs.
>
> A re-revised syslog-ng RA is attached.
>
> Best Regards,
> NAKAHIRA Kazutomo
>
> Dejan Muhamedagic wrote:
> >Hi,
> >
> >On Tue, Nov 10, 2009 at 01:02:06PM +0100, Raoul Bhatia [IPAX] wrote:
> >>On 09/21/2009 01:59 PM, Dejan Muhamedagic wrote:
> >>>Hi Kazutomo-san,
> >>>
> >>>On Fri, Sep 18, 2009 at 05:19:28PM +0900, NAKAHIRA Kazutomo wrote:
> >>>>Hi, Dejan
> >>>>
> >>>>I'm sorry I didn't get back to you sooner as a JBoss RA.
> >>>>I took over mori-san and takenaka-san's work.
> >>>>
> >>>>I revised a syslog-ng RA referring to your comments.
> >>>>The modification and my comments is written in the attached RA.
> >>>When sourcing ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
> >>>you should use '.' not '..'.
> >>>
> >>>In the stop procedure, you use the QUIT signal. That's going to
> >>>produce a coredump of the process. Is that actually intended? Why
> >>>not use KILL after TERM?
> >>>
> >>>On formatting: sometimes spaces are used and sometimes tabs for
> >>>indentation. Can you please use either one or the other
> >>>(preferably the latter).
> >>hi,
> >>
> >>what is the current status on this one?
> >
> >Apparently waiting for some response from Kazutomo-san.
> >
> >Thanks,
> >
> >Dejan
> >
> >>cheers,
> >>raoul
> >>--
> >>____________________________________________________________________
> >>DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax
> >>Technischer Leiter
> >>
> >>IPAX - Aloy Bhatia Hava OEG web. http://www.ipax.at
> >>Barawitzkagasse 10/2/2/11 email. office [at] ipax
> >>1190 Wien tel. +43 1 3670030
> >>FN 277995t HG Wien fax. +43 1 3670030 15
> >>____________________________________________________________________
> >>_______________________________________________________
> >>Linux-HA-Dev: Linux-HA-Dev [at] lists
> >>http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> >>Home Page: http://linux-ha.org/
> >_______________________________________________________
> >Linux-HA-Dev: Linux-HA-Dev [at] lists
> >http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> >Home Page: http://linux-ha.org/
>
>
> --
> ----------------------------------------
> NAKAHIRA Kazutomo
> NTT DATA INTELLILINK CORPORATION
> Open Source Business Unit
> Software Services Integration Business Division

> #!/bin/bash
> #
> # Description: Manages a syslog-ng instance, provided by NTT OSSC as an
> # OCF High-Availability resource under Heartbeat/LinuxHA control
> #
> # Copyright (c) 2009 NIPPON TELEGRAPH AND TELEPHONE CORPORATION
> #
> ##############################################################################
> # OCF parameters:
> # OCF_RESKEY_syslog_ng_binary : Path to syslog-ng binary.
> # Default is "/sbin/syslog-ng"
> # OCF_RESKEY_configfile : Configuration file
> # OCF_RESKEY_start_opts : Startup options
> # OCF_RESKEY_kill_term_timeout: Number of seconds to await to confirm a
> # normal stop method
> # OCF_RESKEY_kill_quit_timeout: Number of times to try forcible
> # stop methods
> #
> # Only OCF_RESKEY_configfile must be specified. Each of the rests
> # has its default value or refers OCF_RESKEY_configfile to make
> # its value when no explicit value is given.
> #
> # Further infomation for setup:
> # There are sample configurations at the end of this file.
> #
> ###############################################################################
>
> . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
>
> usage()
> {
> cat <<-!
> usage: $0 action
>
> action:
> start : start a new syslog-ng instance
>
> stop : stop the running syslog-ng instance
>
> status : return the status of syslog-ng, run or down
>
> monitor : return TRUE if the syslog-ng appears to be working.
>
> meta-data : show meta data message
>
> validate-all: validate the instance parameters
> !
> return $OCF_ERR_ARGS
> }
>
> metadata_syslog_ng()
> {
> cat <<END
> <?xml version="1.0"?>
> <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
> <resource-agent name="syslog_ng">
> <version>1.0</version>
>
> <longdesc lang="en">
> This script manages a syslog-ng instance as an HA resource.
> </longdesc>
> <shortdesc lang="en">Syslog-ng resource agent</shortdesc>
>
> <parameters>
>
> <parameter name="syslog_ng_binary" unique="0">
> <longdesc lang="en">
> This parameter specifies syslog-ng's executable file.
> </longdesc>
> <shortdesc>Executable file</shortdesc>
> <content type="string" default=""/>
> </parameter>
>
> <parameter name="configfile" unique="0" required="1">
> <longdesc lang="en">
> This parameter specifies a configuration file
> for a syslog-ng instance managed by this RA.
> </longdesc>
> <shortdesc>Configuration file</shortdesc>
> <content type="string" default=""/>
> </parameter>
>
> <parameter name="start_opts" unique="0">
> <longdesc lang="en">
> This parameter specifies startup options for a
> syslog-ng instance managed by this RA. When no value is given, no startup
> options is used. Don't use option '-F'. It causes a stuck of a start action.
> </longdesc>
> <shortdesc>Start options</shortdesc>
> <content type="string" default=""/>
> </parameter>
>
> <parameter name="kill_term_timeout" unique="0">
> <longdesc lang="en">
> On a stop action, a normal stop method(pkill -TERM) is firstly used.
> And then the confirmation of its completion is waited for
> the specified seconds by this parameter.
> The default value is 10.
> </longdesc>
> <shortdesc>Number of seconds to await to confirm a normal stop method</shortdesc>
> <content type="integer" default="10"/>
> </parameter>
>
> <parameter name="kill_quit_timeout" unique="0">
> <longdesc lang="en">
> On a stop action, if a normal stop method ends up with a failure,
> more forcible methods are taken. These methods are repeated the
> specified numbers by this parameter.
> The default value is 10.
> If every normal or forcible stop methods run into a failure,
> the KILL signal is used as a final method to stop.
> </longdesc>
> <shortdesc>Number of times to try forcible stop methods</shortdesc>
> <content type="integer" default="10"/>
> </parameter>
>
> </parameters>
>
> <actions>
> <action name="start" timeout="60s" />
> <action name="stop" timeout="120s" />
> <action name="status" timeout="60" />
> <action name="monitor" depth="0" timeout="30s" interval="10s" start-delay="0" />

Perhaps default interval to something like 60s? Don't know what's
the case in other RAs. Should probably be reviewed.

> <action name="meta-data" timeout="5s" />
> <action name="validate-all" timeout="5"/>
> </actions>
> </resource-agent>
> END
> return $OCF_SUCCESS
> }
>
> monitor_syslog_ng()
> {
> set -- $(pgrep -f "$PROCESS_PATTERN" 2>/dev/null)
> case $# in
> 0) ocf_log debug "No syslog-ng process for $CONFIGFILE"
> return $OCF_NOT_RUNNING;;
> 1) return $OCF_SUCCESS;;
> esac
> ocf_log err "mutiple syslog-ng process for $CONFIGFILE"

BTW, does syslog-ng fork to process requests? Perhaps it's not
necessary to treat this as an error condition. Note that on start
it almost certainly does fork (most daemons do), so under some
unfavourable conditions this code may fail.

Cheers,

Dejan
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


nakahira at intellilink

Nov 16, 2009, 1:15 AM

Post #16 of 22 (2953 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

Hi Dejan,

Dejan Muhamedagic wrote:
> Hi Kazutomo-san,
>
> On Fri, Nov 13, 2009 at 07:14:18PM +0900, NAKAHIRA Kazutomo wrote:
>> Hi, Dejan and Raoul
>>
>> I hope you will forgive me for being so slow to answer.
>> # I have some other works and it takes time.
>
> That's fine.
>
> [...]
>>> When sourcing ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
>>> you should use '.' not '..'.
>> I wrote '.' as a source command in the original file.
>> But it translated to '..' automatically by the my mailer
>> or our company's mail server.(It is so strange)
>
> Most funny. Attachment shouldn't be messed with really.
>
>> Please revise '..' to '.' if it translated again.
>
> OK.
>
>>> In the stop procedure, you use the QUIT signal. That's going to
>>> produce a coredump of the process. Is that actually intended? Why
>>> not use KILL after TERM?
>> Using "kill -QUIT" is actually intended in this RA.
>> QUIT signal for JVM process dose not stop target process, but
>
> What does JVM has to do with syslog?
>
>> QUIT signal for common linux process stop target process.
>
> From signal(7):
>
> SIGQUIT 3 Core Quit from keyboard
>
> i.e. there could be core dumps and I'm not sure if that's
> what you intend.
>
What I intend is that if syslog-ng process never stops
by the "kill -TERM", then trying core dump and stop process
by the "kill -QUIT".

>> The syslog-ng RA's stop sequence is below.
>> 1. Execute "kill -TERM" and wait KILL_TERM_TIMEOUT seconds
>> until syslog-ng porcess stopped.
>> 2. If sylog-ng process dose not stopped, then Execute
>> "kill -QUIT" KILL_QUIT_TIMEOUT times at intervals of
>> 1 second until syslog-ng porcess stopped.
>> 3. If syslog-ng process still alive, then Execete
>> "kill -KILL" at intervals of 1 second
>> until syslog-ng porcess stopped.
>
> One KILL should be enough as that is actually not delivered to
> the process at all, but the process gets removed from the system,
> unless it's in the D state, i.e. waiting for some device. But
> that's not really important.
>
That's for sure. Retrying "kill -QUIT" is redundant
and KILL_QUIT_TIMEOUT too.

I revised these parts and the syslog-ng RA's stop sequence is below.

1. Execute "kill -TERM" and wait KILL_TERM_TIMEOUT seconds
until syslog-ng porcess stopped.
2. If sylog-ng process dose not stopped, then Execute
"kill -QUIT" to dump core and stop process.
3. If syslog-ng process still alive, then Execete
"kill -KILL" at intervals of 1 second
until syslog-ng porcess stopped.

>>> On formatting: sometimes spaces are used and sometimes tabs for
>>> indentation. Can you please use either one or the other
>>> (preferably the latter).
>> I agree. I substituted all indentation spaces to tabs.
>>
>> A re-revised syslog-ng RA is attached.
>>
>> Best Regards,
>> NAKAHIRA Kazutomo
>>
>> Dejan Muhamedagic wrote:
>>> Hi,
>>>
>>> On Tue, Nov 10, 2009 at 01:02:06PM +0100, Raoul Bhatia [IPAX] wrote:
>>>> On 09/21/2009 01:59 PM, Dejan Muhamedagic wrote:
>>>>> Hi Kazutomo-san,
>>>>>
>>>>> On Fri, Sep 18, 2009 at 05:19:28PM +0900, NAKAHIRA Kazutomo wrote:
>>>>>> Hi, Dejan
>>>>>>
>>>>>> I'm sorry I didn't get back to you sooner as a JBoss RA.
>>>>>> I took over mori-san and takenaka-san's work.
>>>>>>
>>>>>> I revised a syslog-ng RA referring to your comments.
>>>>>> The modification and my comments is written in the attached RA.
>>>>> When sourcing ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
>>>>> you should use '.' not '..'.
>>>>>
>>>>> In the stop procedure, you use the QUIT signal. That's going to
>>>>> produce a coredump of the process. Is that actually intended? Why
>>>>> not use KILL after TERM?
>>>>>
>>>>> On formatting: sometimes spaces are used and sometimes tabs for
>>>>> indentation. Can you please use either one or the other
>>>>> (preferably the latter).
>>>> hi,
>>>>
>>>> what is the current status on this one?
>>> Apparently waiting for some response from Kazutomo-san.
>>>
>>> Thanks,
>>>
>>> Dejan
>>>
>>>> cheers,
>>>> raoul
>>>> --
>>>> ____________________________________________________________________
>>>> DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax
>>>> Technischer Leiter
>>>>
>>>> IPAX - Aloy Bhatia Hava OEG web. http://www.ipax.at
>>>> Barawitzkagasse 10/2/2/11 email. office [at] ipax
>>>> 1190 Wien tel. +43 1 3670030
>>>> FN 277995t HG Wien fax. +43 1 3670030 15
>>>> ____________________________________________________________________
>>>> _______________________________________________________
>>>> Linux-HA-Dev: Linux-HA-Dev [at] lists
>>>> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
>>>> Home Page: http://linux-ha.org/
>>> _______________________________________________________
>>> Linux-HA-Dev: Linux-HA-Dev [at] lists
>>> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
>>> Home Page: http://linux-ha.org/
>>
>> --
>> ----------------------------------------
>> NAKAHIRA Kazutomo
>> NTT DATA INTELLILINK CORPORATION
>> Open Source Business Unit
>> Software Services Integration Business Division
>
>> #!/bin/bash
>> #
>> # Description: Manages a syslog-ng instance, provided by NTT OSSC as an
>> # OCF High-Availability resource under Heartbeat/LinuxHA control
>> #
>> # Copyright (c) 2009 NIPPON TELEGRAPH AND TELEPHONE CORPORATION
>> #
>> ##############################################################################
>> # OCF parameters:
>> # OCF_RESKEY_syslog_ng_binary : Path to syslog-ng binary.
>> # Default is "/sbin/syslog-ng"
>> # OCF_RESKEY_configfile : Configuration file
>> # OCF_RESKEY_start_opts : Startup options
>> # OCF_RESKEY_kill_term_timeout: Number of seconds to await to confirm a
>> # normal stop method
>> # OCF_RESKEY_kill_quit_timeout: Number of times to try forcible
>> # stop methods
>> #
>> # Only OCF_RESKEY_configfile must be specified. Each of the rests
>> # has its default value or refers OCF_RESKEY_configfile to make
>> # its value when no explicit value is given.
>> #
>> # Further infomation for setup:
>> # There are sample configurations at the end of this file.
>> #
>> ###############################################################################
>>
>> . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
>>
>> usage()
>> {
>> cat <<-!
>> usage: $0 action
>>
>> action:
>> start : start a new syslog-ng instance
>>
>> stop : stop the running syslog-ng instance
>>
>> status : return the status of syslog-ng, run or down
>>
>> monitor : return TRUE if the syslog-ng appears to be working.
>>
>> meta-data : show meta data message
>>
>> validate-all: validate the instance parameters
>> !
>> return $OCF_ERR_ARGS
>> }
>>
>> metadata_syslog_ng()
>> {
>> cat <<END
>> <?xml version="1.0"?>
>> <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
>> <resource-agent name="syslog_ng">
>> <version>1.0</version>
>>
>> <longdesc lang="en">
>> This script manages a syslog-ng instance as an HA resource.
>> </longdesc>
>> <shortdesc lang="en">Syslog-ng resource agent</shortdesc>
>>
>> <parameters>
>>
>> <parameter name="syslog_ng_binary" unique="0">
>> <longdesc lang="en">
>> This parameter specifies syslog-ng's executable file.
>> </longdesc>
>> <shortdesc>Executable file</shortdesc>
>> <content type="string" default=""/>
>> </parameter>
>>
>> <parameter name="configfile" unique="0" required="1">
>> <longdesc lang="en">
>> This parameter specifies a configuration file
>> for a syslog-ng instance managed by this RA.
>> </longdesc>
>> <shortdesc>Configuration file</shortdesc>
>> <content type="string" default=""/>
>> </parameter>
>>
>> <parameter name="start_opts" unique="0">
>> <longdesc lang="en">
>> This parameter specifies startup options for a
>> syslog-ng instance managed by this RA. When no value is given, no startup
>> options is used. Don't use option '-F'. It causes a stuck of a start action.
>> </longdesc>
>> <shortdesc>Start options</shortdesc>
>> <content type="string" default=""/>
>> </parameter>
>>
>> <parameter name="kill_term_timeout" unique="0">
>> <longdesc lang="en">
>> On a stop action, a normal stop method(pkill -TERM) is firstly used.
>> And then the confirmation of its completion is waited for
>> the specified seconds by this parameter.
>> The default value is 10.
>> </longdesc>
>> <shortdesc>Number of seconds to await to confirm a normal stop method</shortdesc>
>> <content type="integer" default="10"/>
>> </parameter>
>>
>> <parameter name="kill_quit_timeout" unique="0">
>> <longdesc lang="en">
>> On a stop action, if a normal stop method ends up with a failure,
>> more forcible methods are taken. These methods are repeated the
>> specified numbers by this parameter.
>> The default value is 10.
>> If every normal or forcible stop methods run into a failure,
>> the KILL signal is used as a final method to stop.
>> </longdesc>
>> <shortdesc>Number of times to try forcible stop methods</shortdesc>
>> <content type="integer" default="10"/>
>> </parameter>
>>
>> </parameters>
>>
>> <actions>
>> <action name="start" timeout="60s" />
>> <action name="stop" timeout="120s" />
>> <action name="status" timeout="60" />
>> <action name="monitor" depth="0" timeout="30s" interval="10s" start-delay="0" />
>
> Perhaps default interval to something like 60s? Don't know what's
> the case in other RAs. Should probably be reviewed.

The default monitor interval in major part of RAs is "10s" and
syslog-ng RA also follows this value.

Of course, this value should change according to the system
monitoring requirement.

>> <action name="meta-data" timeout="5s" />
>> <action name="validate-all" timeout="5"/>
>> </actions>
>> </resource-agent>
>> END
>> return $OCF_SUCCESS
>> }
>>
>> monitor_syslog_ng()
>> {
>> set -- $(pgrep -f "$PROCESS_PATTERN" 2>/dev/null)
>> case $# in
>> 0) ocf_log debug "No syslog-ng process for $CONFIGFILE"
>> return $OCF_NOT_RUNNING;;
>> 1) return $OCF_SUCCESS;;
>> esac
>> ocf_log err "mutiple syslog-ng process for $CONFIGFILE"
>
> BTW, does syslog-ng fork to process requests? Perhaps it's not
> necessary to treat this as an error condition. Note that on start
> it almost certainly does fork (most daemons do), so under some
> unfavourable conditions this code may fail.

I agree. I revised this part as follows.
If multiple syslog-ng process found in monitor, then
output warning level log and return OCF_SUCCESS.

> Cheers,
>
> Dejan
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev [at] lists
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/

Best Regards,
NAKAHIRA Kazutomo

--
----------------------------------------
NAKAHIRA Kazutomo
NTT DATA INTELLILINK CORPORATION
Open Source Business Unit
Software Services Integration Business Division
Attachments: syslog-ng (10.7 KB)


dejanmm at fastmail

Nov 16, 2009, 2:16 AM

Post #17 of 22 (2952 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

Hi Kazutomo-san,

On Mon, Nov 16, 2009 at 06:15:56PM +0900, NAKAHIRA Kazutomo wrote:
> Hi Dejan,
>
[...]
> >>QUIT signal for common linux process stop target process.
> >
> >From signal(7):
> >
> > SIGQUIT 3 Core Quit from keyboard
> >
> >i.e. there could be core dumps and I'm not sure if that's
> >what you intend.
> >
> What I intend is that if syslog-ng process never stops
> by the "kill -TERM", then trying core dump and stop process
> by the "kill -QUIT".
>
[...]
> I revised these parts and the syslog-ng RA's stop sequence is below.
>
> 1. Execute "kill -TERM" and wait KILL_TERM_TIMEOUT seconds
> until syslog-ng porcess stopped.
> 2. If sylog-ng process dose not stopped, then Execute
> "kill -QUIT" to dump core and stop process.

I still don't understand why would you want a coredump of the
syslog-ng process? Do you think that is really necessary? No
other resource agent does that.

Thanks,

Dejan
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


nakahira at intellilink

Nov 16, 2009, 3:05 AM

Post #18 of 22 (2942 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

Hi Dejan,

> I still don't understand why would you want a coredump of the
> syslog-ng process? Do you think that is really necessary? No
> other resource agent does that.
I believed that if RA can not stop process normally, then
RA should leave information as much as possible to analyze failuer.

But, as you say, syslog-ng's corefile is not too significant
for system manager certainly.
And it seems that syslog-ng process doesn't leave
beneficial information when QUIT signal is received.

I remove "pkill -QUIT" code and revised RA is attached.

Best Regards,
NAKAHIRA Kazutomo

Dejan Muhamedagic wrote:
> Hi Kazutomo-san,
>
> On Mon, Nov 16, 2009 at 06:15:56PM +0900, NAKAHIRA Kazutomo wrote:
>> Hi Dejan,
>>
> [...]
>>>> QUIT signal for common linux process stop target process.
>> >From signal(7):
>>> SIGQUIT 3 Core Quit from keyboard
>>>
>>> i.e. there could be core dumps and I'm not sure if that's
>>> what you intend.
>>>
>> What I intend is that if syslog-ng process never stops
>> by the "kill -TERM", then trying core dump and stop process
>> by the "kill -QUIT".
>>
> [...]
>> I revised these parts and the syslog-ng RA's stop sequence is below.
>>
>> 1. Execute "kill -TERM" and wait KILL_TERM_TIMEOUT seconds
>> until syslog-ng porcess stopped.
>> 2. If sylog-ng process dose not stopped, then Execute
>> "kill -QUIT" to dump core and stop process.
>
> I still don't understand why would you want a coredump of the
> syslog-ng process? Do you think that is really necessary? No
> other resource agent does that.
>
> Thanks,
>
> Dejan
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev [at] lists
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/


--
----------------------------------------
NAKAHIRA Kazutomo
NTT DATA INTELLILINK CORPORATION
Open Source Business Unit
Software Services Integration Business Division
Attachments: syslog-ng (10.6 KB)


dejanmm at fastmail

Nov 23, 2009, 6:26 AM

Post #19 of 22 (2673 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

Hi Kazutomo-san,

Your syslog-ng agent is now in the agents repository. I just
changed a bit the meta-data and replaced wrong exit code in
usage().

Cheers,

Dejan

On Mon, Nov 16, 2009 at 08:05:59PM +0900, NAKAHIRA Kazutomo wrote:
> Hi Dejan,
>
> > I still don't understand why would you want a coredump of the
> > syslog-ng process? Do you think that is really necessary? No
> > other resource agent does that.
> I believed that if RA can not stop process normally, then
> RA should leave information as much as possible to analyze failuer.
>
> But, as you say, syslog-ng's corefile is not too significant
> for system manager certainly.
> And it seems that syslog-ng process doesn't leave
> beneficial information when QUIT signal is received.
>
> I remove "pkill -QUIT" code and revised RA is attached.
>
> Best Regards,
> NAKAHIRA Kazutomo
>
> Dejan Muhamedagic wrote:
> >Hi Kazutomo-san,
> >
> >On Mon, Nov 16, 2009 at 06:15:56PM +0900, NAKAHIRA Kazutomo wrote:
> >>Hi Dejan,
> >>
> >[...]
> >>>>QUIT signal for common linux process stop target process.
> >>>From signal(7):
> >>> SIGQUIT 3 Core Quit from keyboard
> >>>
> >>>i.e. there could be core dumps and I'm not sure if that's
> >>>what you intend.
> >>>
> >>What I intend is that if syslog-ng process never stops
> >>by the "kill -TERM", then trying core dump and stop process
> >>by the "kill -QUIT".
> >>
> >[...]
> >>I revised these parts and the syslog-ng RA's stop sequence is below.
> >>
> >>1. Execute "kill -TERM" and wait KILL_TERM_TIMEOUT seconds
> >> until syslog-ng porcess stopped.
> >>2. If sylog-ng process dose not stopped, then Execute
> >> "kill -QUIT" to dump core and stop process.
> >
> >I still don't understand why would you want a coredump of the
> >syslog-ng process? Do you think that is really necessary? No
> >other resource agent does that.
> >
> >Thanks,
> >
> >Dejan
> >_______________________________________________________
> >Linux-HA-Dev: Linux-HA-Dev [at] lists
> >http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> >Home Page: http://linux-ha.org/
>
>
> --
> ----------------------------------------
> NAKAHIRA Kazutomo
> NTT DATA INTELLILINK CORPORATION
> Open Source Business Unit
> Software Services Integration Business Division

> #!/bin/bash
> #
> # Description: Manages a syslog-ng instance, provided by NTT OSSC as an
> # OCF High-Availability resource under Heartbeat/LinuxHA control
> #
> # Copyright (c) 2009 NIPPON TELEGRAPH AND TELEPHONE CORPORATION
> #
> ##############################################################################
> # OCF parameters:
> # OCF_RESKEY_syslog_ng_binary : Path to syslog-ng binary.
> # Default is "/sbin/syslog-ng"
> # OCF_RESKEY_configfile : Configuration file
> # OCF_RESKEY_start_opts : Startup options
> # OCF_RESKEY_kill_term_timeout: Number of seconds to await to confirm a
> # normal stop method
> #
> # Only OCF_RESKEY_configfile must be specified. Each of the rests
> # has its default value or refers OCF_RESKEY_configfile to make
> # its value when no explicit value is given.
> #
> # Further infomation for setup:
> # There are sample configurations at the end of this file.
> #
> ###############################################################################
>
> . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
>
> usage()
> {
> cat <<-!
> usage: $0 action
>
> action:
> start : start a new syslog-ng instance
>
> stop : stop the running syslog-ng instance
>
> status : return the status of syslog-ng, run or down
>
> monitor : return TRUE if the syslog-ng appears to be working.
>
> meta-data : show meta data message
>
> validate-all: validate the instance parameters
> !
> return $OCF_ERR_ARGS
> }
>
> metadata_syslog_ng()
> {
> cat <<END
> <?xml version="1.0"?>
> <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
> <resource-agent name="syslog_ng">
> <version>1.0</version>
>
> <longdesc lang="en">
> This script manages a syslog-ng instance as an HA resource.
> </longdesc>
> <shortdesc lang="en">Syslog-ng resource agent</shortdesc>
>
> <parameters>
>
> <parameter name="syslog_ng_binary" unique="0">
> <longdesc lang="en">
> This parameter specifies syslog-ng's executable file.
> </longdesc>
> <shortdesc>Executable file</shortdesc>
> <content type="string" default=""/>
> </parameter>
>
> <parameter name="configfile" unique="0" required="1">
> <longdesc lang="en">
> This parameter specifies a configuration file
> for a syslog-ng instance managed by this RA.
> </longdesc>
> <shortdesc>Configuration file</shortdesc>
> <content type="string" default=""/>
> </parameter>
>
> <parameter name="start_opts" unique="0">
> <longdesc lang="en">
> This parameter specifies startup options for a
> syslog-ng instance managed by this RA. When no value is given, no startup
> options is used. Don't use option '-F'. It causes a stuck of a start action.
> </longdesc>
> <shortdesc>Start options</shortdesc>
> <content type="string" default=""/>
> </parameter>
>
> <parameter name="kill_term_timeout" unique="0">
> <longdesc lang="en">
> On a stop action, a normal stop method(pkill -TERM) is firstly used.
> And then the confirmation of its completion is waited for
> the specified seconds by this parameter.
> The default value is 10.
> </longdesc>
> <shortdesc>Number of seconds to await to confirm a normal stop method</shortdesc>
> <content type="integer" default="10"/>
> </parameter>
>
> </parameters>
>
> <actions>
> <action name="start" timeout="60s" />
> <action name="stop" timeout="120s" />
> <action name="status" timeout="60" />
> <action name="monitor" depth="0" timeout="30s" interval="10s" start-delay="0" />
> <action name="meta-data" timeout="5s" />
> <action name="validate-all" timeout="5"/>
> </actions>
> </resource-agent>
> END
> return $OCF_SUCCESS
> }
>
> monitor_syslog_ng()
> {
> set -- $(pgrep -f "$PROCESS_PATTERN" 2>/dev/null)
> case $# in
> 0) ocf_log debug "No syslog-ng process for $CONFIGFILE"
> return $OCF_NOT_RUNNING;;
> 1) return $OCF_SUCCESS;;
> esac
> ocf_log warn "Multiple syslog-ng process for $CONFIGFILE"
> return $OCF_SUCCESS
> }
>
> start_syslog_ng()
> {
> monitor_syslog_ng
> if [[ $? = "$OCF_SUCCESS" ]]; then
> return $OCF_SUCCESS
> fi
>
> # set -- $SYSLOG_NG_OPTS
> # ocf_run "$SYSLOG_NG_EXE" -f "$SYSLOG_NG_CONF" "$@"
> # reduce to this?
> ocf_run "$SYSLOG_NG_EXE" -f "$CONFIGFILE" $START_OPTS
> ocf_status=$?
> if [[ "$ocf_status" != "$OCF_SUCCESS" ]]; then
> return $ocf_status
> fi
>
> while true; do
> monitor_syslog_ng
> if [[ $? = "$OCF_SUCCESS" ]]; then
> return $OCF_SUCCESS
> fi
> sleep 1
> done
> }
>
> stop_syslog_ng()
> {
> pkill -TERM -f "$PROCESS_PATTERN"
>
> typeset lapse_sec=0
> while pgrep -f "$PROCESS_PATTERN" > /dev/null; do
> sleep 1
> lapse_sec=$(( lapse_sec + 1 ))
> ocf_log debug "stop_syslog_ng[$SYSLOG_NG_NAME]: stop NORM $lapse_sec/$KILL_TERM_TIMEOUT"
> if [ $lapse_sec -ge $KILL_TERM_TIMEOUT ]; then
> break
> fi
> done
>
> # if the process can't be removed, then the following part is
> # not going to be executed (the RA will be killed by lrmd on
> # timeout) and the pidfile will remain; don't know if that
> # has any consequences
> # 2009/09/18 Nakahira
> # If the syslog-ng process hangs, syslog-ng RA waits
> # $KILL_TERM_TIMEOUT seconds.
> # The stop timeout of RA should be longer than $KILL_TERM_TIMEOUT.
> lapse_sec=0
> while pgrep -f "$PROCESS_PATTERN" > /dev/null; do
> pkill -KILL -f "$PROCESS_PATTERN"
> sleep 1
> lapse_sec=$(( lapse_sec + 1 ))
> ocf_log debug "stop_syslog_ng[$SYSLOG_NG_NAME]: suspend syslog_ng by SIGKILL ($lapse_sec/@@@)"
> done
>
> return $OCF_SUCCESS
> }
>
> status_syslog_ng()
> {
> # ???? why not monitor and then print running or stopped
> monitor_syslog_ng
> rc=$?
> if [ $rc = $OCF_SUCCESS ]; then
> echo "Syslog-ng service is running."
> elif [ $rc = $OCF_NOT_RUNNING ]; then
> echo "Syslog-ng service is stopped."
> else
> echo "Mutiple syslog-ng process for $CONFIGFILE."
> fi
> return $rc
> }
>
> validate_all_syslog_ng()
> {
> ocf_log info "validate_all_syslog_ng[$SYSLOG_NG_NAME]"
> return $OCF_SUCCESS
> }
>
> if [[ "$1" = "meta-data" ]]; then
> metadata_syslog_ng
> exit $?
> fi
>
> CONFIGFILE="${OCF_RESKEY_configfile}"
> if [[ -z "$CONFIGFILE" ]]; then
> ocf_log err "undefined parameter:configfile"
> exit $OCF_ERR_CONFIGURED
> fi
>
> SYSLOG_NG_NAME=${CONFIGFILE##*/}
> SYSLOG_NG_NAME=${SYSLOG_NG_NAME%.*}
>
> SYSLOG_NG_EXE="${OCF_RESKEY_syslog_ng_binary-/sbin/syslog-ng}"
> # why not default to /sbin/syslog-ng?
> #if [[ -z "$SYSLOG_NG_EXE" ]]; then
> # ocf_log err "Undefined parameter:syslog_ng_binary"
> # exit $OCF_ERR_CONFIGURED
> #fi
> if [[ ! -x "$SYSLOG_NG_EXE" ]]; then
> ocf_log err "Invalid value:syslog_ng_binary:$SYSLOG_NG_EXE"
> exit $OCF_ERR_CONFIGURED
> fi
>
> # actually, the pidfile has no function; the status is checked by
> # testing for a running process only
>
> KILL_TERM_TIMEOUT="${OCF_RESKEY_kill_term_timeout-10}"
> if ! ocf_is_decimal "$KILL_TERM_TIMEOUT"; then
> ocf_log err "Invalid value:kill_term_timeout:$KILL_TERM_TIMEOUT"
> exit $OCF_ERR_CONFIGURED
> fi
>
> START_OPTS=${OCF_RESKEY_start_opts}
> PROCESS_PATTERN="$SYSLOG_NG_EXE -f $CONFIGFILE"
>
> COMMAND=$1
>
> case "$COMMAND" in
> start)
> ocf_log debug "[$SYSLOG_NG_NAME] Enter syslog_ng start"
> start_syslog_ng
> func_status=$?
> ocf_log debug "[$SYSLOG_NG_NAME] Leave syslog_ng start $func_status"
> exit $func_status
> ;;
> stop)
> ocf_log debug "[$SYSLOG_NG_NAME] Enter syslog_ng stop"
> stop_syslog_ng
> func_status=$?
> ocf_log debug "[$SYSLOG_NG_NAME] Leave syslog_ng stop $func_status"
> exit $func_status
> ;;
> status)
> status_syslog_ng
> exit $?
> ;;
> monitor)
> #ocf_log debug "[$SYSLOG_NG_NAME] Enter syslog_ng monitor"
> monitor_syslog_ng
> func_status=$?
> #ocf_log debug "[$SYSLOG_NG_NAME] Leave syslog_ng monitor $func_status"
> exit $func_status
> ;;
> validate-all)
> validate_all_syslog_ng
> exit $?
> ;;
> *)
> usage
> ;;
> esac
>
> # vim: set sw=4 ts=4 :
>
> ### A sample snippet of cib.xml for a syslog-ng resource
> ##
> # <primitive id="prmApSyslog-ng" class="ocf" type="syslog-ng" provider="heartbeat">
> # <instance_attributes id="prmDummyB_instance_attrs">
> # <attributes>
> # <nvpair id="atr:Syslog-ng:syslog-ng:syslog_ng_binary" name="syslog_ng_binary" value="/sbin/syslog-ng"/>
> # <nvpair id="atr:Syslog-ng:syslog-ng:configfile" name="configfile" value="/etc/syslog-ng/syslog-ng-ext.conf"/>
> # </attributes>
> # </instance_attributes>
> # <operations>
> # <op id="op:prmSyslog-ng:start" name="start" timeout="60s" on_fail="restart"/>
> # <op id="op:prmSyslog-ng:monitor" name="monitor" interval="10s" timeout="60s" on_fail="restart"/>
> # <op id="op:prmSyslog-ng:stop" name="stop" timeout="60s" on_fail="block"/>
> # </operations>
> # </primitive>
>
> ### A sample syslog-ng configuration file for a log collecting host
> ###
> ### This sample is for a log collecting host by syslog-ng.
> ### A syslog-ng process configurated by this sample accepts all messages
> ### from a certain network. Any message from the network is preserved into
> ### a file for security infomation. Restricting messages to "authpriv" from
> ### the network is done on log sending hosts. (See the sample below)
> ### Any internal message of the syslog-ng process is preserved into its
> ### dedicated file. And any "authpriv" internal message of the syslog-ng
> ### process is also preserved into the security infomation file.
> ###
> ### Change "f_incoming" to suit your enviroment.
> ### If you use it as a configuration file for the sample cib.xml above,
> ### save it into "/etc/syslog-ng/syslog-ng-ext.conf".
> ##
> #options {
> # sync (0);
> # time_reopen (10);
> # log_fifo_size (1000);
> # long_hostnames (off);
> # use_dns (yes);
> # use_fqdn (no);
> # create_dirs (no);
> # keep_hostname (yes); };
> #
> #source s_internal { internal(); };
> #source s_incoming { udp(port(514)); };
> #filter f_internal { facility(authpriv); };
> #filter f_incoming { netmask("172.20.0.0/255.255.192.0"); };
> #
> #destination d_internal { file("/var/log/syslog-ng-ext.log" perm(0640));};
> #destination d_incoming {
> # file("/var/log/secure-ext.log" create_dirs(yes) perm(0640)); };
> #
> #log { source(s_internal); destination(d_internal); };
> #log { source(s_internal); filter(f_internal); destination(d_incoming); };
> #log { source(s_incoming); filter(f_incoming); destination(d_incoming); };
>
> ### A sample snippet of syslog-ng configuration file for a log sending host
> ###
> ### This sample is for a log sending host that uses syslog-ng.
> ###
> ### Replace "syslog-ng-ext" to the IP address or the hostname of your
> ### log collecting host and append it to "syslog-ng.conf" of each log sending
> ### host. See the install default syslog-ng.conf to know what "s_sys" and
> ### "f_auth" are.
> ##
> #destination d_outgoing { udp("syslog-ng-ext" port(514)); };
> #log { source(s_sys); filter(f_auth); destination(d_outgoing); };
>
> ### A sample snippet of syslog configuration file for a log sending host
> ###
> ### This sample is for a log sending host that uses syslog.
> ###
> ### Replace "syslog-ng-ext" to the IP address or the hostname of your
> ### log collecting host and append it to "syslog.conf" of each log sending
> ### host.
> ##
> # authpriv.* @syslog-ng-ext

> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev [at] lists
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/

_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


r.bhatia at ipax

Nov 24, 2009, 1:05 AM

Post #20 of 22 (2654 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

On 11/23/2009 03:26 PM, Dejan Muhamedagic wrote:
> Hi Kazutomo-san,
>
> Your syslog-ng agent is now in the agents repository. I just
> changed a bit the meta-data and replaced wrong exit code in
> usage().

hi,

now that the syslog-ng agent is commited, what would the correct way
be to generalize it for other syslog daemons? e.g. rsyslog?

cheers,
raoul
--
____________________________________________________________________
DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax
Technischer Leiter

IPAX - Aloy Bhatia Hava OEG web. http://www.ipax.at
Barawitzkagasse 10/2/2/11 email. office [at] ipax
1190 Wien tel. +43 1 3670030
FN 277995t HG Wien fax. +43 1 3670030 15
____________________________________________________________________
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


r.bhatia at ipax

Dec 10, 2009, 8:19 AM

Post #21 of 22 (2334 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

On 11/24/2009 10:05 AM, Raoul Bhatia [IPAX] wrote:
> On 11/23/2009 03:26 PM, Dejan Muhamedagic wrote:
>> Hi Kazutomo-san,
>>
>> Your syslog-ng agent is now in the agents repository. I just
>> changed a bit the meta-data and replaced wrong exit code in
>> usage().
>
> hi,
>
> now that the syslog-ng agent is commited, what would the correct way
> be to generalize it for other syslog daemons? e.g. rsyslog?

*bump* i know we're frozen but i still would like to know..

cheers,
--
____________________________________________________________________
DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax
Technischer Leiter

IPAX - Aloy Bhatia Hava OEG web. http://www.ipax.at
Barawitzkagasse 10/2/2/11 email. office [at] ipax
1190 Wien tel. +43 1 3670030
FN 277995t HG Wien fax. +43 1 3670030 15
____________________________________________________________________
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


dejanmm at fastmail

Dec 11, 2009, 4:57 AM

Post #22 of 22 (2322 views)
Permalink
Re: An OCF RA for syslog-ng [In reply to]

Hi,

On Thu, Dec 10, 2009 at 05:19:29PM +0100, Raoul Bhatia [IPAX] wrote:
> On 11/24/2009 10:05 AM, Raoul Bhatia [IPAX] wrote:
> > On 11/23/2009 03:26 PM, Dejan Muhamedagic wrote:
> >> Hi Kazutomo-san,
> >>
> >> Your syslog-ng agent is now in the agents repository. I just
> >> changed a bit the meta-data and replaced wrong exit code in
> >> usage().
> >
> > hi,
> >
> > now that the syslog-ng agent is commited, what would the correct way
> > be to generalize it for other syslog daemons? e.g. rsyslog?
>
> *bump* i know we're frozen but i still would like to know..

Actually, nothing to do with being frozen :) Since this RA is
called syslog-ng, from the usage point of view it would be really
hard to coerce it into supporting other syslog daemons. Perhaps
if the name were "syslog", otherwise it would be strange to
configure a resource of type "syslog-ng" to support "rsyslog" or
whatever. So, I'm afraid that it's too late for what you propose.

Thanks,

Dejan


> cheers,
> --
> ____________________________________________________________________
> DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax
> Technischer Leiter
>
> IPAX - Aloy Bhatia Hava OEG web. http://www.ipax.at
> Barawitzkagasse 10/2/2/11 email. office [at] ipax
> 1190 Wien tel. +43 1 3670030
> FN 277995t HG Wien fax. +43 1 3670030 15
> ____________________________________________________________________
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev [at] lists
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Linux-HA dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.