Command line stats

Brad Fitzpatrick brad at danga.com
Sun Feb 4 18:41:35 UTC 2007


Hmm... I'd thought this was fixed awhile back.  I at least remember seeing
a patch for it?  Steven?

Garth, what version is this?


On Sun, 4 Feb 2007, Garth Webb wrote:

> I've noticed a few people on the list pulling stats from memcached by
> telneting to the memcached port.  The problem that you've probably found
> (and what I found) was that something like this
>
>   echo stats | nc memd-host 11211
>
> doesn't work because the 'echo' sends "stats" a split second before the
> connection is actually established.  So you have to cook thing up like:
>
>   (sleep 1; echo stats) | nc memd-host 11211
>
>   echo stats | nc -i1 memd-host 11211
>
> This isn't ideal since you have to wait a full second to get any
> information.  This isn't too bad with one memcached server, but with
> several, the time to get a full report can be pretty long.
>
> So, just as an FYI, here's some linux command line foo that we cooked up
> that will return stats as quickly as memcached can be contacted and
> return them:
>
>   exec 9<>/dev/tcp/memd-host/11211 ; echo -e "stats\nquit" >&9; cat <&9
>
> Obviously Perl/Python/Java will be able to do this for you, but this is
> good for quick and dirty command line tools and simple monitoring
> scripts.
>
> Garth
>
>


More information about the memcached mailing list