summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 677ce04)
raw | patch | inline | side by side (parent: 677ce04)
author | Scott Sanders <scott@jssjr.com> | |
Sun, 9 Oct 2011 23:08:27 +0000 (19:08 -0400) | ||
committer | Scott Sanders <scott@jssjr.com> | |
Sun, 9 Oct 2011 23:08:27 +0000 (19:08 -0400) |
While useful, the user should not be required to provide a prefix.
Having the hosts as the top level containers may make sense in some
environments. The current format is "${prefix}${hostname}${postfix}" so
be careful to add dots where needed.
Also updated docs to reflect this change.
Having the hosts as the top level containers may make sense in some
environments. The current format is "${prefix}${hostname}${postfix}" so
be careful to add dots where needed.
Also updated docs to reflect this change.
src/write_graphite.c | patch | blob | history |
diff --git a/src/write_graphite.c b/src/write_graphite.c
index 4fc38fb31df94aae02e478266c2f55c112348ce9..57933e8dc3c518f77fa5f1aa72b6ba82f12b8436 100644 (file)
--- a/src/write_graphite.c
+++ b/src/write_graphite.c
if ((n_type_instance == NULL) || (n_type_instance[0] == '\0'))
{
if ((ds_name == NULL) || (ds_name[0] == '\0'))
- status = ssnprintf (ret, ret_len, "%s.%s%s.%s.%s",
+ status = ssnprintf (ret, ret_len, "%s%s%s.%s.%s",
prefix, n_hostname, postfix, plugin, type);
else
- status = ssnprintf (ret, ret_len, "%s.%s%s.%s.%s.%s",
+ status = ssnprintf (ret, ret_len, "%s%s%s.%s.%s.%s",
prefix, n_hostname, postfix, plugin, type, ds_name);
}
else
{
if ((ds_name == NULL) || (ds_name[0] == '\0'))
- status = ssnprintf (ret, ret_len, "%s.%s%s.%s.%s-%s",
+ status = ssnprintf (ret, ret_len, "%s%s%s.%s.%s-%s",
prefix, n_hostname, postfix, plugin, type,
n_type_instance);
else
- status = ssnprintf (ret, ret_len, "%s.%s%s.%s.%s-%s.%s",
+ status = ssnprintf (ret, ret_len, "%s%s%s.%s.%s-%s.%s",
prefix, n_hostname, postfix, plugin, type,
n_type_instance, ds_name);
}
if ((n_type_instance == NULL) || (n_type_instance[0] == '\0'))
{
if ((ds_name == NULL) || (ds_name[0] == '\0'))
- status = ssnprintf (ret, ret_len, "%s.%s%s.%s.%s.%s",
+ status = ssnprintf (ret, ret_len, "%s%s%s.%s.%s.%s",
prefix, n_hostname, postfix, plugin,
plugin_instance, type);
else
- status = ssnprintf (ret, ret_len, "%s.%s%s.%s.%s.%s.%s",
+ status = ssnprintf (ret, ret_len, "%s%s%s.%s.%s.%s.%s",
prefix, n_hostname, postfix, plugin,
plugin_instance, type, ds_name);
}
else
{
if ((ds_name == NULL) || (ds_name[0] == '\0'))
- status = ssnprintf (ret, ret_len, "%s.%s%s.%s.%s.%s-%s",
+ status = ssnprintf (ret, ret_len, "%s%s%s.%s.%s.%s-%s",
prefix, n_hostname, postfix, plugin,
plugin_instance, type, n_type_instance);
else
- status = ssnprintf (ret, ret_len, "%s.%s%s.%s.%s.%s-%s.%s",
+ status = ssnprintf (ret, ret_len, "%s%s%s.%s.%s.%s-%s.%s",
prefix, n_hostname, postfix, plugin,
plugin_instance, type, n_type_instance, ds_name);
}
}
}
+ if (cb->prefix == NULL) {
+ if ((cb->prefix = malloc((int)sizeof(char))) == NULL)
+ {
+ ERROR ("Unable to allocate memory for hostname prefix buffer");
+ return (-1);
+ }
+ cb->postfix[0] = '\0';
+ }
+
if (cb->postfix == NULL) {
if ((cb->postfix = malloc((int)sizeof(char))) == NULL)
{
- ERROR ("Unable to allocate memory for normalized hostname buffer");
+ ERROR ("Unable to allocate memory for hostname postfix buffer");
return (-1);
}
cb->postfix[0] = '\0';