summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1d3fe5e)
raw | patch | inline | side by side (parent: 1d3fe5e)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 13 Jun 2010 13:33:39 +0000 (15:33 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 13 Jun 2010 13:33:39 +0000 (15:33 +0200) |
src/utils_threshold.c | patch | blob | history | |
src/utils_threshold.h | patch | blob | history |
diff --git a/src/utils_threshold.c b/src/utils_threshold.c
index e387cbf79024deed927a0d5587df5d5ce47ea0cd..99309b93b58b46ec84512cad69b087deba146a19 100644 (file)
--- a/src/utils_threshold.c
+++ b/src/utils_threshold.c
return (0);
} /* int ut_config_type_min */
-static int ut_config_type_interesting (threshold_t *th, oconfig_item_t *ci)
-{
- if ((ci->values_num != 1)
- || (ci->values[0].type != OCONFIG_TYPE_BOOLEAN))
- {
- WARNING ("threshold values: The `Interesting' option needs exactly one "
- "boolean argument.");
- return (-1);
- }
-
- if (ci->values[0].value.boolean)
- th->flags |= UT_FLAG_INTERESTING;
- else
- th->flags &= ~UT_FLAG_INTERESTING;
-
- return (0);
-} /* int ut_config_type_interesting */
-
-static int ut_config_type_invert (threshold_t *th, oconfig_item_t *ci)
-{
- if ((ci->values_num != 1)
- || (ci->values[0].type != OCONFIG_TYPE_BOOLEAN))
- {
- WARNING ("threshold values: The `Invert' option needs exactly one "
- "boolean argument.");
- return (-1);
- }
-
- if (ci->values[0].value.boolean)
- th->flags |= UT_FLAG_INVERT;
- else
- th->flags &= ~UT_FLAG_INVERT;
-
- return (0);
-} /* int ut_config_type_invert */
-
-static int ut_config_type_persist (threshold_t *th, oconfig_item_t *ci)
-{
- if ((ci->values_num != 1)
- || (ci->values[0].type != OCONFIG_TYPE_BOOLEAN))
- {
- WARNING ("threshold values: The `Persist' option needs exactly one "
- "boolean argument.");
- return (-1);
- }
-
- if (ci->values[0].value.boolean)
- th->flags |= UT_FLAG_PERSIST;
- else
- th->flags &= ~UT_FLAG_PERSIST;
-
- return (0);
-} /* int ut_config_type_persist */
-
-static int ut_config_type_percentage(threshold_t *th, oconfig_item_t *ci)
-{
- if ((ci->values_num != 1)
- || (ci->values[0].type != OCONFIG_TYPE_BOOLEAN))
- {
- WARNING ("threshold values: The `Percentage' option needs exactly one "
- "boolean argument.");
- return (-1);
- }
-
- if (ci->values[0].value.boolean)
- th->flags |= UT_FLAG_PERCENTAGE;
- else
- th->flags &= ~UT_FLAG_PERCENTAGE;
-
- return (0);
-} /* int ut_config_type_percentage */
-
static int ut_config_type_hits (threshold_t *th, oconfig_item_t *ci)
{
if ((ci->values_num != 1)
|| (strcasecmp ("FailureMin", option->key) == 0))
status = ut_config_type_min (&th, option);
else if (strcasecmp ("Interesting", option->key) == 0)
- status = ut_config_type_interesting (&th, option);
+ status = cf_util_get_flag (option, &th.flags, UT_FLAG_INTERESTING);
else if (strcasecmp ("Invert", option->key) == 0)
- status = ut_config_type_invert (&th, option);
+ status = cf_util_get_flag (option, &th.flags, UT_FLAG_INVERT);
else if (strcasecmp ("Persist", option->key) == 0)
- status = ut_config_type_persist (&th, option);
+ status = cf_util_get_flag (option, &th.flags, UT_FLAG_PERSIST);
else if (strcasecmp ("Percentage", option->key) == 0)
- status = ut_config_type_percentage (&th, option);
+ status = cf_util_get_flag (option, &th.flags, UT_FLAG_PERCENTAGE);
else if (strcasecmp ("Hits", option->key) == 0)
status = ut_config_type_hits (&th, option);
else if (strcasecmp ("Hysteresis", option->key) == 0)
diff --git a/src/utils_threshold.h b/src/utils_threshold.h
index 8aaf34c61af0175c18d3fa9f4ae3897d8b998e15..5955ca6ed79db1a124c33a46ea56e0f1e53e4860 100644 (file)
--- a/src/utils_threshold.h
+++ b/src/utils_threshold.h
gauge_t failure_min;
gauge_t failure_max;
gauge_t hysteresis;
- int flags;
+ unsigned int flags;
int hits;
struct threshold_s *next;
} threshold_t;