- if (normalize_hostname(n_hostname, hostname) == -1)
- {
- ERROR ("Unable to normalize hostname");
- return (-1);
- }
-
- if ((plugin_instance == NULL) || (strlen (plugin_instance) == 0))
- {
- if ((type_instance == NULL) || (strlen (type_instance) == 0))
- {
- if ((ds_name == NULL) || (strlen (ds_name) == 0))
- status = ssnprintf (ret, ret_len, "%s.%s.%s.%s",
- prefix, n_hostname, plugin, type);
- else
- status = ssnprintf (ret, ret_len, "%s.%s.%s.%s.%s",
- prefix, n_hostname, plugin, type, ds_name);
- }
- else
- {
- if ((ds_name == NULL) || (strlen (ds_name) == 0))
- status = ssnprintf (ret, ret_len, "%s.%s.%s.%s-%s",
- prefix, n_hostname, plugin, type,
- type_instance);
- else
- status = ssnprintf (ret, ret_len, "%s.%s.%s.%s-%s.%s",
- prefix, n_hostname, plugin, type,
- type_instance, ds_name);
- }
- }
- else
- {
- if ((type_instance == NULL) || (strlen (type_instance) == 0))
- {
- if ((ds_name == NULL) || (strlen (ds_name) == 0))
- status = ssnprintf (ret, ret_len, "%s.%s.%s.%s.%s",
- prefix, n_hostname, plugin,
- plugin_instance, type);
- else
- status = ssnprintf (ret, ret_len, "%s.%s.%s.%s.%s.%s",
- prefix, n_hostname, plugin,
- plugin_instance, type, ds_name);
- }
- else
- {
- if ((ds_name == NULL) || (strlen (ds_name) == 0))
- status = ssnprintf (ret, ret_len, "%s.%s.%s.%s.%s-%s",
- prefix, n_hostname, plugin,
- plugin_instance, type, type_instance);
- else
- status = ssnprintf (ret, ret_len, "%s.%s.%s.%s.%s-%s.%s",
- prefix, n_hostname, plugin,
- plugin_instance, type, type_instance, ds_name);
- }
- }
-
- sfree(n_hostname);
-
- if ((status < 1) || (status >= ret_len))
- return (-1);
- return (0);
-} /* }}} int wg_format_name */
-
-static int wg_send_message (const char* key, const char* value, cdtime_t time, struct wg_callback *cb) /* {{{ */