summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5e9a90b)
raw | patch | inline | side by side (parent: 5e9a90b)
author | Florian Forster <octo@huhu.verplant.org> | |
Mon, 27 Sep 2010 09:45:01 +0000 (11:45 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Mon, 27 Sep 2010 09:45:01 +0000 (11:45 +0200) |
Configurations without an "<Instance />" block are not supported
anymore. The documentation and default config have been adapted.
anymore. The documentation and default config have been adapted.
src/apache.c | patch | blob | history | |
src/collectd.conf.in | patch | blob | history | |
src/collectd.conf.pod | patch | blob | history |
diff --git a/src/apache.c b/src/apache.c
index 80c66bff3056443b14fb11668925f4657a6d852d..506ba84ec23e58d9396e9165454c3a08a6e33be3 100644 (file)
--- a/src/apache.c
+++ b/src/apache.c
/**
* collectd - src/apache.c
- * Copyright (C) 2006-2009 Florian octo Forster
+ * Copyright (C) 2006-2010 Florian octo Forster
* Copyright (C) 2007 Florent EppO Monbillard
* Copyright (C) 2009 Amit Gupta
*
{
int status = 0;
int i;
- oconfig_item_t *lci = NULL; /* legacy config */
for (i = 0; i < ci->children_num; i++)
{
oconfig_item_t *child = ci->children + i;
- if (strcasecmp ("Instance", child->key) == 0 && child->children_num > 0)
+ if (strcasecmp ("Instance", child->key) == 0)
config_add (child);
else
- {
- /* legacy mode - convert to <Instance ...> config */
- if (lci == NULL)
- {
- lci = malloc (sizeof(*lci));
- if (lci == NULL)
- {
- ERROR ("apache plugin: malloc failed.");
- return (-1);
- }
- memset (lci, '\0', sizeof (*lci));
- }
-
- lci->children_num++;
- lci->children =
- realloc (lci->children,
- lci->children_num * sizeof (*child));
- if (lci->children == NULL)
- {
- ERROR ("apache plugin: realloc failed.");
- return (-1);
- }
- memcpy (&lci->children[lci->children_num-1], child, sizeof (*child));
- }
+ WARNING ("apache plugin: The configuration option "
+ "\"%s\" is not allowed here. Did you "
+ "forget to add an <Instance /> block "
+ "around the configuration?",
+ child->key);
} /* for (ci->children) */
- if (lci)
- {
- /* create a <Instance ""> entry */
- lci->key = "Instance";
- lci->values_num = 1;
- lci->values = (oconfig_value_t *) malloc (lci->values_num * sizeof (oconfig_value_t));
- lci->values[0].type = OCONFIG_TYPE_STRING;
- lci->values[0].value.string = "";
-
- status = config_add (lci);
- sfree (lci->values);
- sfree (lci->children);
- sfree (lci);
- }
-
- return status;
+ return (status);
} /* int config */
/* initialize curl for each host */
diff --git a/src/collectd.conf.in b/src/collectd.conf.in
index cc125ddf2ebb7fdd88e8431c24dedd330f789959..12cec7592d772434785fc1eace45a37b2f7a63e2 100644 (file)
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
##############################################################################
#<Plugin apache>
-# URL "http://localhost/status?auto"
-# User "www-user"
-# Password "secret"
-# CACert "/etc/ssl/ca.crt"
+# <Instance "local">
+# URL "http://localhost/status?auto"
+# User "www-user"
+# Password "secret"
+# CACert "/etc/ssl/ca.crt"
+# </Instance>
#</Plugin>
#<Plugin apcups>
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index af07cdf23017a2afbf6881ebe16563d86e6ff290..4b7a2e34eb44b9cf8cdc11ad2dd87df977eb4123 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
also supported. It introduces a new field, called C<BusyServers>, to count the
number of currently connected clients. This field is also supported.
-The following options are accepted by the C<apache>-plugin:
+The configuration of the I<Apache> plugin consists of one or more
+C<E<lt>InstanceE<nbsp>/E<gt>> blocks. Each block requires one string argument
+as the instance name. For example:
+
+ <Plugin "apache">
+ <Instance "www1">
+ URL "http://www1.example.com/mod_status?auto"
+ </Instance>
+ <Instance "www2">
+ URL "http://www2.example.com/mod_status?auto"
+ </Instance>
+ </Plugin>
+
+The instance name will be used as the I<plugin instance>. To emulate the old
+(versionE<nbsp>4) behavior, you can use an empty string (""). In order for the
+plugin to work correctly, each instance name must be unique. This is not
+enforced by the plugin and it is your responsibility to ensure it.
+
+The following options are accepted within each I<Instance> block:
=over 4
Sets the URL of the C<mod_status> output. This needs to be the output generated
by C<ExtendedStatus on> and it needs to be the machine readable output
-generated by appending the C<?auto> argument.
+generated by appending the C<?auto> argument. This option is I<mandatory>.
=item B<User> I<Username>