summaryrefslogtreecommitdiffstats
path: root/database/rrdcalc.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-07-08 20:14:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-07-08 20:14:42 +0000
commit4f88e1a9be89a257fd6ed3045703db6e900027ee (patch)
tree518eb3c3aa1dce9ea281d02e0fd3cc01a9e7913f /database/rrdcalc.h
parentAdding upstream version 1.15.0. (diff)
downloadnetdata-4f88e1a9be89a257fd6ed3045703db6e900027ee.tar.xz
netdata-4f88e1a9be89a257fd6ed3045703db6e900027ee.zip
Adding upstream version 1.16.0.upstream/1.16.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'database/rrdcalc.h')
-rw-r--r--database/rrdcalc.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/database/rrdcalc.h b/database/rrdcalc.h
index 4df4381ae..3400f711c 100644
--- a/database/rrdcalc.h
+++ b/database/rrdcalc.h
@@ -29,7 +29,9 @@
#define RRDCALC_FLAG_SILENCED 0x00000100
#define RRDCALC_FLAG_NO_CLEAR_NOTIFICATION 0x80000000
+
struct rrdcalc {
+ avl avl; // the index, with key the id - this has to be first!
uint32_t id; // the unique id of this alarm
uint32_t next_event_id; // the next event id that will be used for this alarm
@@ -78,8 +80,15 @@ struct rrdcalc {
// while now < delay_up_to
// ------------------------------------------------------------------------
+ // notification repeat settings
+
+ uint32_t warn_repeat_every; // interval between repeating warning notifications
+ uint32_t crit_repeat_every; // interval between repeating critical notifications
+
+ // ------------------------------------------------------------------------
// runtime information
+ RRDCALC_STATUS old_status; // the old status of the alarm
RRDCALC_STATUS status; // the current status of the alarm
calculated_number value; // the current value of the alarm
@@ -90,6 +99,7 @@ struct rrdcalc {
time_t last_updated; // the last update timestamp of the alarm
time_t next_update; // the next update timestamp of the alarm
time_t last_status_change; // the timestamp of the last time this alarm changed status
+ time_t last_repeat; // the last time the alarm got repeated
time_t db_after; // the first timestamp evaluated by the db lookup
time_t db_before; // the last timestamp evaluated by the db lookup
@@ -119,6 +129,10 @@ struct rrdcalc {
struct rrdcalc *next;
};
+extern int alarm_isrepeating(RRDHOST *host, uint32_t alarm_id);
+extern int alarm_entry_isrepeating(RRDHOST *host, ALARM_ENTRY *ae);
+extern RRDCALC *alarm_max_last_repeat(RRDHOST *host, char *alarm_name, uint32_t hash);
+
#define RRDCALC_HAS_DB_LOOKUP(rc) ((rc)->after)
extern void rrdsetcalc_link_matching(RRDSET *st);
@@ -132,7 +146,14 @@ extern void rrdcalc_unlink_and_free(RRDHOST *host, RRDCALC *rc);
extern int rrdcalc_exists(RRDHOST *host, const char *chart, const char *name, uint32_t hash_chart, uint32_t hash_name);
extern uint32_t rrdcalc_get_unique_id(RRDHOST *host, const char *chart, const char *name, uint32_t *next_event_id);
-extern RRDCALC *rrdcalc_create(RRDHOST *host, RRDCALCTEMPLATE *rt, const char *chart);
-extern void rrdcalc_create_part2(RRDHOST *host, RRDCALC *rc);
+extern RRDCALC *rrdcalc_create_from_template(RRDHOST *host, RRDCALCTEMPLATE *rt, const char *chart);
+extern void rrdcalc_add_to_host(RRDHOST *host, RRDCALC *rc);
+
+static inline int rrdcalc_isrepeating(RRDCALC *rc) {
+ if (unlikely(rc->warn_repeat_every > 0 || rc->crit_repeat_every > 0)) {
+ return 1;
+ }
+ return 0;
+}
#endif //NETDATA_RRDCALC_H