Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm beginning to use Munin to monitor an in-production Nginx server. One thing I'm particularly interested in graphing is the rate of errors--HTTP responses with codes in the 50x range. I'm wondering if:

  1. Is there an existing plugin to do this?
  2. Alternately, what would be the best approach to writing my own plugin. Access log parsing?
share|improve this question

Well, no such animal existed, so I conjured it.

You'll find the latest code in the gist. Enjoy.

share|improve this answer

I am not aware of any out-of-box OSS solutions. I personally wrote this kind of plugin, but cannot share the code. It's two stage:

  1. Log parser to collect fresh statistics (like tail -f). Since you can define Nginx log format, you are free to log the values you want, e.g. status code, upstream request time, etc.
  2. Munin plugin to report the statistics to Munin.

You will have to share the state between these two parts. There is a handful of choices: in memory (my implementation of log parser was event-driven daemon storing all the statistics in memory); MongoDB; Redis; traditionaly MySQL; shared memory; etc.

share|improve this answer

So this link is to the nginx plugins in the munin repository. Can't find anything obvious to do what you want, or anything on the web after a (very brief) search.

I wrote a couple of munin plugins and they're not that hard. You should be able to write one to achieve what you want. I would just count the number of 50x errors in the current log and return that as a type DERIVE with a minimum of 0. That way you can just return a single value, and let rrdtool work out if it has increased. Note - this will be an issue if at the end of one day you have say 130 50x errors, and the log gets rotated and you get 131 errors straight away, the graph will think that's a value of 1.

The other option would be to track the count yourself against the log file name and return the actual increase, and reset it when the log rotates.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.