29 get_meta_attrs_from_cib(xmlNode *basenode,
pcmk__alert_t *entry,
34 const char *value = NULL;
38 config_hash, NULL, FALSE, now, NULL);
52 entry->
timeout = (int) QB_MIN(timeout_ms, INT_MAX);
55 crm_trace(
"Alert %s uses default timeout of %dmsec",
59 "using default (%d ms)",
65 crm_trace(
"Alert %s uses timeout of %dmsec",
68 if (entry->
timeout > *max_timeout) {
78 crm_trace(
"Alert %s uses timestamp format '%s'",
83 g_hash_table_destroy(config_hash);
92 if ((basenode == NULL) || (entry == NULL)) {
116 crm_trace(
"Alert %s: added environment variable %s='%s'",
126 xmlNode *event_type = NULL;
130 event_type != NULL; event_type = pcmk__xe_next(event_type)) {
143 const char *attr_name;
159 (nattrs + 1) *
sizeof(
char*));
169 crm_debug(
"Alert %s receives events: attributes:%s%s%s%s",
190 unpack_alert(xmlNode *alert,
pcmk__alert_t *entry, guint *max_timeout)
194 get_envvars_from_cib(alert, entry);
195 rc = get_meta_attrs_from_cib(alert, entry, max_timeout);
197 unpack_alert_filter(alert, entry);
218 guint max_timeout = 0;
219 GList *alert_list = NULL;
221 if (alerts == NULL) {
230 const char *alert_id = pcmk__xe_id(alert);
234 if (alert_id == NULL) {
239 if (alert_path == NULL) {
246 if (unpack_alert(alert, entry, &max_timeout) !=
pcmk_rc_ok) {
257 crm_debug(
"Alert %s: path=%s timeout=%dms tstamp-format='%s' %u vars",
271 if (unpack_alert(recipient, recipient_entry,
273 crm_debug(
"Alert %s: recipient %s is disabled",
274 entry->
id, recipient_entry->
id);
278 alert_list = g_list_prepend(alert_list, recipient_entry);
279 crm_debug(
"Alert %s has recipient %s with value %s and %d envvars",
280 entry->
id, pcmk__xe_id(recipient),
283 g_hash_table_size(recipient_entry->
envvars) : 0));
286 if (recipients == 0) {
287 alert_list = g_list_prepend(alert_list, entry);
struct crm_time_s crm_time_t
#define pcmk__config_warn(fmt...)
void pe_unpack_nvpairs(xmlNode *top, const xmlNode *xml_obj, const char *set_name, GHashTable *node_hash, GHashTable *hash, const char *always_first, gboolean overwrite, crm_time_t *now, crm_time_t *next_change)
Extract nvpair blocks contained by an XML element into a hash table.
#define PCMK_XE_RECIPIENT
char ** select_attribute_name
long long crm_get_msec(const char *input)
Parse a time+units string and return milliseconds equivalent.
#define PCMK_XE_SELECT_FENCING
#define PCMK_XE_ATTRIBUTE
void pcmk__free_alert(pcmk__alert_t *entry)
#define PCMK_META_TIMESTAMP_FORMAT
#define crm_debug(fmt, args...)
char * crm_element_value_copy(const xmlNode *data, const char *name)
Retrieve a copy of the value of an XML attribute.
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve 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)
pcmk__alert_t * pcmk__dup_alert(const pcmk__alert_t *entry)
#define crm_trace(fmt, args...)
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
Wrappers for and extensions to libxml2.
#define PCMK_META_ENABLED
#define PCMK_META_TIMEOUT
#define PCMK_XE_SELECT_NODES
#define PCMK_XE_META_ATTRIBUTES
GList * pe_unpack_alerts(const xmlNode *alerts)
GHashTable * pcmk__strkey_table(GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
crm_time_t * crm_time_new(const char *string)
#define PCMK_XE_SELECT_ATTRIBUTES
#define crm_log_xml_info(xml, text)
void pe_free_alert_list(GList *alert_list)
#define PCMK_XE_SELECT_RESOURCES
pcmk__alert_t * pcmk__alert_new(const char *id, const char *path)
Create a new alert entry structure.
gboolean crm_is_true(const char *s)
#define PCMK__ALERT_DEFAULT_TSTAMP_FORMAT
#define PCMK_XE_INSTANCE_ATTRIBUTES
xmlNode * pcmk__xe_next_same(const xmlNode *node)
#define PCMK__ALERT_DEFAULT_TIMEOUT_MS
void pcmk__insert_dup(GHashTable *table, const char *name, const char *value)
void crm_time_free(crm_time_t *dt)