X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fwrite_tsdb.c;h=9008a67bf921b97a39525f16121d64916dcc212c;hb=27894a14bcc5437d1e9131ea602c66c0e28fd9d1;hp=bfac1a140d4020c065f7b473e5a19dc72013ad90;hpb=42e4d6cd43374ac5e954a02408e7e79734c90f90;p=collectd.git diff --git a/src/write_tsdb.c b/src/write_tsdb.c index bfac1a14..9008a67b 100644 --- a/src/write_tsdb.c +++ b/src/write_tsdb.c @@ -366,37 +366,40 @@ static int wt_format_name(char *ret, int ret_len, if (ds_name != NULL) { if (vl->plugin_instance[0] == '\0') { if (vl->type_instance[0] == '\0') { - ssnprintf(ret, ret_len, "%s%s.%s.%s", - prefix, vl->plugin, vl->type, - ds_name); + ssnprintf(ret, ret_len, "%s%s.%s.%s", prefix, vl->plugin, + vl->type, ds_name); } else { - ssnprintf(ret, ret_len, "%s%s.%s.%s", - prefix, vl->plugin, vl->type_instance, - ds_name); + ssnprintf(ret, ret_len, "%s%s.%s.%s.%s", prefix, vl->plugin, + vl->type, vl->type_instance, ds_name); + } + } else { /* vl->plugin_instance != "" */ + if (vl->type_instance[0] == '\0') { + ssnprintf(ret, ret_len, "%s%s.%s.%s.%s", prefix, vl->plugin, + vl->plugin_instance, vl->type, ds_name); + } else { + ssnprintf(ret, ret_len, "%s%s.%s.%s.%s.%s", prefix, + vl->plugin, vl->plugin_instance, vl->type, + vl->type_instance, ds_name); } - } else if (vl->type_instance[0] == '\0') { - ssnprintf(ret, ret_len, "%s%s.%s.%s.%s", - prefix, vl->plugin, vl->plugin_instance, vl->type, - ds_name); - } else { - ssnprintf(ret, ret_len, "%s%s.%s.%s.%s.%s", - prefix, vl->plugin, vl->plugin_instance, vl->type, - vl->type_instance, ds_name); } - } else if (vl->plugin_instance[0] == '\0') { - if (vl->type_instance[0] == '\0') { - ssnprintf(ret, ret_len, "%s%s.%s", - prefix, vl->plugin, vl->type); - } else { - ssnprintf(ret, ret_len, "%s%s.%s", - prefix, vl->plugin, vl->type_instance); + } else { /* ds_name == NULL */ + if (vl->plugin_instance[0] == '\0') { + if (vl->type_instance[0] == '\0') { + ssnprintf(ret, ret_len, "%s%s.%s", prefix, vl->plugin, + vl->type); + } else { + ssnprintf(ret, ret_len, "%s%s.%s.%s", prefix, vl->plugin, + vl->type_instance, vl->type); + } + } else { /* vl->plugin_instance != "" */ + if (vl->type_instance[0] == '\0') { + ssnprintf(ret, ret_len, "%s%s.%s.%s", prefix, vl->plugin, + vl->plugin_instance, vl->type); + } else { + ssnprintf(ret, ret_len, "%s%s.%s.%s.%s", prefix, vl->plugin, + vl->plugin_instance, vl->type, vl->type_instance); + } } - } else if (vl->type_instance[0] == '\0') { - ssnprintf(ret, ret_len, "%s%s.%s.%s", - prefix, vl->plugin, vl->plugin_instance, vl->type); - } else { - ssnprintf(ret, ret_len, "%s%s.%s.%s.%s", - prefix, vl->plugin, vl->plugin_instance, vl->type, vl->type_instance); } sfree(temp);