2 * collectd - src/utils_threshold.c
3 * Copyright (C) 2007-2009 Florian octo Forster
4 * Copyright (C) 2008-2009 Sebastian Harl
5 * Copyright (C) 2009 Andrés J. Díaz
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; only version 2 of the License is applicable.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * Florian octo Forster <octo at verplant.org>
23 * Sebastian Harl <sh at tokkee.org>
24 * Andrés J. Díaz <ajdiaz at connectical.com>
30 #include "utils_avltree.h"
31 #include "utils_cache.h"
32 #include "utils_threshold.h"
38 * Private data structures
40 #define UT_FLAG_INVERT 0x01
41 #define UT_FLAG_PERSIST 0x02
42 #define UT_FLAG_PERCENTAGE 0x04
43 #define UT_FLAG_INTERESTING 0x08
47 * Private (static) variables
49 static c_avl_tree_t *threshold_tree = NULL;
50 static pthread_mutex_t threshold_lock = PTHREAD_MUTEX_INITIALIZER;
54 * Threshold management
55 * ====================
56 * The following functions add, delete, search, etc. configured thresholds to
57 * the underlying AVL trees.
59 static threshold_t *threshold_get (const char *hostname,
60 const char *plugin, const char *plugin_instance,
61 const char *type, const char *type_instance)
63 char name[6 * DATA_MAX_NAME_LEN];
64 threshold_t *th = NULL;
66 format_name (name, sizeof (name),
67 (hostname == NULL) ? "" : hostname,
68 (plugin == NULL) ? "" : plugin, plugin_instance,
69 (type == NULL) ? "" : type, type_instance);
70 name[sizeof (name) - 1] = '\0';
72 if (c_avl_get (threshold_tree, name, (void *) &th) == 0)
76 } /* threshold_t *threshold_get */
78 static int ut_threshold_add (const threshold_t *th)
80 char name[6 * DATA_MAX_NAME_LEN];
86 if (format_name (name, sizeof (name), th->host,
87 th->plugin, th->plugin_instance,
88 th->type, th->type_instance) != 0)
90 ERROR ("ut_threshold_add: format_name failed.");
94 name_copy = strdup (name);
95 if (name_copy == NULL)
97 ERROR ("ut_threshold_add: strdup failed.");
101 th_copy = (threshold_t *) malloc (sizeof (threshold_t));
105 ERROR ("ut_threshold_add: malloc failed.");
108 memcpy (th_copy, th, sizeof (threshold_t));
111 DEBUG ("ut_threshold_add: Adding entry `%s'", name);
113 pthread_mutex_lock (&threshold_lock);
115 th_ptr = threshold_get (th->host, th->plugin, th->plugin_instance,
116 th->type, th->type_instance);
118 while ((th_ptr != NULL) && (th_ptr->next != NULL))
119 th_ptr = th_ptr->next;
121 if (th_ptr == NULL) /* no such threshold yet */
123 status = c_avl_insert (threshold_tree, name_copy, th_copy);
125 else /* th_ptr points to the last threshold in the list */
127 th_ptr->next = th_copy;
128 /* name_copy isn't needed */
132 pthread_mutex_unlock (&threshold_lock);
136 ERROR ("ut_threshold_add: c_avl_insert (%s) failed.", name);
142 } /* int ut_threshold_add */
144 * End of the threshold management functions
150 * The following approximately two hundred functions are used to handle the
151 * configuration and fill the threshold list.
153 static int ut_config_type_datasource (threshold_t *th, oconfig_item_t *ci)
155 if ((ci->values_num != 1)
156 || (ci->values[0].type != OCONFIG_TYPE_STRING))
158 WARNING ("threshold values: The `DataSource' option needs exactly one "
163 sstrncpy (th->data_source, ci->values[0].value.string,
164 sizeof (th->data_source));
167 } /* int ut_config_type_datasource */
169 static int ut_config_type_instance (threshold_t *th, oconfig_item_t *ci)
171 if ((ci->values_num != 1)
172 || (ci->values[0].type != OCONFIG_TYPE_STRING))
174 WARNING ("threshold values: The `Instance' option needs exactly one "
179 sstrncpy (th->type_instance, ci->values[0].value.string,
180 sizeof (th->type_instance));
183 } /* int ut_config_type_instance */
185 static int ut_config_type_max (threshold_t *th, oconfig_item_t *ci)
187 if ((ci->values_num != 1)
188 || (ci->values[0].type != OCONFIG_TYPE_NUMBER))
190 WARNING ("threshold values: The `%s' option needs exactly one "
191 "number argument.", ci->key);
195 if (strcasecmp (ci->key, "WarningMax") == 0)
196 th->warning_max = ci->values[0].value.number;
198 th->failure_max = ci->values[0].value.number;
201 } /* int ut_config_type_max */
203 static int ut_config_type_min (threshold_t *th, oconfig_item_t *ci)
205 if ((ci->values_num != 1)
206 || (ci->values[0].type != OCONFIG_TYPE_NUMBER))
208 WARNING ("threshold values: The `%s' option needs exactly one "
209 "number argument.", ci->key);
213 if (strcasecmp (ci->key, "WarningMin") == 0)
214 th->warning_min = ci->values[0].value.number;
216 th->failure_min = ci->values[0].value.number;
219 } /* int ut_config_type_min */
221 static int ut_config_type_hits (threshold_t *th, oconfig_item_t *ci)
223 if ((ci->values_num != 1)
224 || (ci->values[0].type != OCONFIG_TYPE_NUMBER))
226 WARNING ("threshold values: The `%s' option needs exactly one "
227 "number argument.", ci->key);
231 th->hits = ci->values[0].value.number;
234 } /* int ut_config_type_hits */
236 static int ut_config_type_hysteresis (threshold_t *th, oconfig_item_t *ci)
238 if ((ci->values_num != 1)
239 || (ci->values[0].type != OCONFIG_TYPE_NUMBER))
241 WARNING ("threshold values: The `%s' option needs exactly one "
242 "number argument.", ci->key);
246 th->hysteresis = ci->values[0].value.number;
249 } /* int ut_config_type_hysteresis */
251 static int ut_config_type (const threshold_t *th_orig, oconfig_item_t *ci)
257 if ((ci->values_num != 1)
258 || (ci->values[0].type != OCONFIG_TYPE_STRING))
260 WARNING ("threshold values: The `Type' block needs exactly one string "
265 if (ci->children_num < 1)
267 WARNING ("threshold values: The `Type' block needs at least one option.");
271 memcpy (&th, th_orig, sizeof (th));
272 sstrncpy (th.type, ci->values[0].value.string, sizeof (th.type));
274 th.warning_min = NAN;
275 th.warning_max = NAN;
276 th.failure_min = NAN;
277 th.failure_max = NAN;
280 th.flags = UT_FLAG_INTERESTING; /* interesting by default */
282 for (i = 0; i < ci->children_num; i++)
284 oconfig_item_t *option = ci->children + i;
287 if (strcasecmp ("Instance", option->key) == 0)
288 status = ut_config_type_instance (&th, option);
289 else if (strcasecmp ("DataSource", option->key) == 0)
290 status = ut_config_type_datasource (&th, option);
291 else if ((strcasecmp ("WarningMax", option->key) == 0)
292 || (strcasecmp ("FailureMax", option->key) == 0))
293 status = ut_config_type_max (&th, option);
294 else if ((strcasecmp ("WarningMin", option->key) == 0)
295 || (strcasecmp ("FailureMin", option->key) == 0))
296 status = ut_config_type_min (&th, option);
297 else if (strcasecmp ("Interesting", option->key) == 0)
298 status = cf_util_get_flag (option, &th.flags, UT_FLAG_INTERESTING);
299 else if (strcasecmp ("Invert", option->key) == 0)
300 status = cf_util_get_flag (option, &th.flags, UT_FLAG_INVERT);
301 else if (strcasecmp ("Persist", option->key) == 0)
302 status = cf_util_get_flag (option, &th.flags, UT_FLAG_PERSIST);
303 else if (strcasecmp ("Percentage", option->key) == 0)
304 status = cf_util_get_flag (option, &th.flags, UT_FLAG_PERCENTAGE);
305 else if (strcasecmp ("Hits", option->key) == 0)
306 status = ut_config_type_hits (&th, option);
307 else if (strcasecmp ("Hysteresis", option->key) == 0)
308 status = ut_config_type_hysteresis (&th, option);
311 WARNING ("threshold values: Option `%s' not allowed inside a `Type' "
312 "block.", option->key);
322 status = ut_threshold_add (&th);
326 } /* int ut_config_type */
328 static int ut_config_plugin_instance (threshold_t *th, oconfig_item_t *ci)
330 if ((ci->values_num != 1)
331 || (ci->values[0].type != OCONFIG_TYPE_STRING))
333 WARNING ("threshold values: The `Instance' option needs exactly one "
338 sstrncpy (th->plugin_instance, ci->values[0].value.string,
339 sizeof (th->plugin_instance));
342 } /* int ut_config_plugin_instance */
344 static int ut_config_plugin (const threshold_t *th_orig, oconfig_item_t *ci)
350 if ((ci->values_num != 1)
351 || (ci->values[0].type != OCONFIG_TYPE_STRING))
353 WARNING ("threshold values: The `Plugin' block needs exactly one string "
358 if (ci->children_num < 1)
360 WARNING ("threshold values: The `Plugin' block needs at least one nested "
365 memcpy (&th, th_orig, sizeof (th));
366 sstrncpy (th.plugin, ci->values[0].value.string, sizeof (th.plugin));
368 for (i = 0; i < ci->children_num; i++)
370 oconfig_item_t *option = ci->children + i;
373 if (strcasecmp ("Type", option->key) == 0)
374 status = ut_config_type (&th, option);
375 else if (strcasecmp ("Instance", option->key) == 0)
376 status = ut_config_plugin_instance (&th, option);
379 WARNING ("threshold values: Option `%s' not allowed inside a `Plugin' "
380 "block.", option->key);
389 } /* int ut_config_plugin */
391 static int ut_config_host (const threshold_t *th_orig, oconfig_item_t *ci)
397 if ((ci->values_num != 1)
398 || (ci->values[0].type != OCONFIG_TYPE_STRING))
400 WARNING ("threshold values: The `Host' block needs exactly one string "
405 if (ci->children_num < 1)
407 WARNING ("threshold values: The `Host' block needs at least one nested "
412 memcpy (&th, th_orig, sizeof (th));
413 sstrncpy (th.host, ci->values[0].value.string, sizeof (th.host));
415 for (i = 0; i < ci->children_num; i++)
417 oconfig_item_t *option = ci->children + i;
420 if (strcasecmp ("Type", option->key) == 0)
421 status = ut_config_type (&th, option);
422 else if (strcasecmp ("Plugin", option->key) == 0)
423 status = ut_config_plugin (&th, option);
426 WARNING ("threshold values: Option `%s' not allowed inside a `Host' "
427 "block.", option->key);
436 } /* int ut_config_host */
438 int ut_config (const oconfig_item_t *ci)
445 if (ci->values_num != 0)
447 ERROR ("threshold values: The `Threshold' block may not have any "
452 if (threshold_tree == NULL)
454 threshold_tree = c_avl_create ((void *) strcmp);
455 if (threshold_tree == NULL)
457 ERROR ("ut_config: c_avl_create failed.");
462 memset (&th, '\0', sizeof (th));
463 th.warning_min = NAN;
464 th.warning_max = NAN;
465 th.failure_min = NAN;
466 th.failure_max = NAN;
470 th.flags = UT_FLAG_INTERESTING; /* interesting by default */
472 for (i = 0; i < ci->children_num; i++)
474 oconfig_item_t *option = ci->children + i;
477 if (strcasecmp ("Type", option->key) == 0)
478 status = ut_config_type (&th, option);
479 else if (strcasecmp ("Plugin", option->key) == 0)
480 status = ut_config_plugin (&th, option);
481 else if (strcasecmp ("Host", option->key) == 0)
482 status = ut_config_host (&th, option);
485 WARNING ("threshold values: Option `%s' not allowed here.", option->key);
494 } /* int um_config */
496 * End of the functions used to configure threshold values.
500 static threshold_t *threshold_search (const value_list_t *vl)
504 if ((th = threshold_get (vl->host, vl->plugin, vl->plugin_instance,
505 vl->type, vl->type_instance)) != NULL)
507 else if ((th = threshold_get (vl->host, vl->plugin, vl->plugin_instance,
508 vl->type, NULL)) != NULL)
510 else if ((th = threshold_get (vl->host, vl->plugin, NULL,
511 vl->type, vl->type_instance)) != NULL)
513 else if ((th = threshold_get (vl->host, vl->plugin, NULL,
514 vl->type, NULL)) != NULL)
516 else if ((th = threshold_get (vl->host, "", NULL,
517 vl->type, vl->type_instance)) != NULL)
519 else if ((th = threshold_get (vl->host, "", NULL,
520 vl->type, NULL)) != NULL)
522 else if ((th = threshold_get ("", vl->plugin, vl->plugin_instance,
523 vl->type, vl->type_instance)) != NULL)
525 else if ((th = threshold_get ("", vl->plugin, vl->plugin_instance,
526 vl->type, NULL)) != NULL)
528 else if ((th = threshold_get ("", vl->plugin, NULL,
529 vl->type, vl->type_instance)) != NULL)
531 else if ((th = threshold_get ("", vl->plugin, NULL,
532 vl->type, NULL)) != NULL)
534 else if ((th = threshold_get ("", "", NULL,
535 vl->type, vl->type_instance)) != NULL)
537 else if ((th = threshold_get ("", "", NULL,
538 vl->type, NULL)) != NULL)
542 } /* threshold_t *threshold_search */
545 * int ut_report_state
547 * Checks if the `state' differs from the old state and creates a notification
551 static int ut_report_state (const data_set_t *ds,
552 const value_list_t *vl,
553 const threshold_t *th,
554 const gauge_t *values,
566 /* Check if hits matched */
567 if ( (th->hits != 0) )
569 int hits = uc_get_hits(ds,vl);
570 /* The STATE_OKAY always reset hits, or if hits reaise the limit */
571 if ( (state == STATE_OKAY) || (hits > th->hits) )
573 DEBUG("ut_report_state: reset uc_get_hits = 0");
574 uc_set_hits(ds,vl,0); /* reset hit counter and notify */
576 DEBUG("ut_report_state: th->hits = %d, uc_get_hits = %d",th->hits,uc_get_hits(ds,vl));
577 (void) uc_inc_hits(ds,vl,1); /* increase hit counter */
580 } /* end check hits */
582 state_old = uc_get_state (ds, vl);
584 /* If the state didn't change, only report if `persistent' is specified and
585 * the state is not `okay'. */
586 if (state == state_old)
588 if ((th->flags & UT_FLAG_PERSIST) == 0)
590 else if (state == STATE_OKAY)
594 if (state != state_old)
595 uc_set_state (ds, vl, state);
597 NOTIFICATION_INIT_VL (&n, vl, ds);
600 bufsize = sizeof (n.message);
602 if (state == STATE_OKAY)
603 n.severity = NOTIF_OKAY;
604 else if (state == STATE_WARNING)
605 n.severity = NOTIF_WARNING;
607 n.severity = NOTIF_FAILURE;
611 status = ssnprintf (buf, bufsize, "Host %s, plugin %s",
612 vl->host, vl->plugin);
616 if (vl->plugin_instance[0] != '\0')
618 status = ssnprintf (buf, bufsize, " (instance %s)",
619 vl->plugin_instance);
624 status = ssnprintf (buf, bufsize, " type %s", vl->type);
628 if (vl->type_instance[0] != '\0')
630 status = ssnprintf (buf, bufsize, " (instance %s)",
636 plugin_notification_meta_add_string (&n, "DataSource",
637 ds->ds[ds_index].name);
638 plugin_notification_meta_add_double (&n, "CurrentValue", values[ds_index]);
639 plugin_notification_meta_add_double (&n, "WarningMin", th->warning_min);
640 plugin_notification_meta_add_double (&n, "WarningMax", th->warning_max);
641 plugin_notification_meta_add_double (&n, "FailureMin", th->failure_min);
642 plugin_notification_meta_add_double (&n, "FailureMax", th->failure_max);
644 /* Send an okay notification */
645 if (state == STATE_OKAY)
647 status = ssnprintf (buf, bufsize, ": All data sources are within range again.");
656 min = (state == STATE_ERROR) ? th->failure_min : th->warning_min;
657 max = (state == STATE_ERROR) ? th->failure_max : th->warning_max;
659 if (th->flags & UT_FLAG_INVERT)
661 if (!isnan (min) && !isnan (max))
663 status = ssnprintf (buf, bufsize, ": Data source \"%s\" is currently "
664 "%f. That is within the %s region of %f%s and %f%s.",
665 ds->ds[ds_index].name, values[ds_index],
666 (state == STATE_ERROR) ? "failure" : "warning",
667 min, ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "",
668 max, ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "");
672 status = ssnprintf (buf, bufsize, ": Data source \"%s\" is currently "
673 "%f. That is %s the %s threshold of %f%s.",
674 ds->ds[ds_index].name, values[ds_index],
675 isnan (min) ? "below" : "above",
676 (state == STATE_ERROR) ? "failure" : "warning",
677 isnan (min) ? max : min,
678 ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "");
681 else /* is not inverted */
683 status = ssnprintf (buf, bufsize, ": Data source \"%s\" is currently "
684 "%f. That is %s the %s threshold of %f%s.",
685 ds->ds[ds_index].name, values[ds_index],
686 (values[ds_index] < min) ? "below" : "above",
687 (state == STATE_ERROR) ? "failure" : "warning",
688 (values[ds_index] < min) ? min : max,
689 ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "");
695 plugin_dispatch_notification (&n);
697 plugin_notification_meta_free (n.meta);
699 } /* }}} int ut_report_state */
702 * int ut_check_one_data_source
704 * Checks one data source against the given threshold configuration. If the
705 * `DataSource' option is set in the threshold, and the name does NOT match,
706 * `okay' is returned. If the threshold does match, its failure and warning
707 * min and max values are checked and `failure' or `warning' is returned if
711 static int ut_check_one_data_source (const data_set_t *ds,
712 const value_list_t __attribute__((unused)) *vl,
713 const threshold_t *th,
714 const gauge_t *values,
720 int prev_state = STATE_OKAY;
722 /* check if this threshold applies to this data source */
725 ds_name = ds->ds[ds_index].name;
726 if ((th->data_source[0] != 0)
727 && (strcmp (ds_name, th->data_source) != 0))
731 if ((th->flags & UT_FLAG_INVERT) != 0)
737 /* XXX: This is an experimental code, not optimized, not fast, not reliable,
738 * and probably, do not work as you expect. Enjoy! :D */
739 if ( (th->hysteresis > 0) && ((prev_state = uc_get_state(ds,vl)) != STATE_OKAY) )
744 if ( (!isnan (th->failure_min) && ((th->failure_min + th->hysteresis) < values[ds_index])) ||
745 (!isnan (th->failure_max) && ((th->failure_max - th->hysteresis) > values[ds_index])) )
750 if ( (!isnan (th->warning_min) && ((th->warning_min + th->hysteresis) < values[ds_index])) ||
751 (!isnan (th->warning_max) && ((th->warning_max - th->hysteresis) > values[ds_index])) )
757 else { /* no hysteresis */
758 if ((!isnan (th->failure_min) && (th->failure_min > values[ds_index]))
759 || (!isnan (th->failure_max) && (th->failure_max < values[ds_index])))
762 if ((!isnan (th->warning_min) && (th->warning_min > values[ds_index]))
763 || (!isnan (th->warning_max) && (th->warning_max < values[ds_index])))
768 return (STATE_ERROR);
771 return (STATE_WARNING);
774 } /* }}} int ut_check_one_data_source */
777 * int ut_check_one_threshold
779 * Checks all data sources of a value list against the given threshold, using
780 * the ut_check_one_data_source function above. Returns the worst status,
781 * which is `okay' if nothing has failed.
782 * Returns less than zero if the data set doesn't have any data sources.
784 static int ut_check_one_threshold (const data_set_t *ds,
785 const value_list_t *vl,
786 const threshold_t *th,
787 const gauge_t *values,
793 gauge_t values_copy[ds->ds_num];
795 memcpy (values_copy, values, sizeof (values_copy));
797 if ((th->flags & UT_FLAG_PERCENTAGE) != 0)
804 WARNING ("ut_check_one_threshold: The %s type has only one data "
805 "source, but you have configured to check this as a percentage. "
806 "That doesn't make much sense, because the percentage will always "
807 "be 100%%!", ds->type);
810 /* Prepare `sum' and `num'. */
811 for (i = 0; i < ds->ds_num; i++)
812 if (!isnan (values[i]))
818 if ((num == 0) /* All data sources are undefined. */
819 || (sum == 0.0)) /* Sum is zero, cannot calculate percentage. */
821 for (i = 0; i < ds->ds_num; i++)
822 values_copy[i] = NAN;
824 else /* We can actually calculate the percentage. */
826 for (i = 0; i < ds->ds_num; i++)
827 values_copy[i] = 100.0 * values[i] / sum;
829 } /* if (UT_FLAG_PERCENTAGE) */
831 for (i = 0; i < ds->ds_num; i++)
835 status = ut_check_one_data_source (ds, vl, th, values_copy, i);
841 } /* for (ds->ds_num) */
843 if (ret_ds_index != NULL)
844 *ret_ds_index = ds_index;
847 } /* }}} int ut_check_one_threshold */
850 * int ut_check_threshold (PUBLIC)
852 * Gets a list of matching thresholds and searches for the worst status by one
853 * of the thresholds. Then reports that status using the ut_report_state
855 * Returns zero on success and if no threshold has been configured. Returns
856 * less than zero on failure.
858 int ut_check_threshold (const data_set_t *ds, const value_list_t *vl)
864 int worst_state = -1;
865 threshold_t *worst_th = NULL;
866 int worst_ds_index = -1;
868 if (threshold_tree == NULL)
871 /* Is this lock really necessary? So far, thresholds are only inserted at
873 pthread_mutex_lock (&threshold_lock);
874 th = threshold_search (vl);
875 pthread_mutex_unlock (&threshold_lock);
879 DEBUG ("ut_check_threshold: Found matching threshold(s)");
881 values = uc_get_rate (ds, vl);
889 status = ut_check_one_threshold (ds, vl, th, values, &ds_index);
892 ERROR ("ut_check_threshold: ut_check_one_threshold failed.");
897 if (worst_state < status)
899 worst_state = status;
901 worst_ds_index = ds_index;
907 status = ut_report_state (ds, vl, worst_th, values,
908 worst_ds_index, worst_state);
911 ERROR ("ut_check_threshold: ut_report_state failed.");
919 } /* }}} int ut_check_threshold */
922 * int ut_check_interesting (PUBLIC)
924 * Given an identification returns
925 * 0: No threshold is defined.
926 * 1: A threshold has been found. The flag `persist' is off.
927 * 2: A threshold has been found. The flag `persist' is on.
928 * (That is, it is expected that many notifications are sent until the
929 * problem disappears.)
931 int ut_check_interesting (const char *name)
933 char *name_copy = NULL;
936 char *plugin_instance = NULL;
938 char *type_instance = NULL;
944 /* If there is no tree nothing is interesting. */
945 if (threshold_tree == NULL)
948 name_copy = strdup (name);
949 if (name_copy == NULL)
951 ERROR ("ut_check_interesting: strdup failed.");
955 status = parse_identifier (name_copy, &host,
956 &plugin, &plugin_instance, &type, &type_instance);
959 ERROR ("ut_check_interesting: parse_identifier failed.");
964 memset (&ds, '\0', sizeof (ds));
965 memset (&vl, '\0', sizeof (vl));
967 sstrncpy (vl.host, host, sizeof (vl.host));
968 sstrncpy (vl.plugin, plugin, sizeof (vl.plugin));
969 if (plugin_instance != NULL)
970 sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
971 sstrncpy (ds.type, type, sizeof (ds.type));
972 sstrncpy (vl.type, type, sizeof (vl.type));
973 if (type_instance != NULL)
974 sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
977 host = plugin = plugin_instance = type = type_instance = NULL;
979 th = threshold_search (&vl);
983 if ((th->flags & UT_FLAG_INTERESTING) == 0)
986 if ((th->flags & UT_FLAG_PERSIST) == 0)
989 } /* }}} int ut_check_interesting */
991 int ut_search_threshold (const value_list_t *vl, /* {{{ */
992 threshold_t *ret_threshold)
999 t = threshold_search (vl);
1003 memcpy (ret_threshold, t, sizeof (*ret_threshold));
1004 ret_threshold->next = NULL;
1007 } /* }}} int ut_search_threshold */
1009 /* vim: set sw=2 ts=8 sts=2 tw=78 et fdm=marker : */