Graphing PHP errors with Munin

At work we use Munin as a monitoring tool. Recently I added graphs containing the amount of PHP errors on our servers. The plugin I used is called loggrep and I used the following configuration for it:

[loggrep*]
user root

env.regex PHP
env.label All PHP errors

env.regex_notices PHP Notice
env.label_notices Notices

env.regex_warnings PHP Warning
env.label_warnings Warnings

env.regex_fatal PHP Fatal
env.label_fatal Fatal errors

env.regex_deprecated PHP Deprecated
env.label_deprecated Deprecated

[loggrep_www]
env.logfile /var/log/httpd/www.vg.no-error.log
env.title PHP errors on www.vg.no

The snippet above is placed in the /etc/munin/plugin-conf.d/loggrep configuration file. In the /etc/munin/plugins directory I put a symbolic link to the loggrep plugin called loggrep_www. This way we can easily have graphs grouped by the different virtual hosts we have on our servers. If we have a host called foo.vg.no and would like a graph of PHP errors on that host I would simply add a section for it in the configuration file that would look like this:

[loggrep_foo]
env.logfile /var/log/httpd/foo.vg.no-error.log
env.title PHP errors on foo.vg.no

and create a symbolic link called loggrep_foo in the /etc/munin/plugins directory that points to the loggrep plugin.

Here is what the graph looks like:

Graph of PHP errors

PHP errors on http://www.vg.no

Advertisements
This entry was posted in PHP, Technology, Work related and tagged , , , . Bookmark the permalink.

4 Responses to Graphing PHP errors with Munin

  1. mvaled says:

    Would you consider contributing the plugin?

  2. Christoph says:

    With this configuration the loggrep plugin is not listed using
    (echo “list”; sleep 1) | telnet MYHOST 4949

    When I remove the env. in each line of the config, it is listed but then
    munin-run loggrep_MYHOST
    complains.

  3. Pingback: Munin loggrep plugin not listed, fixed. | Marcus Povey

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s