19 GHashTable *config_hash = crm_str_table_new();
21 const char *value = NULL;
24 config_hash, NULL, FALSE, now);
32 crm_trace(
"Alert %s uses default timeout of %dmsec",
35 crm_warn(
"Alert %s has invalid timeout value '%s', using default %dmsec",
40 crm_trace(
"Alert %s uses timeout of %dmsec",
43 if (entry->
timeout > *max_timeout) {
53 crm_trace(
"Alert %s uses timestamp format '%s'",
57 g_hash_table_destroy(config_hash);
65 if ((basenode == NULL) || (entry == NULL)) {
75 entry->
envvars = crm_str_table_new();
87 g_hash_table_insert(entry->
envvars, strdup(name), strdup(value));
88 crm_trace(
"Alert %s: added environment variable %s='%s'",
89 entry->
id, name, value);
97 xmlNode *event_type = NULL;
100 for (event_type = __xml_first_child(select); event_type != NULL;
101 event_type = __xml_next(event_type)) {
103 const char *tagname = crm_element_name(event_type);
105 if (tagname == NULL) {
119 const char *attr_name;
135 (nattrs + 1) *
sizeof(
char*));
145 crm_debug(
"Alert %s receives events: attributes:%s, fencing:%s, nodes:%s, resources:%s",
158 get_envvars_from_cib(alert, entry);
159 get_meta_attrs_from_cib(alert, entry, max_timeout);
160 unpack_alert_filter(alert, entry);
179 guint max_timeout = 0;
182 if (alerts == NULL) {
191 const char *alert_id =
ID(alert);
195 if ((alert_id == NULL) || (alert_path == NULL)) {
196 crm_warn(
"Ignoring invalid alert without id and path");
202 unpack_alert(alert, entry, &max_timeout);
208 crm_debug(
"Alert %s: path=%s timeout=%dms tstamp-format='%s' %u vars",
220 unpack_alert(recipient, recipient_entry, &max_timeout);
221 alert_list = g_list_prepend(alert_list, recipient_entry);
222 crm_debug(
"Alert %s has recipient %s with value %s and %d envvars",
225 g_hash_table_size(recipient_entry->
envvars) : 0));
228 if (recipients == 0) {
229 alert_list = g_list_prepend(alert_list, entry);
#define CRM_ALERT_DEFAULT_TSTAMP_FORMAT
void pe_free_alert_list(GListPtr alert_list)
struct crm_time_s crm_time_t
#define CRM_ALERT_DEFAULT_TIMEOUT_MS
xmlNode * first_named_child(const xmlNode *parent, const char *name)
#define XML_CIB_TAG_ALERT_RESOURCES
long long crm_get_msec(const char *input)
#define XML_NVPAIR_ATTR_NAME
#define XML_CIB_TAG_ALERT_ATTRIBUTES
#define XML_CIB_TAG_NVPAIR
#define XML_ALERT_ATTR_REC_VALUE
crm_alert_entry_t * crm_dup_alert_entry(crm_alert_entry_t *entry)
GListPtr pe_unpack_alerts(xmlNode *alerts)
#define XML_TAG_ATTR_SETS
#define crm_warn(fmt, args...)
#define crm_debug(fmt, args...)
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
#define XML_CIB_TAG_ALERT_NODES
#define crm_trace(fmt, args...)
#define XML_TAG_META_SETS
#define XML_ALERT_ATTR_TIMEOUT
#define XML_ALERT_ATTR_TSTAMP_FORMAT
#define XML_CIB_TAG_ALERT
crm_time_t * crm_time_new(const char *string)
crm_alert_entry_t * crm_alert_entry_new(const char *id, const char *path)
Create a new alert entry structure.
char ** select_attribute_name
#define XML_CIB_TAG_ALERT_FENCING
#define XML_NVPAIR_ATTR_VALUE
void unpack_instance_attributes(xmlNode *top, xmlNode *xml_obj, const char *set_name, GHashTable *node_hash, GHashTable *hash, const char *always_first, gboolean overwrite, crm_time_t *now)
#define XML_CIB_TAG_ALERT_SELECT
#define XML_ALERT_ATTR_PATH
#define XML_CIB_TAG_ALERT_ATTR
#define XML_CIB_TAG_ALERT_RECIPIENT
void crm_free_alert_entry(crm_alert_entry_t *entry)
xmlNode * crm_next_same_xml(const xmlNode *sibling)
Get next instance of same XML tag.
void crm_time_free(crm_time_t *dt)