On Mon, Jan 30, 2012 at 09:24:19PM +0100, Dejan Muhamedagic wrote: > > As for the regular expression like ^ or $, it looks like working as > > expected with -z option in my quick tests. > > Do you have any examples that it may break the configuration? > > For instance, what I see here in the status page is also a PID at > the beginning of line: > > xen-d:~ # wget -q -O- -L --no-proxy --bind-address ::1 > http://[::1]/server-status | grep ^PID > PID Key: <br /> > xen-d:~ # wget -q -O- -L --no-proxy --bind-address ::1 > http://[::1]/server-status | grep -z ^PID > xen-d:~ # echo $? > 1
different versions of grep in various distributions seem to behave differently with -z and ^: distro; grep --version | head -n1; printf "A\nB\nC\n" | grep -q -z ^B ; echo $? etch grep (GNU grep) 2.5.1 0 lenny GNU grep 2.5.3 0 squeeze GNU grep 2.6.3 1 breaks lucid GNU grep 2.5.4 0 rhel4 grep (GNU grep) 2.5.1 1 breaks rhel5 grep (GNU grep) 2.5.1 0 rhel6 GNU grep 2.6.3 1 breaks sles9 grep (GNU grep) 2.5.1 1 breaks sles10 grep (GNU grep) 2.5.1 1 breaks sles11 GNU grep 2.5.2 1 breaks sles11-sp1 GNU grep 2.5.2 1 breaks So neither distros nor grep version seem to agree if "^" is supposed to be equivalent to pcre /^/m or /\A/ ;-) Best practices for monitoring apache with pacemaker would be to have some dedicated page print out either a text/plain "ALL OK" only. Or, in case something is wrong, anything with arbitrary diagnostic output, if any, which reliably does not containing that string. > But we could just as well reduce to the default regular > expression to '</ *html *>'. If nobody objects :) As the default regex only checks for basically "any" response that remotely looks like it may have something to do with html output, that should be fine. -- : Lars Ellenberg : LINBIT | Your Way to High Availability : DRBD/HA support and consulting http://www.linbit.com _______________________________________________________ Linux-HA-Dev: [email protected] http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev Home Page: http://linux-ha.org/
