How to alert in Seyren with Graphite if transactions in last 60 minutes are less than x?

本小妞迷上赌 提交于 2019-12-04 04:52:26

I contributed the Seyren code to support from/until in order to handle this exact situation.

The following configuration should raise a warning if the count for the last hour drops below 50, and an error if it drops below 25.

  • Target: summarize(nonNegativeDerivative(stats.transactions.count),"1h","sum",true)
  • From: -1h
  • To: [blank]
  • Warn: 50 (soft minimum)
  • Error: 25 (hard minimum)

Note this will run every minute, so the "last hour" is a sliding scale. Also note that the third boolean parameter true for the summarize function is telling it to align its 1h bucket to the From, meaning you get a full 1-hour bucket starting 1 hour ago, rather than accidentally getting a half bucket. (Newer versions of Graphite may do this automatically.)

Your mileage may vary. I have had problems with this approach when the counter gets set back to 0 on a server restart. But in my case I'm using dropwizard metrics + graphite, not statsd + graphite, so you may not have that problem.

Please let me know if this approach works for you!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!