aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2014-11-28 12:38:06 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2014-11-28 12:38:06 +0200
commita0e9f37c170c6947928676e9d870bd3d7d74a189 (patch)
treeec991276efeaa603d6b66735eccd5dd9039f779a
parent86411752caf12649c48ec741afa89471ca9243ee (diff)
downloadvarnish-mib-a0e9f37c170c6947928676e9d870bd3d7d74a189.tar.gz
varnish-mib-a0e9f37c170c6947928676e9d870bd3d7d74a189.tar.bz2
Clean up debugging output, document debugging tokens.
-rw-r--r--src/ban.c6
-rw-r--r--src/betab.c6
-rw-r--r--src/varnish-mib.810
-rw-r--r--src/varnish_mib.mib2c2
-rw-r--r--src/vcli.c8
5 files changed, 21 insertions, 11 deletions
diff --git a/src/ban.c b/src/ban.c
index 3023838..70ca541 100644
--- a/src/ban.c
+++ b/src/ban.c
@@ -153,7 +153,7 @@ banTable_load(netsnmp_cache *cache, void *vmagic)
153 char *p; 153 char *p;
154 struct VSM_data *vd; 154 struct VSM_data *vd;
155 155
156 DEBUGMSGTL(("varnish_ban", "reloading ban table")); 156 DEBUGMSGTL(("varnish_ban", "reloading ban table\n"));
157 vd = varnish_get_vsm_data(); 157 vd = varnish_get_vsm_data();
158 rc = vcli_connect(vd, &conn); 158 rc = vcli_connect(vd, &conn);
159 if (rc != SNMP_ERR_NOERROR) 159 if (rc != SNMP_ERR_NOERROR)
@@ -263,7 +263,7 @@ banTable_load(netsnmp_cache *cache, void *vmagic)
263 p = q; 263 p = q;
264 } 264 }
265 vcli_disconnect(&conn); 265 vcli_disconnect(&conn);
266 DEBUGMSGTL(("varnish_ban", "loaded %ld ban entries", idx)); 266 DEBUGMSGTL(("varnish_ban", "loaded %ld ban entries\n", idx));
267 return 0; 267 return 0;
268} 268}
269 269
@@ -273,7 +273,7 @@ banTable_free(netsnmp_cache *cache, void *vmagic)
273 netsnmp_tdata *table = (netsnmp_tdata *) vmagic; 273 netsnmp_tdata *table = (netsnmp_tdata *) vmagic;
274 netsnmp_tdata_row *row; 274 netsnmp_tdata_row *row;
275 275
276 DEBUGMSGTL(("varnish_ban", "freeing ban table")); 276 DEBUGMSGTL(("varnish_ban", "freeing ban table\n"));
277 while ((row = netsnmp_tdata_row_first(table))) { 277 while ((row = netsnmp_tdata_row_first(table))) {
278 struct banTable_entry *entry = row->data; 278 struct banTable_entry *entry = row->data;
279 free(entry->banExpression); 279 free(entry->banExpression);
diff --git a/src/betab.c b/src/betab.c
index 3e10a9a..41c18e7 100644
--- a/src/betab.c
+++ b/src/betab.c
@@ -231,11 +231,11 @@ backendTable_load(netsnmp_cache *cache, void *vmagic)
231 bp.table = (netsnmp_tdata *) vmagic; 231 bp.table = (netsnmp_tdata *) vmagic;
232 memset(&bp.ent, 0, sizeof(bp.ent)); 232 memset(&bp.ent, 0, sizeof(bp.ent));
233 233
234 DEBUGMSGTL(("varnish_ban", "loading backend table")); 234 DEBUGMSGTL(("varnish_ban", "loading backend table\n"));
235 VSC_Iter(vd, NULL, create_entry_cb, &bp); 235 VSC_Iter(vd, NULL, create_entry_cb, &bp);
236 /* FIXME: perhaps handle bp.err separately */ 236 /* FIXME: perhaps handle bp.err separately */
237 if (bp.idx != -1) { 237 if (bp.idx != -1) {
238 DEBUGMSGTL(("varnish_ban", "loaded %lu backend entries", 238 DEBUGMSGTL(("varnish_ban", "loaded %lu backend entries\n",
239 bp.idx + 1)); 239 bp.idx + 1));
240 if (!create_entry(bp.table, bp.idx, &bp.ent)) 240 if (!create_entry(bp.table, bp.idx, &bp.ent))
241 snmp_log(LOG_ERR, "out of memory\n"); 241 snmp_log(LOG_ERR, "out of memory\n");
@@ -249,7 +249,7 @@ backendTable_free(netsnmp_cache *cache, void *vmagic)
249 netsnmp_tdata *table = (netsnmp_tdata *) vmagic; 249 netsnmp_tdata *table = (netsnmp_tdata *) vmagic;
250 netsnmp_tdata_row *row; 250 netsnmp_tdata_row *row;
251 251
252 DEBUGMSGTL(("varnish_ban", "freeing backend table")); 252 DEBUGMSGTL(("varnish_ban", "freeing backend table\n"));
253 while ((row = netsnmp_tdata_row_first(table))) { 253 while ((row = netsnmp_tdata_row_first(table))) {
254 struct backendTable_entry *entry = row->data; 254 struct backendTable_entry *entry = row->data;
255 free(entry->vbeIdent); 255 free(entry->vbeIdent);
diff --git a/src/varnish-mib.8 b/src/varnish-mib.8
index 05fa177..cc3276b 100644
--- a/src/varnish-mib.8
+++ b/src/varnish-mib.8
@@ -61,6 +61,16 @@ Default is 5 seconds.
61.TP 61.TP
62\fBvarnishBackendTableTimeout\fR \fINUMBER\fR 62\fBvarnishBackendTableTimeout\fR \fINUMBER\fR
63Update interval for \fBbackendTable\fR. Default is 5 seconds. 63Update interval for \fBbackendTable\fR. Default is 5 seconds.
64.SH DEBUGGING
65The module defines the following debugging tokens:
66.TP
67.B varnish_ban
68Enables general debugging information.
69.TP
70.B varnish_mib:vcli
71Varnish
72.B CLI
73interaction.
64.SH OIDS 74.SH OIDS
65The following OIDs are defined: 75The following OIDs are defined:
66.SS Branch \(dqclient\(dq 76.SS Branch \(dqclient\(dq
diff --git a/src/varnish_mib.mib2c b/src/varnish_mib.mib2c
index 6452ac2..ae344be 100644
--- a/src/varnish_mib.mib2c
+++ b/src/varnish_mib.mib2c
@@ -501,7 +501,7 @@ initialize_table_$i(void)
501 netsnmp_table_registration_info *table_info; 501 netsnmp_table_registration_info *table_info;
502 netsnmp_cache *cache; 502 netsnmp_cache *cache;
503 503
504 DEBUGMSGTL(("${name}:init", "initializing table $i\n")); 504 DEBUGMSGTL(("${modulename}", "initializing table $i\n"));
505 505
506 reg = netsnmp_create_handler_registration("$i", handle_table_${i}, 506 reg = netsnmp_create_handler_registration("$i", handle_table_${i},
507 ${i}_oid, ${i}_oid_len, 507 ${i}_oid, ${i}_oid_len,
diff --git a/src/vcli.c b/src/vcli.c
index 6e7bbec..76f869a 100644
--- a/src/vcli.c
+++ b/src/vcli.c
@@ -146,7 +146,7 @@ vcli_read(struct vcli_conn *conn, size_t size)
146 if (conn->bufsize == 0) 146 if (conn->bufsize == 0)
147 ret = -1; 147 ret = -1;
148 conn->base[conn->bufsize] = 0; 148 conn->base[conn->bufsize] = 0;
149 DEBUGMSGTL(("vcli_mib", "<<varnish: %s\n", conn->base)); 149 DEBUGMSGTL(("varnish_mib:vcli", "<<varnish: %s\n", conn->base));
150 } 150 }
151 151
152 return ret; 152 return ret;
@@ -229,7 +229,7 @@ vcli_write(struct vcli_conn *conn)
229{ 229{
230 size_t size; 230 size_t size;
231 231
232 DEBUGMSGTL(("vcli_mib", ">>varnish: %s\n", conn->base)); 232 DEBUGMSGTL(("varnish_mib:vcli", ">>varnish: %s\n", conn->base));
233 for (size = 0; size < conn->bufsize; ) { 233 for (size = 0; size < conn->bufsize; ) {
234 int n = write(conn->fd, conn->base + size, 234 int n = write(conn->fd, conn->base + size,
235 conn->bufsize - size); 235 conn->bufsize - size);
@@ -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(("vcli_mib", "-T '%s'\n", vt.b)); 442 DEBUGMSGTL(("varnish_mib:vcli", "-T '%s'\n", 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(("vcli_mib", "-S '%s'\n", vt.b)); 492 DEBUGMSGTL(("varnish_mib:vcli", "-S '%s'\n", 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");

Return to:

Send suggestions and report system problems to the System administrator.