37 crm_trace(
"Setting alert key %s = '%s'", *key, value);
47 char *value_s = pcmk__itoa(value);
49 head = alert_key2param(head, name, value_s);
60 head = alert_key2param(head, name, value_s);
66 set_ev_kv(gpointer key, gpointer value, gpointer user_data)
71 crm_trace(
"Setting environment variable %s='%s'",
72 (
char*)key, (
char*)value);
81 g_hash_table_foreach(entry->
envvars, set_ev_kv, &head);
91 is_target_alert(
char **list,
const char *value)
93 int target_list_num = 0;
102 target_list_num = g_strv_length(list);
104 for (
int cnt = 0; cnt < target_list_num; cnt++) {
105 if (strcmp(list[cnt], value) == 0) {
131 bool any_success = FALSE, any_failure = FALSE;
132 const char *kind_s = pcmk__alert_flag2text(kind);
134 struct timeval tv_now;
135 char timestamp_epoch[20];
136 char timestamp_usec[7];
142 for (GList *iter = g_list_first(alert_list); iter; iter = g_list_next(iter)) {
149 crm_trace(
"Filtering unwanted %s alert to %s via %s",
157 crm_trace(
"Filtering unwanted attribute '%s' alert to %s via %s",
163 if (gettimeofday(&tv_now, NULL) == 0) {
167 crm_info(
"Sending %s alert via %s to %s",
171 for (head = params; head != NULL; head = head->
next) {
182 copy_params = alert_key2param(copy_params,
188 snprintf(timestamp_epoch,
sizeof(timestamp_epoch),
"%lld",
189 (
long long) tv_now.tv_sec);
190 copy_params = alert_key2param(copy_params,
193 snprintf(timestamp_usec,
sizeof(timestamp_usec),
"%06d", now->
useconds);
194 copy_params = alert_key2param(copy_params,
199 copy_params = alert_envvar2params(copy_params, entry);
217 return (any_success? -1 : -2);
239 const char *node, uint32_t nodeid,
240 const char *attr_name,
const char *attr_value)
277 const char *node, uint32_t nodeid,
const char *state)
312 const char *
target,
const char *task,
const char *desc,
391 services_ocf_exitcode_str(op->
rc));
#define CRM_CHECK(expr, failure_action)
const char * pcmk_strerror(int rc)
int lrmd_send_resource_alert(lrmd_t *lrmd, GList *alert_list, const char *node, lrmd_event_data_t *op)
pcmk__time_hr_t * pcmk__time_timeval_hr_convert(pcmk__time_hr_t *target, struct timeval *tv)
int rsc_op_expected_rc(lrmd_event_data_t *event)
char ** select_attribute_name
#define PACEMAKER_VERSION
char * pcmk__time_format_hr(const char *format, pcmk__time_hr_t *hr_dt)
Wrappers for and extensions to glib mainloop.
int(* exec_alert)(lrmd_t *lrmd, const char *alert_id, const char *alert_path, int timeout, lrmd_key_value_t *params)
Execute an alert agent.
const char * pcmk__alert_keys[PCMK__ALERT_INTERNAL_KEY_MAX][3]
int lrmd_send_node_alert(lrmd_t *lrmd, GList *alert_list, const char *node, uint32_t nodeid, const char *state)
int lrmd_send_attribute_alert(lrmd_t *lrmd, GList *alert_list, const char *node, uint32_t nodeid, const char *attr_name, const char *attr_value)
#define crm_trace(fmt, args...)
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
lrmd_key_value_t * lrmd_key_value_add(lrmd_key_value_t *kvp, const char *key, const char *value)
struct lrmd_key_value_s * next
void lrmd_key_value_freeall(lrmd_key_value_t *head)
Cluster status and scheduling.
lrmd_api_operations_t * cmds
#define crm_err(fmt, args...)
int lrmd_send_fencing_alert(lrmd_t *lrmd, GList *alert_list, const char *target, const char *task, const char *desc, int op_rc)
#define crm_info(fmt, args...)