author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-04-27 11:26:04 (GMT) |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-04-27 12:02:18 (GMT) |
commit | 94973146c58df26b20e17e2e5b1274216ca88969 (patch) (unidiff) | |
tree | 17538cc2991af0acec5bebfe6a826ef67cd9fc95 | |
parent | 319c154c46214fdc5d8f8b498ae5a23bc8d03072 (diff) | |
download | varnish-mib-94973146c58df26b20e17e2e5b1274216ca88969.tar.gz varnish-mib-94973146c58df26b20e17e2e5b1274216ca88969.tar.bz2 |
Support for Varnish 4.1
* NEWS: Update.
* bootstrap: Rewrite as a Perl script; create m4/varnish_mib.m4
from src/varnish_mib.mib2c
* configure.ac: Version 1.1.90
Use AC_CHECK_VSC_C_MAIN_MEMBERS
Define VARNISHAPI_MAJOR, VARNISHAPI_MINOR and
VARNISHAPI_PATCH for use in preprocessor directives.
* src/betab.c [VARNISHAPI_MINOR] (VSC_POINT_FMT): Define
depending on Varnish API minor version.
* src/varnish_mib.mib2c (varnish_translate_table): New variable.
It is used both by varnish_translate in this module, and by
bootstrap to produce a list of macros checking for members of
struct VSC_C_main.
Output preprocessor conditionals in right places.
* src/vcli.c (vcli_connect): Fix cc warnings.
* src/varnish-mib.8: Update.
-rw-r--r-- | NEWS | 11 | ||||
-rwxr-xr-x | bootstrap | 84 | ||||
-rw-r--r-- | configure.ac | 20 | ||||
-rw-r--r-- | src/betab.c | 8 | ||||
-rw-r--r-- | src/varnish-mib.8 | 40 | ||||
-rw-r--r-- | src/varnish_mib.mib2c | 39 | ||||
-rw-r--r-- | src/vcli.c | 4 |
7 files changed, 172 insertions, 34 deletions
@@ -1,9 +1,14 @@ | |||
1 | Varnish-mib NEWS -- history of user-visible changes. 2015-02-25 | 1 | Varnish-mib NEWS -- history of user-visible changes. 2016-04-27 |
2 | Copyright (C) 2014-2015 Sergey Poznyakoff | 2 | Copyright (C) 2014-2016 Sergey Poznyakoff |
3 | See the end of file for copying conditions. | 3 | See the end of file for copying conditions. |
4 | 4 | ||
5 | Please send Varnish-mib bug reports to <gray@gnu.org> | 5 | Please send Varnish-mib bug reports to <gray@gnu.org> |
6 | 6 | ||
7 | Version 1.1.90 (Git) | ||
8 | |||
9 | * Support for Varnish 4.1 | ||
10 | |||
11 | |||
7 | Version 1.1, 2015-02-25 | 12 | Version 1.1, 2015-02-25 |
8 | 13 | ||
9 | * Don't exit if unable to open Varnish memory file | 14 | * Don't exit if unable to open Varnish memory file |
@@ -16,7 +21,7 @@ Initial release. | |||
16 | 21 | ||
17 | * Copyright information: | 22 | * Copyright information: |
18 | 23 | ||
19 | Copyright (C) 2014-2015 Sergey Poznyakoff | 24 | Copyright (C) 2014-2016 Sergey Poznyakoff |
20 | 25 | ||
21 | Permission is granted to anyone to make or distribute verbatim copies | 26 | Permission is granted to anyone to make or distribute verbatim copies |
22 | of this document as received, in any medium, provided that the | 27 | of this document as received, in any medium, provided that the |
@@ -1,7 +1,77 @@ | |||
1 | #!/bin/sh | 1 | #!/usr/bin/perl |
2 | for dir in m4 build-aux | 2 | use strict; |
3 | do | 3 | use autodie; |
4 | test -d $dir || mkdir $dir | 4 | |
5 | done | 5 | my $mib2c_config = 'src/varnish_mib.mib2c'; |
6 | > ChangeLog | 6 | |
7 | autoreconf -f -i -s | 7 | die "This file must be run from the varnish-mib top level source directory" |
8 | unless -r $mib2c_config; | ||
9 | |||
10 | print "$0: creating ancillary directories and files\n"; | ||
11 | foreach my $dir ('m4', 'build-aux') { | ||
12 | mkdir($dir) unless -d $dir; | ||
13 | } | ||
14 | |||
15 | unless (-f 'ChangeLog') { | ||
16 | open(my $fd, '>', 'ChangeLog'); | ||
17 | print $fd <<EOT | ||
18 | This file is a placeholder. It will be filled with actual data by the first | ||
19 | run of make. | ||
20 | EOT | ||
21 | ; | ||
22 | close $fd; | ||
23 | } | ||
24 | |||
25 | print "$0: generating m4/varnish_mib.m4\n"; | ||
26 | open(my $fd, '<', $mib2c_config); | ||
27 | my $prog; | ||
28 | while (<$fd>) { | ||
29 | if (defined($prog)) { | ||
30 | last if /^\@endperl\@/; | ||
31 | $prog .= $_; | ||
32 | } else { | ||
33 | if (/^\@startperl\@/) { | ||
34 | $prog = "no strict \"vars\";\n"; | ||
35 | } | ||
36 | } | ||
37 | } | ||
38 | |||
39 | my %vars; | ||
40 | eval $prog; | ||
41 | die $@ if $@; | ||
42 | die "$mib2c_config does not declare translation table" | ||
43 | unless exists $vars{'varnish_translate_table'}; | ||
44 | |||
45 | open(my $fd, '>', 'm4/varnish_mib.m4'); | ||
46 | print $fd <<'EOT'; | ||
47 | AC_DEFUN([AC_CHECK_VSC_C_MAIN_MEMBERS], | ||
48 | [save_CFLAGS="$CFLAGS" | ||
49 | CFLAGS="$CFLAGS $VARNISHAPI_CFLAGS" | ||
50 | EOT | ||
51 | ; | ||
52 | |||
53 | foreach my $member (sort | ||
54 | map { $_->[1] } | ||
55 | grep { $_->[0] eq 'MAIN' } | ||
56 | values %{$vars{'varnish_translate_table'}}) { | ||
57 | print $fd <<EOT | ||
58 | AC_CHECK_MEMBERS([struct VSC_C_main.$member],,, | ||
59 | [#include <stddef.h> | ||
60 | #include <stdlib.h> | ||
61 | #include <stdint.h> | ||
62 | #include <limits.h> | ||
63 | #include <vapi/vsc.h> | ||
64 | #include <vapi/vsm.h> | ||
65 | #include <vcli.h>]) | ||
66 | EOT | ||
67 | ; | ||
68 | } | ||
69 | print $fd <<'EOT' | ||
70 | CFLAGS="$save_CFLAGS" | ||
71 | ]) | ||
72 | EOT | ||
73 | ; | ||
74 | close $fd; | ||
75 | |||
76 | print "$0: reconfiguring\n"; | ||
77 | exec('autoreconf -f -i -s'); | ||
diff --git a/configure.ac b/configure.ac index d571518..cf0bf05 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1,5 +1,5 @@ | |||
1 | # This file is part of Varnish-mib -*- autoconf -*- | 1 | # This file is part of Varnish-mib -*- autoconf -*- |
2 | # Copyright (C) 2014-2015 Sergey Poznyakoff | 2 | # Copyright (C) 2014-2016 Sergey Poznyakoff |
3 | # | 3 | # |
4 | # Varnish-mib is free software; you can redistribute it and/or modify | 4 | # Varnish-mib is free software; you can redistribute it and/or modify |
5 | # it under the terms of the GNU General Public License as published by | 5 | # it under the terms of the GNU General Public License as published by |
@@ -15,7 +15,7 @@ | |||
15 | # along with Varnish-mib. If not, see <http://www.gnu.org/licenses/>. | 15 | # along with Varnish-mib. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | ||
17 | AC_PREREQ(2.69) | 17 | AC_PREREQ(2.69) |
18 | AC_INIT([varnish-mib], 1.1, [gray@gnu.org]) | 18 | AC_INIT([varnish-mib], 1.1.90, [gray@gnu.org]) |
19 | AC_CONFIG_SRCDIR(src/varnish_mib.mib2c) | 19 | AC_CONFIG_SRCDIR(src/varnish_mib.mib2c) |
20 | AM_CONFIG_HEADER(config.h) | 20 | AM_CONFIG_HEADER(config.h) |
21 | AC_CONFIG_AUX_DIR([build-aux]) | 21 | AC_CONFIG_AUX_DIR([build-aux]) |
@@ -43,6 +43,22 @@ PKG_PROG_PKG_CONFIG | |||
43 | # Checks for Varnish | 43 | # Checks for Varnish |
44 | PKG_CHECK_MODULES([VARNISHAPI], [varnishapi >= 4.0]) | 44 | PKG_CHECK_MODULES([VARNISHAPI], [varnishapi >= 4.0]) |
45 | 45 | ||
46 | varnishapi_version() { | ||
47 | AC_DEFINE_UNQUOTED([VARNISHAPI_MAJOR],[$1],[Varnish API major version number]) | ||
48 | AC_DEFINE_UNQUOTED([VARNISHAPI_MINOR],[$2],[Varnish API minor version number]) | ||
49 | AC_DEFINE_UNQUOTED([VARNISHAPI_PATCH],[$3],[Varnish API patchlevel]) | ||
50 | } | ||
51 | |||
52 | v=$($PKG_CONFIG --modversion varnishapi) | ||
53 | if test -n "$v"; then | ||
54 | save_IFS=$IFS | ||
55 | IFS='.' | ||
56 | varnishapi_version $v | ||
57 | IFS=$save_IFS | ||
58 | fi | ||
59 | |||
60 | AC_CHECK_VSC_C_MAIN_MEMBERS | ||
61 | |||
46 | # Check for Net-SNMP | 62 | # Check for Net-SNMP |
47 | AC_PATH_PROG([NET_SNMP_CONFIG], net-snmp-config, none, $PATH) | 63 | AC_PATH_PROG([NET_SNMP_CONFIG], net-snmp-config, none, $PATH) |
48 | if test "$NET_SNMP_CONFIG" = "none"; then | 64 | if test "$NET_SNMP_CONFIG" = "none"; then |
diff --git a/src/betab.c b/src/betab.c index b583958..49e02f7 100644 --- a/src/betab.c +++ b/src/betab.c | |||
@@ -59,7 +59,13 @@ create_entry(netsnmp_tdata *table_data, long idx, | |||
59 | #define VSC_POINT_TYPE(p) ((p)->section->fantom->type) | 59 | #define VSC_POINT_TYPE(p) ((p)->section->fantom->type) |
60 | #define VSC_POINT_IDENT(p) ((p)->section->fantom->ident) | 60 | #define VSC_POINT_IDENT(p) ((p)->section->fantom->ident) |
61 | #define VSC_POINT_NAME(p) ((p)->desc->name) | 61 | #define VSC_POINT_NAME(p) ((p)->desc->name) |
62 | #define VSC_POINT_FMT(p) ((p)->desc->fmt) | 62 | #if VARNISHAPI_MINOR == 0 |
63 | # define VSC_POINT_FMT(p) ((p)->desc->fmt) | ||
64 | #elif VARNISHAPI_MINOR == 1 | ||
65 | # define VSC_POINT_FMT(p) ((p)->desc->ctype) | ||
66 | #else | ||
67 | # error "unsupported Varnish API minor number" | ||
68 | #endif | ||
63 | 69 | ||
64 | struct betab_priv { | 70 | struct betab_priv { |
65 | int err; | 71 | int err; |
diff --git a/src/varnish-mib.8 b/src/varnish-mib.8 index 4559b0c..0c54e6f 100644 --- a/src/varnish-mib.8 +++ b/src/varnish-mib.8 | |||
@@ -1,5 +1,5 @@ | |||
1 | .\" This file is part of Varnish-mib -*- nroff -*- | 1 | .\" This file is part of Varnish-mib -*- nroff -*- |
2 | .\" Copyright (C) 2014-2015 Sergey Poznyakoff | 2 | .\" Copyright (C) 2014-2016 Sergey Poznyakoff |
3 | .\" | 3 | .\" |
4 | .\" Varnish-mib is free software; you can redistribute it and/or modify | 4 | .\" Varnish-mib is free software; you can redistribute it and/or modify |
5 | .\" it under the terms of the GNU General Public License as published by | 5 | .\" it under the terms of the GNU General Public License as published by |
@@ -13,7 +13,7 @@ | |||
13 | .\" | 13 | .\" |
14 | .\" You should have received a copy of the GNU General Public License | 14 | .\" You should have received a copy of the GNU General Public License |
15 | .\" along with Varnish-mib. If not, see <http://www.gnu.org/licenses/>. | 15 | .\" along with Varnish-mib. If not, see <http://www.gnu.org/licenses/>. |
16 | .TH VARNISH-MIB 8 "November 28, 2014" "varnish-mib" | 16 | .TH VARNISH-MIB 8 "April 27, 2016" "varnish-mib" |
17 | .SH NAME | 17 | .SH NAME |
18 | varnish\-mib \- net-snmp module for obtaining Varnish Cache statistics | 18 | varnish\-mib \- net-snmp module for obtaining Varnish Cache statistics |
19 | .SH SYNOPSIS | 19 | .SH SYNOPSIS |
@@ -27,15 +27,24 @@ that provides access to Varnish Cache statistics. The module is | |||
27 | loaded into | 27 | loaded into |
28 | .BR snmpd (8) | 28 | .BR snmpd (8) |
29 | as shown above (actual path can of course differ, depending on how | 29 | as shown above (actual path can of course differ, depending on how |
30 | the package was configured). | 30 | the package was configured). Varnish version \fB4.0\fR and \fB4.1\fR |
31 | are supported. | ||
32 | .PP | ||
33 | When using with \fBVarnish\fR version \fB4.1\fR, make sure the | ||
34 | \fB_.vsm\fR file is readable for \fBsnmpd\fR. This file is normally | ||
35 | located in \fB/var/lib/varnish/\fIHOSTNAME\fR and has mode \fB640\fR. | ||
36 | Its owner is determined by the \fB\-j\fR (\fB\-\-jail\fR) | ||
37 | \fBvarnishd\fR option. There are two ways to ensure it is readable: | ||
38 | either make sure \fBsnmpd\fR and \fBvarnishd\fR run with the same user | ||
39 | group, or use \fBsetfacl\fR(1) to tune access to that file. | ||
31 | .PP | 40 | .PP |
32 | The module obtains most of the data using Varnish API. Information | 41 | The module obtains most of the data using Varnish API. Information |
33 | about available bans (\fBbanTable\fR subtree) as well as the mechanism | 42 | about available bans (\fBbanTable\fR subtree) as well as the mechanism |
34 | for setting bans (\fBclientBan\fR OID) are implemented via \fBvarnishd\fR | 43 | for setting bans (\fBclientBan\fR OID) are implemented via \fBvarnishd\fR |
35 | administrative interface. For these to work, the module must have | 44 | administrative interface. For these to work, the module must have |
36 | read access to Varnish secret file. In other words, the secret file | 45 | read access to Varnish secret file. In other words, the secret file |
37 | must be readable either by the user \fBsnmpd\fR runs as, or by one | 46 | must be readable either by the user \fBsnmpd\fR runs as, or by its |
38 | of this user's groups. | 47 | group. |
39 | .SH CONFIGURATION OPTIONS | 48 | .SH CONFIGURATION OPTIONS |
40 | Configuration statements specific to | 49 | Configuration statements specific to |
41 | .B varnish\-mib | 50 | .B varnish\-mib |
@@ -93,6 +102,17 @@ passes the request to the backend and this decision itself has been cached. | |||
93 | Number of misses. A cache miss indicates the object was fetched from | 102 | Number of misses. A cache miss indicates the object was fetched from |
94 | the backend before delivering it to the client. | 103 | the backend before delivering it to the client. |
95 | .TP | 104 | .TP |
105 | .B clientRequests400 | ||
106 | Client requests received, subject to 400 errors. | ||
107 | .TP | ||
108 | .B clientRequests411 | ||
109 | Client requests received, subject to 411 errors. This variable is | ||
110 | available only in Varnish version \fR4.0\fR. | ||
111 | .TP | ||
112 | .B clientRequests413 | ||
113 | Client requests received, subject to 413 errors. This variable is | ||
114 | available only in Varnish version \fR4.0\fR. | ||
115 | .TP | ||
96 | .B clientBan | 116 | .B clientBan |
97 | A write-only OID. When set, invalidates the cache using the supplied | 117 | A write-only OID. When set, invalidates the cache using the supplied |
98 | value as argument to ban. When read, returns an empty string. E.g., | 118 | value as argument to ban. When read, returns an empty string. E.g., |
@@ -128,7 +148,8 @@ the pool of connections. It has not yet been used, but it might be, | |||
128 | unless the backend closes it. | 148 | unless the backend closes it. |
129 | .TP | 149 | .TP |
130 | .B backendConnUnused | 150 | .B backendConnUnused |
131 | Number of unused backend connections. | 151 | Number of unused backend connections. This variable is available only |
152 | in Varnish version \fR4.0\fR. | ||
132 | .TP | 153 | .TP |
133 | .B backendConnRetry | 154 | .B backendConnRetry |
134 | Backend connections retried. | 155 | Backend connections retried. |
@@ -237,7 +258,7 @@ Number of sessions dropped because session queue was full. | |||
237 | Number of sessions closed. | 258 | Number of sessions closed. |
238 | .TP | 259 | .TP |
239 | .B sessPipeline | 260 | .B sessPipeline |
240 | Session pipeline. | 261 | Session pipeline. This variable is available only in Varnish version \fR4.0\fR. |
241 | .TP | 262 | .TP |
242 | .B sessReadAhead | 263 | .B sessReadAhead |
243 | Session read-ahead. | 264 | Session read-ahead. |
@@ -252,7 +273,8 @@ Number of sessions dropped for thread. | |||
252 | Number of session accept failures. | 273 | Number of session accept failures. |
253 | .TP | 274 | .TP |
254 | .B sessPipeOverflow | 275 | .B sessPipeOverflow |
255 | Number of session pipe overflows. | 276 | Number of session pipe overflows. This variable is available only in |
277 | Varnish version \fR4.0\fR. | ||
256 | .SS Branch \(dqthreads\(dq | 278 | .SS Branch \(dqthreads\(dq |
257 | .TP | 279 | .TP |
258 | .B threadsPools | 280 | .B threadsPools |
@@ -357,7 +379,7 @@ Sergey Poznyakoff | |||
357 | .SH "BUG REPORTS" | 379 | .SH "BUG REPORTS" |
358 | Report bugs to <gray@gnu.org>. | 380 | Report bugs to <gray@gnu.org>. |
359 | .SH COPYRIGHT | 381 | .SH COPYRIGHT |
360 | Copyright \(co 2014 Sergey Poznyakoff | 382 | Copyright \(co 2014-2016 Sergey Poznyakoff |
361 | .br | 383 | .br |
362 | .na | 384 | .na |
363 | License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> | 385 | License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> |
diff --git a/src/varnish_mib.mib2c b/src/varnish_mib.mib2c index a5367e0..9d49ce9 100644 --- a/src/varnish_mib.mib2c +++ b/src/varnish_mib.mib2c | |||
@@ -1,5 +1,5 @@ | |||
1 | # This file is part of varnish-mib -*- c -*- | 1 | # This file is part of varnish-mib -*- c -*- |
2 | # Copyright (C) 2014-2015 Sergey Poznyakoff | 2 | # Copyright (C) 2014-2016 Sergey Poznyakoff |
3 | # | 3 | # |
4 | # Varnish-mib is free software; you can redistribute it and/or modify | 4 | # Varnish-mib is free software; you can redistribute it and/or modify |
5 | # it under the terms of the GNU General Public License as published by | 5 | # it under the terms of the GNU General Public License as published by |
@@ -24,9 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | @enddefine@ | 25 | @enddefine@ |
26 | @startperl@ | 26 | @startperl@ |
27 | $vars{'varnish_translate'} = sub { | 27 | $vars{'varnish_translate_table'} = { |
28 | my $name = shift; | ||
29 | my %trans = ( | ||
30 | uptime => [ 'MAIN', 'uptime' ], | 28 | uptime => [ 'MAIN', 'uptime' ], |
31 | clientAcceptedConnections => [ 'MAIN', 'sess_conn' ], | 29 | clientAcceptedConnections => [ 'MAIN', 'sess_conn' ], |
32 | clientRequestsReceived => [ 'MAIN', 'client_req' ], | 30 | clientRequestsReceived => [ 'MAIN', 'client_req' ], |
@@ -102,9 +100,12 @@ $vars{'varnish_translate'} = sub { | |||
102 | bansPersistedBytes => [ 'MAIN', 'bans_persisted_bytes' ], | 100 | bansPersistedBytes => [ 'MAIN', 'bans_persisted_bytes' ], |
103 | bansPersistedFragmentation => [ 'MAIN', 'bans_persisted_fragmentation' ], | 101 | bansPersistedFragmentation => [ 'MAIN', 'bans_persisted_fragmentation' ], |
104 | 102 | ||
105 | ); | 103 | }; |
104 | |||
105 | $vars{'varnish_translate'} = sub { | ||
106 | my $name = shift; | ||
106 | 107 | ||
107 | my $r = $trans{$name}; | 108 | my $r = $vars{'varnish_translate_table'}->{$name}; |
108 | if (!defined($r)) { | 109 | if (!defined($r)) { |
109 | print STDERR "no translation for $name!\n"; | 110 | print STDERR "no translation for $name!\n"; |
110 | exit(1); | 111 | exit(1); |
@@ -117,6 +118,13 @@ $vars{'varnish_translate'} = sub { | |||
117 | } else { | 118 | } else { |
118 | delete $vars{$setkw}; | 119 | delete $vars{$setkw}; |
119 | } | 120 | } |
121 | if ($vars{'varnish_type'} eq 'MAIN') { | ||
122 | $vars{'varnish_if'} = "#if HAVE_STRUCT_VSC_C_MAIN_" . uc($vars{'varnish_member'}); | ||
123 | $vars{'varnish_endif'} = '#endif'; | ||
124 | } else { | ||
125 | delete $vars{'varnish_if'}; | ||
126 | delete $vars{'varnish_endif'} | ||
127 | } | ||
120 | return 0; | 128 | return 0; |
121 | }; | 129 | }; |
122 | 130 | ||
@@ -224,6 +232,10 @@ varnish_get_vsm_data() | |||
224 | */ | 232 | */ |
225 | 233 | ||
226 | @foreach $i scalar@ | 234 | @foreach $i scalar@ |
235 | @startperl@ | ||
236 | &{$vars{'varnish_translate'}}($vars{'i'}); | ||
237 | @endperl@ | ||
238 | $varnish_if | ||
227 | static int | 239 | static int |
228 | handle_$i(netsnmp_mib_handler *handler, | 240 | handle_$i(netsnmp_mib_handler *handler, |
229 | netsnmp_handler_registration *reginfo, | 241 | netsnmp_handler_registration *reginfo, |
@@ -234,10 +246,6 @@ handle_$i(netsnmp_mib_handler *handler, | |||
234 | int ret; | 246 | int ret; |
235 | @end@ | 247 | @end@ |
236 | 248 | ||
237 | @startperl@ | ||
238 | &{$vars{'varnish_translate'}}($vars{'i'}); | ||
239 | @endperl@ | ||
240 | |||
241 | if (!varnish_get_vsm_data()) | 249 | if (!varnish_get_vsm_data()) |
242 | return SNMP_ERR_NOSUCHNAME; | 250 | return SNMP_ERR_NOSUCHNAME; |
243 | 251 | ||
@@ -359,6 +367,7 @@ handle_$i(netsnmp_mib_handler *handler, | |||
359 | 367 | ||
360 | return SNMP_ERR_NOERROR; | 368 | return SNMP_ERR_NOERROR; |
361 | } | 369 | } |
370 | $varnish_endif | ||
362 | @end@ | 371 | @end@ |
363 | 372 | ||
364 | @foreach $i table@ | 373 | @foreach $i table@ |
@@ -543,7 +552,12 @@ void | |||
543 | init_$modulename(void) | 552 | init_$modulename(void) |
544 | { | 553 | { |
545 | @foreach $i scalar@ | 554 | @foreach $i scalar@ |
555 | @startperl@ | ||
556 | &{$vars{'varnish_translate'}}($vars{'i'}); | ||
557 | @endperl@ | ||
558 | $varnish_if | ||
546 | const oid ${i}_oid[] = { $i.commaoid }; | 559 | const oid ${i}_oid[] = { $i.commaoid }; |
560 | $varnish_endif | ||
547 | @end@ | 561 | @end@ |
548 | 562 | ||
549 | DEBUGMSGTL(("$modulename", "Initializing\n")); | 563 | DEBUGMSGTL(("$modulename", "Initializing\n")); |
@@ -567,6 +581,10 @@ init_$modulename(void) | |||
567 | snmp_log(LOG_ERR,"can't register config handler\n"); | 581 | snmp_log(LOG_ERR,"can't register config handler\n"); |
568 | 582 | ||
569 | @foreach $i scalar@ | 583 | @foreach $i scalar@ |
584 | @startperl@ | ||
585 | &{$vars{'varnish_translate'}}($vars{'i'}); | ||
586 | @endperl@ | ||
587 | $varnish_if | ||
570 | netsnmp_register_scalar( | 588 | netsnmp_register_scalar( |
571 | netsnmp_create_handler_registration("$i", handle_$i, | 589 | netsnmp_create_handler_registration("$i", handle_$i, |
572 | ${i}_oid, OID_LENGTH(${i}_oid), | 590 | ${i}_oid, OID_LENGTH(${i}_oid), |
@@ -577,6 +595,7 @@ init_$modulename(void) | |||
577 | HANDLER_CAN_RWRITE | 595 | HANDLER_CAN_RWRITE |
578 | @end@ | 596 | @end@ |
579 | )); | 597 | )); |
598 | $varnish_endif | ||
580 | @end@ | 599 | @end@ |
581 | @foreach $i table@ | 600 | @foreach $i table@ |
582 | initialize_table_$i(); | 601 | initialize_table_$i(); |
@@ -439,7 +439,7 @@ vcli_connect(struct VSM_data *vd, struct vcli_conn *conn) | |||
439 | snmp_log(LOG_ERR, "no -T arg in shared memory\n"); | 439 | snmp_log(LOG_ERR, "no -T arg in shared memory\n"); |
440 | return SNMP_ERR_GENERR; | 440 | return SNMP_ERR_GENERR; |
441 | } | 441 | } |
442 | DEBUGMSGTL(("varnish_mib:vcli", "-T '%s'\n", vt.b)); | 442 | DEBUGMSGTL(("varnish_mib:vcli", "-T '%s'\n", (char*) vt.b)); |
443 | 443 | ||
444 | s = strdup(vt.b); | 444 | s = strdup(vt.b); |
445 | if (!s) { | 445 | if (!s) { |
@@ -489,7 +489,7 @@ vcli_connect(struct VSM_data *vd, struct vcli_conn *conn) | |||
489 | snmp_log(LOG_ERR, "no -S arg in shared memory\n"); | 489 | snmp_log(LOG_ERR, "no -S arg in shared memory\n"); |
490 | return SNMP_ERR_GENERR; | 490 | return SNMP_ERR_GENERR; |
491 | } | 491 | } |
492 | DEBUGMSGTL(("varnish_mib:vcli", "-S '%s'\n", vt.b)); | 492 | DEBUGMSGTL(("varnish_mib:vcli", "-S '%s'\n", (char*) vt.b)); |
493 | s = strdup(vt.b); | 493 | s = strdup(vt.b); |
494 | if (!s) { | 494 | if (!s) { |
495 | snmp_log(LOG_ERR, "out of memory\n"); | 495 | snmp_log(LOG_ERR, "out of memory\n"); |