disable all plugins whose requirements cannot be fulfilled (any other plugin
will be enabled). To enable a plugin, install missing dependencies (see
section `Prerequisites' above) and rerun `configure'. If you specify the
- `--enable-<plugin>' configure option, you can force the plugin to be built.
- This will most likely fail though unless you're working in a very unusual
- setup and you really know what you're doing.
+ `--enable-<plugin>' configure option, the script will fail if the depen-
+ dencies for the specified plugin are not met. If you specify the
+ `--disable-<plugin>' configure option, the plugin will not be built. Both
+ options are meant for package maintainers and should not be used in everyday
+ situations.
By default, collectd will be installed into `/opt/collectd'. You can adjust
this setting by specifying the `--prefix' configure option - see INSTALL for
])
if test "x$enable_plugin" = "xyes"
then
- AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
+ if test "x$2" = "xyes"
+ then
+ AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
+ else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
+ dependency_error="yes"
+ enable_plugin="no (dependency error)"
+ fi
fi
AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
enable_$1="$enable_plugin"
AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
+dependency_error="no"
plugin_ascent="no"
plugin_battery="no"
plugin_cpu="no"
EOF
+if test "x$dependency_error" = "xyes"; then
+ AC_MSG_ERROR("Some plugins are missing dependencies - see above summary for details")
+fi
+
# vim: set fdm=marker :
char **values_names;
int i;
+ int j;
fd = socket (PF_UNIX, SOCK_STREAM, 0);
if (fd < 0)
free (values);
return (-1);
}
+ memset (values_names, 0, values_num * sizeof (char *));
- i = 0;
+ i = 0; /* index of the values returned by the server */
+ j = 0; /* number of values in `values_names' and `values' */
while (fgets (buffer, sizeof (buffer), fh_in) != NULL)
{
- char *key;
- char *value;
+ do /* while (0) */
+ {
+ char *key;
+ char *value;
+ char *endptr;
+
+ key = buffer;
- key = buffer;
+ value = strchr (key, '=');
+ if (value == NULL)
+ {
+ fprintf (stderr, "Cannot parse line: %s\n", buffer);
+ break;
+ }
+ *value = 0;
+ value++;
- value = strchr (key, '=');
- if (value == NULL)
- continue;
- *value = '\0'; value++;
+ if (ignore_ds (key) != 0)
+ break;
- if (ignore_ds (key) != 0)
- continue;
+ endptr = NULL;
+ errno = 0;
+ values[j] = strtod (value, &endptr);
+ if ((endptr == value) || (errno != 0))
+ {
+ fprintf (stderr, "Could not parse buffer "
+ "as number: %s\n", value);
+ break;
+ }
- values_names[i] = strdup (key);
- values[i] = atof (value);
+ values_names[j] = strdup (key);
+ if (values_names[j] == NULL)
+ {
+ fprintf (stderr, "strdup failed.\n");
+ break;
+ }
+ j++;
+ } while (0);
i++;
if (i >= values_num)
break;
}
- values_num = i;
+ /* Set `values_num' to the number of values actually stored in the
+ * array. */
+ values_num = j;
fclose (fh_in); fh_in = NULL; fd = -1;
fclose (fh_out); fh_out = NULL;
=item B<-g> B<none>I<|>B<average>I<|>B<sum>
-When multiple data sources are selected from a value spec they can be handled
+When multiple data sources are selected from a value spec, they can be handled
differently depending on this option. The values of the following meaning:
=over 4
Set the critical (B<-c>) and warning (B<-w>) ranges. These options mostly
follow the normal syntax of Nagios plugins. The general format is
-"I<min>B<:>I<max>". If a value if smaller than I<min> or bigger than I<max> a
-warning or critical is returned, otherwise okay is returned. I<min> (and the
-colon) may be omitted and are then assumed to be zero. If I<max> (but not the
-colon) is omitted I<max> is set to positive infinity. If either I<min> or
-I<max> if set to B<~> they are set to negative and positive infinity,
-respectively.
+"I<min>B<:>I<max>". If a value is smaller than I<min> or bigger than I<max>, a
+I<warning> or I<critical> status is returned, otherwise the status is
+I<success>.
+
+The tilde sign (B<~>) can be used to explicitly specify infinity. If B<~> is
+used as a I<min> value, negative infinity is used. In case of I<max>, it is
+interpreted as positive infinity.
+
+If the first character of the I<range> is the atE<nbsp>sign (B<@>), the meaning
+of the range will be inverted. I.E<nbsp>e. all values I<within> the range will
+yield a I<warning> or I<critical> status, while all values I<outside> the range
+will result in a I<success> status.
+
+I<min> (and the colon) may be omitted,
+I<min> is then assumed to be zero. If I<max> (but not the trailing colon) is
+omitted, I<max> is assumed to be positive infinity.
=back
=head1 RETURN VALUE
-As usual for Nagios plugins this program writes a short, one line status
+As usual for Nagios plugins, this program writes a short, one line status
message to STDOUT and signals success or failure with it's return value. It
-exists with a return value of B<0> for success or B<1> or B<2> for warning and
-critical, respectively. If the values is not available or some other error
-occurred it returns B<3> for "unknown".
+exits with a return value of B<0> for I<success>, B<1> for I<warning> and B<2>
+for I<critical>. If the values are not available or some other error occurred,
+it returns B<3> for I<unknown>.
=head1 SEE ALSO
dispatch_block (conf->children + i);
}
+ oconfig_free (conf);
+
+ /* Read the default types.db if no `TypesDB' option was given. */
if (cf_default_typesdb)
- read_types_list (PLUGINDIR"/types.db"); /* FIXME: Configure path */
+ read_types_list (PLUGINDIR"/types.db");
+
return (0);
} /* int cf_read */
if (msg->tcm_ifindex >= iflist_len)
{
ERROR ("netlink plugin: qos_filter: msg->tcm_ifindex = %i "
- ">= iflist_len = %i",
+ ">= iflist_len = %zu",
msg->tcm_ifindex, iflist_len);
return (-1);
}
fields_num = strsplit (val_cpy, fields, 3);
if ((fields_num != 1)
&& (fields_num != 2))
+ {
+ sfree (val_cpy);
return (1);
+ }
else if (fields_num == 2)
{
if ((service = strchr (fields[1], '.')) != NULL)
network_add_listen_socket (node, service);
else
network_add_sending_socket (node, service);
+
+ sfree (val_cpy);
}
else if (strcasecmp ("TimeToLive", key) == 0)
{
ERROR ("uc_check_timeout: c_avl_remove (%s) failed.", keys[i]);
}
sfree (keys[i]);
+ sfree (key);
cache_free (ce);
}
else if (status == 1) /* persist */