75 g_hash_table_destroy(entry->
envvars);
115 crm_trace(
"Inserting alert key %s = '%s'",
132#define READABLE_DEFAULT pcmk__readable_interval(PCMK__ALERT_DEFAULT_TIMEOUT_MS)
146unpack_alert_options(xmlNode *xml,
pcmk__alert_t *entry, guint *max_timeout)
150 const char *value = NULL;
172 entry->
timeout = (int) QB_MIN(timeout_ms, INT_MAX);
175 crm_trace(
"Alert %s uses default timeout (%s)",
179 "because '%s' is not a valid timeout",
187 if (entry->
timeout > *max_timeout) {
197 crm_trace(
"Alert %s uses timestamp format '%s'",
202 g_hash_table_destroy(config_hash);
215unpack_alert_parameters(
const xmlNode *xml,
pcmk__alert_t *entry)
219 if ((xml == NULL) || (entry == NULL)) {
243 crm_trace(
"Alert %s: added environment variable %s='%s'",
260 xmlNode *event_type = NULL;
264 event_type != NULL; event_type =
pcmk__xe_next(event_type, NULL)) {
277 const char *attr_name;
293 (nattrs + 1) *
sizeof(
char*));
303 crm_debug(
"Alert %s receives events: attributes:%s%s%s%s",
324unpack_alert(xmlNode *alert,
pcmk__alert_t *entry, guint *max_timeout)
328 unpack_alert_parameters(alert, entry);
329 rc = unpack_alert_options(alert, entry, max_timeout);
331 unpack_alert_filter(alert, entry);
349 guint max_timeout = 0U;
350 GList *alert_list = NULL;
355 xmlNode *recipient = NULL;
357 const char *alert_id = pcmk__xe_id(alert);
361 if (alert_id == NULL) {
365 if (alert_path == NULL) {
373 if (unpack_alert(alert, entry, &max_timeout) !=
pcmk_rc_ok) {
385 crm_debug(
"Alert %s: path=%s timeout=%s tstamp-format='%s'",
401 if (unpack_alert(recipient, recipient_entry,
403 crm_debug(
"Alert %s: recipient %s is disabled",
404 entry->
id, recipient_entry->
id);
408 alert_list = g_list_prepend(alert_list, recipient_entry);
409 crm_debug(
"Alert %s has recipient %s with value %s and %d envvars",
410 entry->
id, pcmk__xe_id(recipient),
413 g_hash_table_size(recipient_entry->
envvars) : 0));
416 if (recipients == 0) {
417 alert_list = g_list_prepend(alert_list, entry);
434 if (alert_list != NULL) {
GList * pcmk__unpack_alerts(const xmlNode *alerts)
void pcmk__free_alert(pcmk__alert_t *entry)
pcmk__alert_t * pcmk__alert_new(const char *id, const char *path)
Create a new alert entry structure.
pcmk__alert_t * pcmk__dup_alert(const pcmk__alert_t *entry)
const char * pcmk__alert_keys[PCMK__ALERT_INTERNAL_KEY_MAX]
void pcmk__free_alerts(GList *alert_list)
void pcmk__add_alert_key_int(GHashTable *table, enum pcmk__alert_keys_e name, int value)
void pcmk__add_alert_key(GHashTable *table, enum pcmk__alert_keys_e name, const char *value)
#define PCMK__ALERT_DEFAULT_TSTAMP_FORMAT
#define PCMK__ALERT_NODE_SEQUENCE
@ PCMK__alert_key_timestamp_epoch
@ PCMK__alert_key_interval
@ PCMK__alert_key_timestamp
@ PCMK__alert_key_attribute_name
@ PCMK__alert_key_target_rc
@ PCMK__alert_key_timestamp_usec
@ PCMK__alert_key_node_sequence
@ PCMK__alert_key_recipient
@ PCMK__alert_key_exec_time
@ PCMK__alert_key_version
@ PCMK__alert_key_attribute_value
#define PCMK__ALERT_DEFAULT_TIMEOUT_MS
#define PCMK__ALERT_INTERNAL_KEY_MAX
#define pcmk__assert_alloc(nmemb, size)
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
void crm_time_free(crm_time_t *dt)
crm_time_t * crm_time_new(const char *string)
struct crm_time_s crm_time_t
const char * pcmk__readable_interval(guint interval_ms)
#define crm_debug(fmt, args...)
#define crm_trace(fmt, args...)
#define pcmk__config_warn(fmt...)
#define pcmk__config_err(fmt...)
void pcmk_unpack_nvpair_blocks(const xmlNode *xml, const char *element_name, const char *first_id, const pcmk_rule_input_t *rule_input, GHashTable *values, crm_time_t *next_change)
Unpack nvpair blocks contained by an XML element into a hash table, evaluated for any rules.
#define PCMK_META_TIMESTAMP_FORMAT
#define PCMK_META_ENABLED
#define PCMK_META_TIMEOUT
#define pcmk__assert(expr)
long long crm_get_msec(const char *input)
Parse a time+units string and return milliseconds equivalent.
gboolean crm_is_true(const char *s)
GHashTable * pcmk__str_table_dup(GHashTable *old_table)
void pcmk__insert_dup(GHashTable *table, const char *name, const char *value)
GHashTable * pcmk__strkey_table(GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
#define pcmk__str_copy(str)
char ** select_attribute_name
Wrappers for and extensions to libxml2.
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
char * crm_element_value_copy(const xmlNode *data, const char *name)
Retrieve a copy of the value of an XML attribute.
xmlNode * pcmk__xe_first_child(const xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v)
xmlNode * pcmk__xe_next(const xmlNode *node, const char *element_name)
#define PCMK_XE_SELECT_RESOURCES
#define PCMK_XE_SELECT_NODES
#define PCMK_XE_RECIPIENT
#define PCMK_XE_ATTRIBUTE
#define PCMK_XE_INSTANCE_ATTRIBUTES
#define PCMK_XE_META_ATTRIBUTES
#define PCMK_XE_SELECT_FENCING
#define PCMK_XE_SELECT_ATTRIBUTES