]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
cmds: migrate to metric_parse_identity().
authorFlorian Forster <octo@google.com>
Tue, 21 Jul 2020 17:01:08 +0000 (19:01 +0200)
committerFlorian Forster <octo@google.com>
Wed, 29 Jul 2020 11:40:54 +0000 (13:40 +0200)
src/utils/cmds/getthreshold.c

index d7a350ca2d2a3cfa78e6bc3c75096f89abb8f2c3..be12d18ba2b64ba263c67eb0e90c58af3003322e 100644 (file)
@@ -74,9 +74,8 @@ int handle_getthreshold(FILE *fh, char *buffer) {
     return -1;
   }
 
-  metric_family_t *fam =
-      metric_family_unmarshal_text(identifier, METRIC_TYPE_UNTYPED);
-  if (fam == NULL) {
+  metric_t *m = metric_parse_identity(identifier);
+  if (m == NULL) {
     print_to_socket(fh, "-1 Parsing metric identity failed: %s.\n", STRERRNO);
     return -1;
   }
@@ -84,7 +83,8 @@ int handle_getthreshold(FILE *fh, char *buffer) {
   threshold_t threshold = {
       .flags = 0,
   };
-  status = ut_search_threshold(fam->metric.ptr, &threshold);
+  status = ut_search_threshold(m, &threshold);
+  metric_family_free(m->family);
   if (status == ENOENT) {
     print_to_socket(fh, "-1 No threshold found for identifier %s\n",
                     identifier);