2 * collectd - src/utils_threshold.h
3 * Copyright (C) 2007-2009 Florian octo Forster
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; only version 2 of the License is applicable.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 * Florian octo Forster <octo at verplant.org>
22 #ifndef UTILS_THRESHOLD_H
23 #define UTILS_THRESHOLD_H 1
26 #include "liboconfig/oconfig.h"
29 typedef struct threshold_s
31 char host[DATA_MAX_NAME_LEN];
32 char plugin[DATA_MAX_NAME_LEN];
33 char plugin_instance[DATA_MAX_NAME_LEN];
34 char type[DATA_MAX_NAME_LEN];
35 char type_instance[DATA_MAX_NAME_LEN];
36 char data_source[DATA_MAX_NAME_LEN];
44 struct threshold_s *next;
50 * Parses the configuration and sets up the module. This is called from
53 int ut_config (const oconfig_item_t *ci);
58 * Checks if a threshold is defined for this value and if such a threshold is
59 * configured, check if the value within the acceptable range. If it is not, a
60 * notification is dispatched to inform the user that a problem exists. This is
61 * called from `plugin_read_all'.
63 int ut_check_threshold (const data_set_t *ds, const value_list_t *vl);
66 * Given an identification returns
67 * 0: No threshold is defined.
68 * 1: A threshold has been found. The flag `persist' is off.
69 * 2: A threshold has been found. The flag `persist' is on.
70 * (That is, it is expected that many notifications are sent until the
71 * problem disappears.)
73 int ut_check_interesting (const char *name);
76 * Given an identifier in form of a `value_list_t', searches for the best
77 * matching threshold configuration. `ret_threshold' may be NULL.
80 * 0: Success. Threshold configuration has been copied to
81 * `ret_threshold' (if it is non-NULL).
82 * ENOENT: No configuration for this identifier found.
85 int ut_search_threshold (const value_list_t *vl, threshold_t *ret_threshold);
87 #endif /* UTILS_THRESHOLD_H */