29 get_meta_attrs_from_cib(xmlNode *basenode,
pcmk__alert_t *entry,
34 const char *value = NULL;
38 NULL, FALSE, now, NULL);
53 crm_trace(
"Alert %s uses default timeout of %dmsec",
56 crm_warn(
"Alert %s has invalid timeout value '%s', using default %dmsec",
61 crm_trace(
"Alert %s uses timeout of %dmsec",
64 if (entry->
timeout > *max_timeout) {
74 crm_trace(
"Alert %s uses timestamp format '%s'",
79 g_hash_table_destroy(config_hash);
88 if ((basenode == NULL) || (entry == NULL)) {
110 g_hash_table_insert(entry->
envvars, strdup(
name), strdup(value));
111 crm_trace(
"Alert %s: added environment variable %s='%s'",
120 xmlNode *event_type = NULL;
123 for (event_type = pcmk__xe_first_child(select); event_type != NULL;
124 event_type = pcmk__xe_next(event_type)) {
137 const char *attr_name;
153 (nattrs + 1) *
sizeof(
char*));
163 crm_debug(
"Alert %s receives events: attributes:%s%s%s%s",
184 unpack_alert(xmlNode *alert,
pcmk__alert_t *entry, guint *max_timeout)
188 get_envvars_from_cib(alert, entry);
189 rc = get_meta_attrs_from_cib(alert, entry, max_timeout);
191 unpack_alert_filter(alert, entry);
212 guint max_timeout = 0;
213 GList *alert_list = NULL;
215 if (alerts == NULL) {
224 const char *alert_id =
ID(alert);
228 if ((alert_id == NULL) || (alert_path == NULL)) {
229 crm_warn(
"Ignoring invalid alert without id and path");
235 if (unpack_alert(alert, entry, &max_timeout) !=
pcmk_rc_ok) {
246 crm_debug(
"Alert %s: path=%s timeout=%dms tstamp-format='%s' %u vars",
259 if (unpack_alert(recipient, recipient_entry,
261 crm_debug(
"Alert %s: recipient %s is disabled",
262 entry->
id, recipient_entry->
id);
266 alert_list = g_list_prepend(alert_list, recipient_entry);
267 crm_debug(
"Alert %s has recipient %s with value %s and %d envvars",
270 g_hash_table_size(recipient_entry->
envvars) : 0));
273 if (recipients == 0) {
274 alert_list = g_list_prepend(alert_list, entry);
struct crm_time_s crm_time_t
xmlNode * first_named_child(const xmlNode *parent, const char *name)
char ** select_attribute_name
#define XML_CIB_TAG_ALERT_RESOURCES
long long crm_get_msec(const char *input)
Parse a time+units string and return milliseconds equivalent.
#define XML_NVPAIR_ATTR_NAME
#define XML_CIB_TAG_ALERT_ATTRIBUTES
#define XML_CIB_TAG_NVPAIR
#define XML_ALERT_ATTR_REC_VALUE
#define PCMK_META_ENABLED
void pcmk__free_alert(pcmk__alert_t *entry)
#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.
pcmk__alert_t * pcmk__dup_alert(const pcmk__alert_t *entry)
#define XML_CIB_TAG_ALERT_NODES
#define crm_trace(fmt, args...)
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
#define XML_TAG_META_SETS
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 XML_ALERT_ATTR_TIMEOUT
#define XML_ALERT_ATTR_TSTAMP_FORMAT
GList * pe_unpack_alerts(const xmlNode *alerts)
GHashTable * pcmk__strkey_table(GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
#define XML_CIB_TAG_ALERT
crm_time_t * crm_time_new(const char *string)
#define XML_CIB_TAG_ALERT_FENCING
#define XML_NVPAIR_ATTR_VALUE
void pe_free_alert_list(GList *alert_list)
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 XML_CIB_TAG_ALERT_SELECT
#define PCMK__ALERT_DEFAULT_TSTAMP_FORMAT
#define XML_ALERT_ATTR_PATH
#define XML_CIB_TAG_ALERT_ATTR
#define XML_CIB_TAG_ALERT_RECIPIENT
#define PCMK__ALERT_DEFAULT_TIMEOUT_MS
xmlNode * crm_next_same_xml(const xmlNode *sibling)
Get next instance of same XML tag.
void crm_time_free(crm_time_t *dt)