Plone技术资料

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 3567|回复: 0

监控和监控工具

[复制链接]
发表于 2012-10-10 15:13:06 | 显示全部楼层 |阅读模式
The first thing you should do when setting up your system is spend some time setting up monitoring tools. How can you make quantitative changes if you aren't measuring? Here is an overview of tools that have worked well for people and what they do.

System Monitoring
  • Munin is simply an amazing tool, whether you have 1 machine or 10000. It measures system statistics over time and will help you grasp the concept of what a "normal" system state is. It also allows custom plugins, and the plone community has already responded to that with things like munin.zope and there is also one for zope thread watcher called ZopeHealthWatcher. Ganglia is a similar package that offers much of the same functionality. Others?
  • Monit and munin are best friends. Monit does the same thing as munin when it comes to monitoring except that it doesn't collect data over time, and if something looks fishy it takes corrective action.  What kind of action you say? Anything you ask it too! You can email alerts, automatically restart downed processes, monitor disk space, run bash script and the list goes on. How many times have you forgotten to rotate logs and run out of disk space? Monit could have told you weeks befre that happened.  What about zope using too much memory? No problem, just have monit restart zope when it reaches a certain percentage (you can get some sweet performance this way). I put some examples here, but please don't copy them word for word - they are just for ideas! Similar products include nagios and supervisor, but most people will agree that monit will win your heart here.
  • Zope Health Watcher is perfect for finding out exactly which pages are taking a super long time (i.e. did an addIndex operation tie up your zope for all eternity?). It's simple in that it just lets you know at any time, which threads are rendering which requests. You'll be surprised how useful this can be.
  • Just found out about this gem that monitors the length of requests in zope 2.12+ and the top like functionality that goes with it. Haven't tried it but it looks hot hot hot!
  • Zenoss includes a lot of the features of munin and monit, and includes a bunch of network monitoring too. Again I  have not tried it but if there are opinions out there feel free to share.

Error MonitoringIf you want to be hardcore, you can write sweet scripts that pipe through all of your logs and crunch them down to statistics or maybe put them in databases. That's great, but for everyone else try these tips:
  • Install PloneErrorMonitoring and/or customize your error pages to be, you know, useful.
  • Put Google Analytics javascript tracking on any 4xx and 5xx page renders. Then, you can just log onto your analytics account and see where bad links are, where things timed out, etc... I don't recommend this on every page since it has the potential to slow down your final render time by up to a second.
  • Soup up the logging module to send emails (or do something else) when an error is triggered. Check out the maillinglogger package for quick and easy setup. For those that want to roll their own: there are things to consider. You really need to think when you are coding, is this really an error worthy of ending up in my inbox? If not, downgrade that message to warning. The goal is to have a system so stable you get as few emails as possible, and it is possible! Also remember that sending an email is by no means free. If your system is hitting the crapper and triggers 1000 emails per minute, not only is your email admin going to kill you, but the system is going to double over on itself. Buffering in memory help ease that pain by chunking those emails so you know whats wrong, just not * 1000. The downside to this is that important errors may not get to you until either the buffer is filled or you have a restart. In my experience though, most really important errors come in 100's, if not 1000's. If you keep this code nice and clean, you can use this in all of your packages, not just zope and plone.
  • If you don't want to get into the code to filter through the logs, checkout Arecibo and the plone buildout plugin, which we believe has not been moved to Andy's Github space at:  https://github.com/andymckay/arecibo.

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|Plone技术资料 ( 湘ICP备14006519号-1 )

GMT+8, 2019-11-23 04:12 , Processed in 0.046637 second(s), 17 queries , Gzip On.

Powered by Plone! X3.4

© 2001-2019 Plone.org.

快速回复 返回顶部 返回列表