简体   繁体   English

监控杂种队列长度

[英]Monitoring Mongrel queue length

I have a Apache + Haproxy + Mongrel Cluster setup. 我有一个Apache + Haproxy + Mongrel群集设置。 I want to receive alerts whenever my Mongrel queue length gets too high. 我想在我的Mongrel队列长度过长时接收警报。

How to I get the current Mongrel Queue length and make it available for alerting tools such as Monit and Nagios? 如何获得当前的Mongrel队列长度,并使其可用于Monit和Nagios等警报工具?

I know that Haproxy has the information about Mongrel queue as it intelligently sends requests to least busy Mongrel in the cluster. 我知道Haproxy具有有关Mongrel队列的信息,因为它可以智能地将请求发送到群集中最不繁忙的Mongrel。 I wonder how it finds out? 我想知道它是怎么发现的? I need a similar mechanism to generate alerts and/or restart mongrels when such a condition arrives. 我需要一种类似的机制来在发生这种情况时生成警报和/或重新启动mongrels。

Add this to your haproxy config 将此添加到您的haproxy配置

        stats uri /haproxy/hastats

Then use lynx to get the stats like this: (assuming haproxy runs on port 10000 - adjust to suit) 然后使用lynx获取如下统计信息:(假设haproxy在端口10000上运行-进行调整以适合)

 lynx --dump http://my-server:10000/haproxy/hastats

Each there will be a line for each of your server entries in the haproxy config file, telling you whether it's up or down, how long it's queue is, like this: 在haproxy配置文件中,每个服务器条目的每一行都会有一行,告诉您它是启动还是关闭,队列有多长时间,如下所示:

            Server                 Queue             Sessions                    Errors
  Name    Weight Status Act. Bck. Curr. Max. Curr. Max. Limit  Cumul.   Conn. Resp. Sec. Check Down
primary     1      UP    Y    -      0    0    68  386     - 134385861   207   699    0  7028  150
secondary    1      UP    Y    -      0    0    71  248     - 134464984   216   551    0  7129   98

Now all you need is a script to get the current queue (column 6) and feed it into nagios, and you're away! 现在,您只需要一个脚本来获取当前队列(第6列)并将其输入nagios,您就可以离开了!

New Relic's RPM product (www.newrelic.com) maintains information on Mongrel queue length. New Relic的RPM产品(www.newrelic.com)维护有关Mongrel队列长度的信息。 They have an API that you may be able to use to get near real-time feedback on queue length and adjust load balancing accordingly. 它们具有一个API,您可以使用它来获取有关队列长度的近乎实时的反馈并相应地调整负载平衡。

You can get more information on the API at: https://newrelic.tenderapp.com/faqs/docs/data-api 您可以通过以下网址获取有关API的更多信息: https : //newrelic.tenderapp.com/faqs/docs/data-api

Hopefully that provides some help. 希望能提供一些帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM