<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How NOT to test that mysqld is alive</title>
	<atom:link href="http://code.openark.org/blog/mysql/how-not-to-test-that-mysqld-is-alive/feed" rel="self" type="application/rss+xml" />
	<link>http://code.openark.org/blog/mysql/how-not-to-test-that-mysqld-is-alive</link>
	<description>Blog by Shlomi Noach</description>
	<lastBuildDate>Sat, 13 Mar 2010 09:46:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Vitlalie Cherpec</title>
		<link>http://code.openark.org/blog/mysql/how-not-to-test-that-mysqld-is-alive/comment-page-2#comment-9064</link>
		<dc:creator>Vitlalie Cherpec</dc:creator>
		<pubDate>Wed, 06 Jan 2010 11:43:37 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1355#comment-9064</guid>
		<description>I&#039;m using Nagios (http://www.nagios.org/) to monitor mysql servers. Reinventing the wheel is too error prone, just stick with stable and tested solutions. If Nagios itself is too complex, Nagios plugins can be used from scripts. :

Usage help for check_mysql plugin:

[vitalie@shark ~]$ /usr/lib64/nagios/plugins/check_mysql --help

check_mysql v2034 (nagios-plugins 1.4.13)
Copyright (c) 1999-2007 Nagios Plugin Development Team
        

This program tests connections to a mysql server


Usage: check_mysql [-d database] [-H host] [-P port] [-s socket]
       [-u user] [-p password] [-S]

[...]</description>
		<content:encoded><![CDATA[<p>I&#8217;m using Nagios (<a href="http://www.nagios.org/" rel="nofollow">http://www.nagios.org/</a>) to monitor mysql servers. Reinventing the wheel is too error prone, just stick with stable and tested solutions. If Nagios itself is too complex, Nagios plugins can be used from scripts. :</p>
<p>Usage help for check_mysql plugin:</p>
<p>[vitalie@shark ~]$ /usr/lib64/nagios/plugins/check_mysql &#8211;help</p>
<p>check_mysql v2034 (nagios-plugins 1.4.13)<br />
Copyright (c) 1999-2007 Nagios Plugin Development Team</p>
<p>This program tests connections to a mysql server</p>
<p>Usage: check_mysql [-d database] [-H host] [-P port] [-s socket]<br />
       [-u user] [-p password] [-S]</p>
<p>[...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ajd4096</title>
		<link>http://code.openark.org/blog/mysql/how-not-to-test-that-mysqld-is-alive/comment-page-2#comment-4664</link>
		<dc:creator>ajd4096</dc:creator>
		<pubDate>Thu, 08 Oct 2009 06:23:44 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1355#comment-4664</guid>
		<description>/proc is not deprecated (nor depreciated) on HP-UX, it never had it, AFAIK.

FreeBSD/OpenBSD/NetBSD have a procfs, but it is not mounted by default.

(The main reason for avoiding procfs is that reading from /proc in user-space suffers from TOCTOU, whereas a system call does not. This issue was raised yet again on the OpenBSD misc@ mailing list only a few weeks ago.)

There is a procfs for OSX, it&#039;s MacFUSE-based, not from Apple, and not even installed by default.

Obviously there is a sizeable percentage of unix systems where a script referring to /proc will not work.

Now, about the ubiquity of that &quot;bash&quot; shell....</description>
		<content:encoded><![CDATA[<p>/proc is not deprecated (nor depreciated) on HP-UX, it never had it, AFAIK.</p>
<p>FreeBSD/OpenBSD/NetBSD have a procfs, but it is not mounted by default.</p>
<p>(The main reason for avoiding procfs is that reading from /proc in user-space suffers from TOCTOU, whereas a system call does not. This issue was raised yet again on the OpenBSD misc@ mailing list only a few weeks ago.)</p>
<p>There is a procfs for OSX, it&#8217;s MacFUSE-based, not from Apple, and not even installed by default.</p>
<p>Obviously there is a sizeable percentage of unix systems where a script referring to /proc will not work.</p>
<p>Now, about the ubiquity of that &#8220;bash&#8221; shell&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zach</title>
		<link>http://code.openark.org/blog/mysql/how-not-to-test-that-mysqld-is-alive/comment-page-2#comment-4646</link>
		<dc:creator>Zach</dc:creator>
		<pubDate>Wed, 07 Oct 2009 13:33:21 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1355#comment-4646</guid>
		<description>@FredV

you are totally incorrect, /proc is not in every Unix... /proc has been depreciated in older SysV style OS&#039;es... like ..wait for it... HPUX!</description>
		<content:encoded><![CDATA[<p>@FredV</p>
<p>you are totally incorrect, /proc is not in every Unix&#8230; /proc has been depreciated in older SysV style OS&#8217;es&#8230; like ..wait for it&#8230; HPUX!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: FredV</title>
		<link>http://code.openark.org/blog/mysql/how-not-to-test-that-mysqld-is-alive/comment-page-2#comment-4637</link>
		<dc:creator>FredV</dc:creator>
		<pubDate>Wed, 07 Oct 2009 07:29:07 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1355#comment-4637</guid>
		<description>&quot;/proc is not a standard Unix feature, nor is bash.&quot;

that&#039;s why every unix has it?</description>
		<content:encoded><![CDATA[<p>&#8220;/proc is not a standard Unix feature, nor is bash.&#8221;</p>
<p>that&#8217;s why every unix has it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ajd4096</title>
		<link>http://code.openark.org/blog/mysql/how-not-to-test-that-mysqld-is-alive/comment-page-2#comment-4633</link>
		<dc:creator>ajd4096</dc:creator>
		<pubDate>Wed, 07 Oct 2009 03:46:32 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1355#comment-4633</guid>
		<description>@FredV
/proc is not a standard Unix feature, nor is bash.

There is more to unix than the linux distro du-jour.</description>
		<content:encoded><![CDATA[<p>@FredV<br />
/proc is not a standard Unix feature, nor is bash.</p>
<p>There is more to unix than the linux distro du-jour.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: FredV</title>
		<link>http://code.openark.org/blog/mysql/how-not-to-test-that-mysqld-is-alive/comment-page-2#comment-4615</link>
		<dc:creator>FredV</dc:creator>
		<pubDate>Tue, 06 Oct 2009 18:57:14 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1355#comment-4615</guid>
		<description>Adam: using /proc (a standard Unix feature) and bash-compatible shell script is not portable and brittle? i disagree. asfor extensible: who on earth would want to build something on top and exapand on this? It&#039;s a quick hack anyway, normally you shouldn&#039;t have to do stuff like this.

btw. using /proc, which is *not* as stupid as grepping ps output without even using awk to split into columns. a process can change how it&#039;s displayed in ps by changing argv[0], so the /proc solution I gave is actually the only one that will always work and not brittle as you say</description>
		<content:encoded><![CDATA[<p>Adam: using /proc (a standard Unix feature) and bash-compatible shell script is not portable and brittle? i disagree. asfor extensible: who on earth would want to build something on top and exapand on this? It&#8217;s a quick hack anyway, normally you shouldn&#8217;t have to do stuff like this.</p>
<p>btw. using /proc, which is *not* as stupid as grepping ps output without even using awk to split into columns. a process can change how it&#8217;s displayed in ps by changing argv[0], so the /proc solution I gave is actually the only one that will always work and not brittle as you say</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam Nelson</title>
		<link>http://code.openark.org/blog/mysql/how-not-to-test-that-mysqld-is-alive/comment-page-2#comment-4607</link>
		<dc:creator>Adam Nelson</dc:creator>
		<pubDate>Tue, 06 Oct 2009 15:48:42 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1355#comment-4607</guid>
		<description>I&#039;m a little disturbed by all the people still posting ps and proc options.

It&#039;s fun that these tricks can be done, but any of that type of custom scripting is not extensible, rarely portable, and highly brittle under a panoply of eventualities.

I know there are systems that have been up for 10 years on this kind of stuff, but it&#039;s not responsible for such band-aids to be allowed to be permanent (or for SysAdmins to think that those are real, proper solutions).</description>
		<content:encoded><![CDATA[<p>I&#8217;m a little disturbed by all the people still posting ps and proc options.</p>
<p>It&#8217;s fun that these tricks can be done, but any of that type of custom scripting is not extensible, rarely portable, and highly brittle under a panoply of eventualities.</p>
<p>I know there are systems that have been up for 10 years on this kind of stuff, but it&#8217;s not responsible for such band-aids to be allowed to be permanent (or for SysAdmins to think that those are real, proper solutions).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ajd4096</title>
		<link>http://code.openark.org/blog/mysql/how-not-to-test-that-mysqld-is-alive/comment-page-2#comment-4601</link>
		<dc:creator>ajd4096</dc:creator>
		<pubDate>Tue, 06 Oct 2009 09:56:27 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1355#comment-4601</guid>
		<description>Install MySQL Enterprise Monitor!

Note that it runs a separate instance of mysqld, so &quot;ps&#124;grep&#124;wc&quot; tricks are suddenly useless.

Not that they ever were a good trick, for a number of reasons.
* The race condition mentioned does occur.
* &quot;ps -C&quot; is not portable.
* Processes hang sometimes, functional testing is required.
* Monitoring &quot;foo&quot; should not break when &quot;bar&quot; is run, if/even when &quot;bar&quot; is &quot;foo2&quot;.</description>
		<content:encoded><![CDATA[<p>Install MySQL Enterprise Monitor!</p>
<p>Note that it runs a separate instance of mysqld, so &#8220;ps|grep|wc&#8221; tricks are suddenly useless.</p>
<p>Not that they ever were a good trick, for a number of reasons.<br />
* The race condition mentioned does occur.<br />
* &#8220;ps -C&#8221; is not portable.<br />
* Processes hang sometimes, functional testing is required.<br />
* Monitoring &#8220;foo&#8221; should not break when &#8220;bar&#8221; is run, if/even when &#8220;bar&#8221; is &#8220;foo2&#8243;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: FredV</title>
		<link>http://code.openark.org/blog/mysql/how-not-to-test-that-mysqld-is-alive/comment-page-1#comment-4598</link>
		<dc:creator>FredV</dc:creator>
		<pubDate>Tue, 06 Oct 2009 08:02:38 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1355#comment-4598</guid>
		<description>looks like some sysadmin wannabe does not even know how to use awk and regular expressions, any kid should see the holes in that solution

for procf in /proc/[0-9]*; do
    if [ &quot;$(cat $procf/exename)&quot; = &quot;/usr/bin/mysqld&quot; ]; then
        echo &quot;process is running&quot;
    fi
done</description>
		<content:encoded><![CDATA[<p>looks like some sysadmin wannabe does not even know how to use awk and regular expressions, any kid should see the holes in that solution</p>
<p>for procf in /proc/[0-9]*; do<br />
    if [ "$(cat $procf/exename)" = "/usr/bin/mysqld" ]; then<br />
        echo &#8220;process is running&#8221;<br />
    fi<br />
done</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shlomi</title>
		<link>http://code.openark.org/blog/mysql/how-not-to-test-that-mysqld-is-alive/comment-page-1#comment-4597</link>
		<dc:creator>shlomi</dc:creator>
		<pubDate>Tue, 06 Oct 2009 06:42:26 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=1355#comment-4597</guid>
		<description>@sharks
I agree, please re-read the last paragraph in my post.
Please also note the duality within mysql: &quot;mysqladmin ping&quot; conencts via socket etc., while &quot;mysqld status&quot; checks for pid file and process id.

Regards</description>
		<content:encoded><![CDATA[<p>@sharks<br />
I agree, please re-read the last paragraph in my post.<br />
Please also note the duality within mysql: &#8220;mysqladmin ping&#8221; conencts via socket etc., while &#8220;mysqld status&#8221; checks for pid file and process id.</p>
<p>Regards</p>
]]></content:encoded>
	</item>
</channel>
</rss>
