diff --git a/src/utils_threshold.h b/src/utils_threshold.h
index 8aaf34c61af0175c18d3fa9f4ae3897d8b998e15..bf097fae0f2ef62bae851f1ef1b4e16298b29d54 100644 (file)
--- a/src/utils_threshold.h
+++ b/src/utils_threshold.h
/**
* collectd - src/utils_threshold.h
- * Copyright (C) 2007-2009 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
- * Free Software Foundation; only version 2 of the License is applicable.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
*
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*
- * Author:
- * Florian octo Forster <octo at verplant.org>
+ * Authors:
+ * Pierre-Yves Ritschard <pyr at spootnik.org>
**/
#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];
gauge_t failure_min;
gauge_t failure_max;
gauge_t hysteresis;
- int flags;
+ 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);
+threshold_t *threshold_get (const char *hostname,
+ const char *plugin, const char *plugin_instance,
+ const char *type, const char *type_instance);
-/*
- * 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_search (const value_list_t *vl);
-/*
- * Given an identifier in form of a `value_list_t', searches for the best
- * matching threshold configuration. `ret_threshold' may be NULL.
- *
- * Returns:
- * 0: Success. Threshold configuration has been copied to
- * `ret_threshold' (if it is non-NULL).
- * ENOENT: No configuration for this identifier found.
- * else: Error.
- */
-int ut_search_threshold (const value_list_t *vl, threshold_t *ret_threshold);
+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 : */