New Munin-plugin for HAProxy

I committed a new Munin-plugin for HAProxy. It’s a multigraph plugin, it discovers all the configured frontends and backends automatically – all you need to provide is the username/password for the haproxy status page.

It produces 8 graphs, + subgraphs for some of the backends, where it presents the same graphs, but with server-specific metrics.

Some of the root-graphs:









Do you use HAProxy and Munin? Check it out!

20 thoughts on “New Munin-plugin for HAProxy”

  1. When I do munin-run haproxy_ng, it shows values and stuff, but when munin runs its cron, graphs do not update – they stay with ‘nan’.
    I’ve checked permissions and they are fine.

      1. I’ve sorted that out.
        Editor joe and it’s autoindent and line wrap messed up the source code of plugin. After downloading the plugin with wget – graphs are drawn OK.

  2. Great plugin,
    Sorry I am new in munin, buy when i try to configure it I got this error:

    2012/05/17-21:59:00 [17147] Error output from haproxy_ng:
    2012/05/17-21:59:00 [17147] Can’t exec “/etc/munin/plugins/haproxy_ng”: No such file or directory at /usr/share/perl5/Munin/Node/Service.pm line 215.
    2012/05/17-21:59:00 [17147] # ERROR: Failed to exec.

    Thank you.

    1. Sounds like it’s a symlink pointing to nothing. Make sure to copy the plugin in and make it executable.

      If you still have problems, asking politely on irc, #munin on freenode or oftc will often give you the help needed.

    2. I have same issue, but symlink is there and it is excutable. When try cat that path it seams fine. What might be the problem?

      Can’t exec “/etc/munin/plugins/haproxy_ng”: No such file or directory at /usr/share/perl5/Munin/Node/Service.pm line 215.

    3. You, like me, probably downloaded the file directly.
      You need to replace the @@PERL@@ on the first line of the file with the output of the command `which perl`

  3. I am a munin newbie, so maybe I am missing something basic. I installed and configured the plugin, and html pages for HAProxy get generated, but no images get generated (they are all broken links).

    When I run the plugin, this is what I see:

    # sudo -u munin munin-run haproxy_ng
    multigraph HAPActive

    multigraph HAPBandwidthBack

    multigraph HAPBandwidthFront

    multigraph HAPErrorsBack

    multigraph HAPErrorsFront

    multigraph HAPSessionsBack

    multigraph HAPSessionsFront

    multigraph HAPUptime

    How can I debug this problem and figure out why the images aren’t being generated?

    Thanks,
    Jeff

    1. Nevermind, I figured it out. I had labeled the section in my /etc/munin/plugin-conf.d/munin-node file [haproxy] instead of [haproxy_ng]. It’s working now. Thanks for writing this plugin!

        1. Actually, the example at the top of the plugin source code says to use [haproxy_backend]. Is that correct? It seems to be working for me with [haproxy_ng]…

          1. It needs to be consistent with the plugin-name in /etc/munin/plugins, so you’ve spotted an error in the example there.

            [haproxy_ng] or [haproxy_*], etc. will work.

            I will fix the doc-error; Thanks again :)

  4. Thanks for a great plugin.
    Need to use this plugin for multiple instances on same server. Configured as below;

    [haproxy_client1_backend]
    env.url http://client1.example.com/haproxy-status;csv;norefresh
    env.username monitor
    env.password somepasswordorother

    [haproxy_client2_backend]
    env.url http://client2.example.com/haproxy-status;csv;norefresh
    env.username monitor
    env.password somepasswordorother

    Got few graphs working, but not all. And those I can see only after clicking headers, not on main pages. Most importantly frontend graphs for both instances not shown. It shows only one graph of the client1 which is 1st alphabetically.

    Can you please help me with your plugin to configure it for multiple instances.

    Thanks in Advance.
    Gourav

    1. The plugin isn’t written to split up different instances of itself like this. You can achieve this by using host_name in the config, and creating different sets of hosts in your munin overview.

      Or, the plugin needs to be patched. Which would probably be a bit of work, and not something I would be able to do anytime soon I’m afraid.

  5. Works great. Only minor hiccup I had was that the plugin choked on an listen/frontend/backend names containing a period. Replaced them all with dashes instead, working great!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>