munin icon indicating copy to clipboard operation
munin copied to clipboard

Varnish memory graphs are blank

Open rwky opened this issue 4 years ago • 2 comments

Describe the bug

The graphs for memory using the varnish_ plugin are empty.

To Reproduce Steps to reproduce the behavior:

  1. Install varnish via apt on Ubuntu 18.04
  2. Download the varnish_ plugin from the munin master repo (the one packed with Ubuntu throws compilation errors)
  3. Enable the plugin using suggest
  4. Observe the graphs

Expected behavior

The graph data is created.

Software OS Ubuntu 18.04 Munin 2.037 Varnish 5.2.1

Additional context This appears to be something to do with the print_dynamic subroutine in the plugin. I've created a Work In Progress PR here https://github.com/munin-monitoring/munin/pull/1320 this semi-fixes it, it allows the values to show in the graph but they're not showing the correct numbers. This is stretching my Perl skills a bit so if someone else could have a look and see if we can get this sorted I'd appreciate it. For now as a work around I've made a simple bash script to grab the stats I need.

rwky avatar May 01 '20 14:05 rwky

This is also an issue for me running Debian 10.

In Debian 10 the versions are a bit different:

root@mail:/etc/munin# cat /etc/issue
Debian GNU/Linux 10 \n \l

root@mail:/etc/munin# uname -a
Linux mail 4.19.0-8-amd64 #1 SMP Debian 4.19.98-1 (2020-01-26) x86_64 GNU/Linux
root@mail:/etc/munin# dpkg -l | grep -E 'munin|varnish'
ii  libvarnishapi2:amd64            6.1.1-1+deb10u1               amd64        shared libraries for Varnish
ii  munin                           2.0.49-1                      all          network-wide graphing framework (grapher/gatherer)
ii  munin-common                    2.0.49-1                      all          network-wide graphing framework (common)
ii  munin-node                      2.0.49-1                      all          network-wide graphing framework (node)
ii  munin-plugins-core              2.0.49-1                      all          network-wide graphing framework (plugins for node)
ii  munin-plugins-extra             2.0.49-1                      all          network-wide graphing framework (user contributed plugins for node)
ii  varnish                         6.1.1-1+deb10u1               amd64        state of the art, high-performance web accelerator
root@mail:/etc/munin# varnishd -V
varnishd (varnish-6.1.1 revision efc2f6c1536cf2272e471f5cff5f145239b19460)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2015 Varnish Software AS
root@mail:/etc/munin# munin-node -V | head -n2 | tail -n1
    This is munin-node v2.0.49
root@mail:/etc/munin# 

This is with the default install of munin, munin-common, munin-plugins-core, and munin-plugins-extra. After install, the varnish plugins are enabled like so:

root@mail:/etc/munin/plugins# munin-run varnish_ suggest
backend_traffic
transfer_rates
objects
hit_rate
uptime
bad
memory_usage
request_rate
threads
expunge
root@mail:/etc/munin/plugins#  ln -s /usr/share/munin/plugins/varnish_ /etc/munin/plugins/varnish_uptime
root@mail:/etc/munin/plugins#  

And to prevent an error Could not get hold of varnishd, is it running?, I've added the following munin plugin config:

[varnish*]
user root

Now munin-run produces this:

root@mail:/etc/munin# munin-run --debug --pidebug  varnish_uptime
# Processing plugin configuration from /etc/munin/plugin-conf.d/README
# Processing plugin configuration from /etc/munin/plugin-conf.d/dhcpd3
# Processing plugin configuration from /etc/munin/plugin-conf.d/munin-node
# Processing plugin configuration from /etc/munin/plugin-conf.d/spamstats
# Processing plugin configuration from /etc/munin/plugin-conf.d/zzz-myconf
# Setting /rgid/ruid/ to /118/0/
# Setting /egid/euid/ to /118 118/0/
# Setting up environment
# About to run '/etc/munin/plugins/varnish_uptime'
Error: uptime not part of varnishstat.
root@mail:/etc/munin# 

And here's a quick grep of varnishstat -x fwiw:

root@mail:/etc/munin# varnishstat -x | grep -i uptime
                <name>MGT.uptime</name>
                <description>Management process uptime</description>
                <name>MAIN.uptime</name>
                <description>Child process uptime</description>
root@mail:/etc/munin# varnishstat -x | grep -iC4 uptime
<?xml version="1.0"?>
<varnishstat timestamp="2020-05-05T10:23:41">
        <stat>
                <name>MGT.uptime</name>
                <value>163501</value>
                <flag>c</flag>
                <format>d</format>
                <description>Management process uptime</description>
        </stat>
        <stat>
                <name>MGT.child_start</name>
                <value>1</value>
--
                <format>i</format>
                <description>stat summ operations</description>
        </stat>
        <stat>
                <name>MAIN.uptime</name>
                <value>163502</value>
                <flag>c</flag>
                <format>d</format>
                <description>Child process uptime</description>
        </stat>
        <stat>
                <name>MAIN.sess_conn</name>
                <value>13</value>
root@mail:/etc/munin# 

Did something change in the XML format? Why can't the varnish_uptime munin plugin get the values?

@rwky What is the output of your munin-run varnish_uptime so I know if these issues are related?

maltfield avatar May 05 '20 10:05 maltfield

This is the bundled plugin output

munin-run varnish_uptime 
Global symbol "$type" requires explicit package name (did you forget to declare "my $type"?) at /etc/munin/plugins/varnish_uptime line 897.
Global symbol "$type" requires explicit package name (did you forget to declare "my $type"?) at /etc/munin/plugins/varnish_uptime line 897.
Global symbol "$type" requires explicit package name (did you forget to declare "my $type"?) at /etc/munin/plugins/varnish_uptime line 898.
Global symbol "$name" requires explicit package name (did you forget to declare "my $name"?) at /etc/munin/plugins/varnish_uptime line 898.
Global symbol "$name" requires explicit package name (did you forget to declare "my $name"?) at /etc/munin/plugins/varnish_uptime line 900.
Bareword "set_aspect" not allowed while "strict subs" in use at /etc/munin/plugins/varnish_uptime line 1103.
Bareword "check_args" not allowed while "strict subs" in use at /etc/munin/plugins/varnish_uptime line 1104.
Bareword "populate_stats" not allowed while "strict subs" in use at /etc/munin/plugins/varnish_uptime line 1105.
Execution of /etc/munin/plugins/varnish_uptime aborted due to compilation errors.

Using the plugin from master

munin-run varnish_uptime 
uptime.value 320730

So the master plugin works fine for uptime.

Seems my issue is different to yours (but maybe related who knows!)

rwky avatar May 05 '20 10:05 rwky

For anyone who has this issue on Debian, see also:

  • https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=959812

The solution is to replace the contents of '/usr/share/munin/plugins/varnish_' with the source code found here:

  • https://github.com/munin-monitoring/contrib/blob/master/plugins/varnish/varnish5_
  • https://gallery.munin-monitoring.org/plugins/munin-contrib/varnish5_/

maltfield avatar Apr 18 '24 16:04 maltfield