projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #3353 from mrunge/master
[collectd.git]
/
src
/
varnish.c
diff --git
a/src/varnish.c
b/src/varnish.c
index
08260dc
..
f4c70af
100644
(file)
--- a/
src/varnish.c
+++ b/
src/varnish.c
@@
-26,8
+26,8
@@
#include "collectd.h"
#include "collectd.h"
-#include "common.h"
#include "plugin.h"
#include "plugin.h"
+#include "utils/common/common.h"
#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5
#include <vapi/vsc.h>
#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5
#include <vapi/vsc.h>
@@
-50,50
+50,50
@@
typedef struct varnish_stats c_varnish_stats_t;
struct user_config_s {
char *instance;
struct user_config_s {
char *instance;
-
_B
ool collect_cache;
-
_B
ool collect_connections;
-
_B
ool collect_esi;
-
_B
ool collect_backend;
+
b
ool collect_cache;
+
b
ool collect_connections;
+
b
ool collect_esi;
+
b
ool collect_backend;
#ifdef HAVE_VARNISH_V3
#ifdef HAVE_VARNISH_V3
-
_B
ool collect_dirdns;
+
b
ool collect_dirdns;
#endif
#endif
-
_B
ool collect_fetch;
-
_B
ool collect_hcb;
-
_B
ool collect_objects;
+
b
ool collect_fetch;
+
b
ool collect_hcb;
+
b
ool collect_objects;
#if HAVE_VARNISH_V2
#if HAVE_VARNISH_V2
-
_B
ool collect_purge;
+
b
ool collect_purge;
#else
#else
-
_B
ool collect_ban;
+
b
ool collect_ban;
#endif
#endif
-
_B
ool collect_session;
-
_B
ool collect_shm;
-
_B
ool collect_sms;
+
b
ool collect_session;
+
b
ool collect_shm;
+
b
ool collect_sms;
#if HAVE_VARNISH_V2
#if HAVE_VARNISH_V2
-
_B
ool collect_sm;
+
b
ool collect_sm;
#endif
#if HAVE_VARNISH_V2 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5
#endif
#if HAVE_VARNISH_V2 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5
-
_B
ool collect_sma;
+
b
ool collect_sma;
#endif
#endif
-
_B
ool collect_struct;
-
_B
ool collect_totals;
+
b
ool collect_struct;
+
b
ool collect_totals;
#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5
#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5
-
_B
ool collect_uptime;
+
b
ool collect_uptime;
#endif
#endif
-
_B
ool collect_vcl;
-
_B
ool collect_workers;
+
b
ool collect_vcl;
+
b
ool collect_workers;
#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5
#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5
-
_B
ool collect_vsm;
-
_B
ool collect_lck;
-
_B
ool collect_mempool;
-
_B
ool collect_mgt;
-
_B
ool collect_smf;
-
_B
ool collect_vbe;
-
_B
ool collect_mse;
+
b
ool collect_vsm;
+
b
ool collect_lck;
+
b
ool collect_mempool;
+
b
ool collect_mgt;
+
b
ool collect_smf;
+
b
ool collect_vbe;
+
b
ool collect_mse;
#endif
};
typedef struct user_config_s user_config_t; /* }}} */
#endif
};
typedef struct user_config_s user_config_t; /* }}} */
-static
_Bool have_instance = 0
;
+static
bool have_instance
;
static int varnish_submit(const char *plugin_instance, /* {{{ */
const char *category, const char *type,
static int varnish_submit(const char *plugin_instance, /* {{{ */
const char *category, const char *type,
@@
-107,8
+107,8
@@
static int varnish_submit(const char *plugin_instance, /* {{{ */
if (plugin_instance == NULL)
plugin_instance = "default";
if (plugin_instance == NULL)
plugin_instance = "default";
- snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%s",
- plugin_instance, category);
+ s
s
nprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%s",
+
plugin_instance, category);
sstrncpy(vl.type, type, sizeof(vl.type));
sstrncpy(vl.type, type, sizeof(vl.type));
@@
-1331,7
+1331,7
@@
static int varnish_read(user_data_t *ud) /* {{{ */
{
#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4
struct VSM_data *vd;
{
#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4
struct VSM_data *vd;
-
_B
ool ok;
+
b
ool ok;
const c_varnish_stats_t *stats;
#elif HAVE_VARNISH_V5
struct vsm *vd;
const c_varnish_stats_t *stats;
#elif HAVE_VARNISH_V5
struct vsm *vd;
@@
-1480,45
+1480,45
@@
static int varnish_config_apply_default(user_config_t *conf) /* {{{ */
if (conf == NULL)
return EINVAL;
if (conf == NULL)
return EINVAL;
- conf->collect_backend =
1
;
- conf->collect_cache =
1
;
- conf->collect_connections =
1
;
+ conf->collect_backend =
true
;
+ conf->collect_cache =
true
;
+ conf->collect_connections =
true
;
#ifdef HAVE_VARNISH_V3
#ifdef HAVE_VARNISH_V3
- conf->collect_dirdns =
0
;
+ conf->collect_dirdns =
false
;
#endif
#endif
- conf->collect_esi =
0
;
- conf->collect_fetch =
0
;
- conf->collect_hcb =
0
;
- conf->collect_objects =
0
;
+ conf->collect_esi =
false
;
+ conf->collect_fetch =
false
;
+ conf->collect_hcb =
false
;
+ conf->collect_objects =
false
;
#if HAVE_VARNISH_V2
#if HAVE_VARNISH_V2
- conf->collect_purge =
0
;
+ conf->collect_purge =
false
;
#else
#else
- conf->collect_ban =
0
;
+ conf->collect_ban =
false
;
#endif
#endif
- conf->collect_session =
0
;
- conf->collect_shm =
1
;
+ conf->collect_session =
false
;
+ conf->collect_shm =
true
;
#if HAVE_VARNISH_V2
#if HAVE_VARNISH_V2
- conf->collect_sm =
0
;
+ conf->collect_sm =
false
;
#endif
#if HAVE_VARNISH_V2 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5
#endif
#if HAVE_VARNISH_V2 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5
- conf->collect_sma =
0
;
+ conf->collect_sma =
false
;
#endif
#endif
- conf->collect_sms =
0
;
- conf->collect_struct =
0
;
- conf->collect_totals =
0
;
+ conf->collect_sms =
false
;
+ conf->collect_struct =
false
;
+ conf->collect_totals =
false
;
#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5
#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5
- conf->collect_uptime =
0
;
+ conf->collect_uptime =
false
;
#endif
#endif
- conf->collect_vcl =
0
;
- conf->collect_workers =
0
;
+ conf->collect_vcl =
false
;
+ conf->collect_workers =
false
;
#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5
#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5
- conf->collect_vsm =
0
;
- conf->collect_lck =
0
;
- conf->collect_mempool =
0
;
- conf->collect_mgt =
0
;
- conf->collect_smf =
0
;
- conf->collect_vbe =
0
;
- conf->collect_mse =
0
;
+ conf->collect_vsm =
false
;
+ conf->collect_lck =
false
;
+ conf->collect_mempool =
false
;
+ conf->collect_mgt =
false
;
+ conf->collect_smf =
false
;
+ conf->collect_vbe =
false
;
+ conf->collect_mse =
false
;
#endif
return 0;
#endif
return 0;
@@
-1546,7
+1546,8
@@
static int varnish_init(void) /* {{{ */
/* callback = */ varnish_read,
/* interval = */ 0,
&(user_data_t){
/* callback = */ varnish_read,
/* interval = */ 0,
&(user_data_t){
- .data = conf, .free_func = varnish_config_free,
+ .data = conf,
+ .free_func = varnish_config_free,
});
return 0;
});
return 0;
@@
-1751,7
+1752,7
@@
static int varnish_config_instance(const oconfig_item_t *ci) /* {{{ */
!conf->collect_mgt && !conf->collect_lck && !conf->collect_mempool &&
!conf->collect_mse
#endif
!conf->collect_mgt && !conf->collect_lck && !conf->collect_mempool &&
!conf->collect_mse
#endif
-
) {
+ ) {
WARNING("Varnish plugin: No metric has been configured for "
"instance \"%s\". Disabling this instance.",
(conf->instance == NULL) ? "localhost" : conf->instance);
WARNING("Varnish plugin: No metric has been configured for "
"instance \"%s\". Disabling this instance.",
(conf->instance == NULL) ? "localhost" : conf->instance);
@@
-1759,8
+1760,8
@@
static int varnish_config_instance(const oconfig_item_t *ci) /* {{{ */
return EINVAL;
}
return EINVAL;
}
- snprintf(callback_name, sizeof(callback_name), "varnish/%s",
- (conf->instance == NULL) ? "localhost" : conf->instance);
+ s
s
nprintf(callback_name, sizeof(callback_name), "varnish/%s",
+
(conf->instance == NULL) ? "localhost" : conf->instance);
plugin_register_complex_read(
/* group = */ "varnish",
plugin_register_complex_read(
/* group = */ "varnish",
@@
-1768,10
+1769,11
@@
static int varnish_config_instance(const oconfig_item_t *ci) /* {{{ */
/* callback = */ varnish_read,
/* interval = */ 0,
&(user_data_t){
/* callback = */ varnish_read,
/* interval = */ 0,
&(user_data_t){
- .data = conf, .free_func = varnish_config_free,
+ .data = conf,
+ .free_func = varnish_config_free,
});
});
- have_instance =
1
;
+ have_instance =
true
;
return 0;
} /* }}} int varnish_config_instance */
return 0;
} /* }}} int varnish_config_instance */