contrib
contrib copied to clipboard
Add varnish5_ plugin
Resolves #876. In Varnish 5.2 some fields were merged in the XML output, breaking the varnish4_ plugin. This plugin takes these changes into account.
Thank you for taking the time to prepare the updated plugin!
I just noticed, that there is also a vagrant plugin in the "munin" repository (distributed as part of each munin release). We should probably focus on that plugin.
I am about to merge all missing fields from the varnish4_ plugin (here in this "munin-contrib" repository) to the varnish_ plugin in the "munin" repository.
Since you assembled the varnish5_ plugin and probably tested it against a varnish server (I do not have one around), you may be able to help me with a detail.
You changed the handling of the name field (compared to the original varnish4_ plugin).
Here your code seems to indicate, that the following contents of name are to be expected:
type.nametype.ident.name
After taking a look at the related varnish issue and the related varnish code change , it looks like only type.name (not type.ident.name) would be possible.
In this case (with ident always being undefined), the following condition would never become true:
if (defined($type) and $type ne '' and defined($ident) and $ident ne '') {
$data{$type}{$ident}{$name}{$key} = $data;
What do you think?
Originally there were always type and name fields in the XML output. Depending on the counter there was also an ident field, which could also contain a dot.
For example, a snippet from varnish-5.1.3:
<?xml version="1.0"?>
<varnishstat timestamp="2018-02-26T08:24:39">
...
<stat>
<type>MAIN</type>
<name>sess_conn</name>
<value>0</value>
<flag>c</flag>
<format>i</format>
<description>Sessions accepted</description>
</stat>
<stat>
<type>MEMPOOL</type>
<ident>sess0</ident>
<name>pool</name>
<value>10</value>
<flag>g</flag>
<format>i</format>
<description>In Pool</description>
</stat>
<stat>
<type>VBE</type>
<ident>boot.default</ident>
<name>req</name>
<value>0</value>
<flag>c</flag>
<format>i</format>
<description>Backend requests sent</description>
</stat>
...
</varnishstat>
In the current version there is only the name field which always contains type and name (type.name) and optionally ident (type.ident.name).
Snippet from varnish-5.2.1:
<?xml version="1.0"?>
<varnishstat timestamp="2018-02-26T08:29:12">
...
<stat>
<name>MAIN.sess_conn</name>
<value>0</value>
<flag>c</flag>
<format>i</format>
<description>Sessions accepted</description>
</stat>
<stat>
<name>MEMPOOL.sess0.pool</name>
<value>10</value>
<flag>g</flag>
<format>i</format>
<description>In Pool</description>
</stat>
<stat>
<name>VBE.boot.default.req</name>
<value>0</value>
<flag>c</flag>
<format>i</format>
<description>Backend requests sent</description>
</stat>
...
</varnishstat>
The counters managed by varnish are listed in the documentation.
varnishstat -l prints a complete list, with the ident fields included:
Varnishstat -f option fields:
Field name Description
---------- -----------
MGT.uptime Management process uptime
MGT.child_start Child process started
MGT.child_exit Child process normal exit
...
MAIN.summs stat summ operations
MAIN.uptime Child process uptime
MAIN.sess_conn Sessions accepted
...
LCK.backend.creat Created locks
LCK.backend.destroy Destroyed locks
LCK.backend.locks Lock Operations
...
MEMPOOL.sess0.live In use
MEMPOOL.sess0.pool In Pool
MEMPOOL.sess0.sz_wanted Size requested
...
SMA.s0.c_req Allocator requests
SMA.s0.c_fail Allocator failures
SMA.s0.c_bytes Bytes allocated
...
VBE.boot.default.pipe_in Piped bytes from backend
VBE.boot.default.conn Concurrent connections to backend
VBE.boot.default.req Backend requests sent
The condition you mentioned would indeed never become true, if it weren't for this line, where ident is set, if found in the name field.
So i'm guessing that in the source code you linked the ident field is already concatenated.
Stale pull request message
Done in #1131.