X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Futils_threshold.h;h=948f80708627e4b4eacc5a3152fbb97f96f3e4ac;hb=9685c388b5954800d0e4ceb741844c2682464759;hp=a42c4121cd2f93599e9acacd9e61fa0c6cbd6334;hpb=4fb5d4b471e3f6a24d7cd36272e48e57bcb2c68f;p=collectd.git diff --git a/src/utils_threshold.h b/src/utils_threshold.h index a42c4121..948f8070 100644 --- a/src/utils_threshold.h +++ b/src/utils_threshold.h @@ -1,6 +1,6 @@ /** * collectd - src/utils_threshold.h - * Copyright (C) 2007,2008 Florian octo Forster + * Copyright (C) 2014 Pierre-Yves Ritschard * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -16,42 +16,47 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * Author: - * Florian octo Forster + * Pierre-Yves Ritschard **/ #ifndef UTILS_THRESHOLD_H #define UTILS_THRESHOLD_H 1 -#include "collectd.h" -#include "liboconfig/oconfig.h" -#include "plugin.h" +#define UT_FLAG_INVERT 0x01 +#define UT_FLAG_PERSIST 0x02 +#define UT_FLAG_PERCENTAGE 0x04 +#define UT_FLAG_INTERESTING 0x08 +#define UT_FLAG_PERSIST_OK 0x10 +typedef struct threshold_s +{ + char host[DATA_MAX_NAME_LEN]; + char plugin[DATA_MAX_NAME_LEN]; + char plugin_instance[DATA_MAX_NAME_LEN]; + char type[DATA_MAX_NAME_LEN]; + char type_instance[DATA_MAX_NAME_LEN]; + char data_source[DATA_MAX_NAME_LEN]; + gauge_t warning_min; + gauge_t warning_max; + gauge_t failure_min; + gauge_t failure_max; + gauge_t hysteresis; + unsigned int flags; + int hits; + struct threshold_s *next; +} threshold_t; -/* - * ut_config - * - * Parses the configuration and sets up the module. This is called from - * `src/configfile.c'. - */ -int ut_config (const oconfig_item_t *ci); +extern c_avl_tree_t *threshold_tree; +extern pthread_mutex_t threshold_lock; -/* - * ut_check_threshold - * - * Checks if a threshold is defined for this value and if such a threshold is - * configured, check if the value within the acceptable range. If it is not, a - * notification is dispatched to inform the user that a problem exists. This is - * called from `plugin_read_all'. - */ -int ut_check_threshold (const data_set_t *ds, const value_list_t *vl); - -/* - * Given an identification returns - * 0: No threshold is defined. - * 1: A threshold has been found. The flag `persist' is off. - * 2: A threshold has been found. The flag `persist' is on. - * (That is, it is expected that many notifications are sent until the - * problem disappears.) - */ -int ut_check_interesting (const char *name); +threshold_t *threshold_get (const char *hostname, + const char *plugin, const char *plugin_instance, + const char *type, const char *type_instance); + +threshold_t *threshold_search (const value_list_t *vl); + +int ut_search_threshold (const value_list_t *vl, + threshold_t *ret_threshold); #endif /* UTILS_THRESHOLD_H */ + +/* vim: set sw=2 sts=2 ts=8 : */