pacemaker  1.1.24-3850484742
Scalable High-Availability cluster resource manager
alerts_internal.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2019 Andrew Beekhof <andrew@beekhof.net>
3  *
4  * This source code is licensed under the GNU Lesser General Public License
5  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
6  */
7 
8 #ifndef ALERT_INTERNAL_H
9 #define ALERT_INTERNAL_H
10 
11 #include <glib.h>
12 #include <stdbool.h>
13 
14 /* Default-Timeout to use before killing a alerts script (in milliseconds) */
15 # define CRM_ALERT_DEFAULT_TIMEOUT_MS (30000)
16 
17 /* Default-Format-String used to pass timestamps to the alerts scripts */
18 # define CRM_ALERT_DEFAULT_TSTAMP_FORMAT "%H:%M:%S.%06N"
19 
21  crm_alert_none = 0x0000,
22  crm_alert_node = 0x0001,
27 };
28 
29 typedef struct {
30  char *id;
31  char *path;
33  char *recipient;
35  GHashTable *envvars;
36  int timeout;
39 
59 };
60 
61 #define CRM_ALERT_INTERNAL_KEY_MAX 16
62 #define CRM_ALERT_NODE_SEQUENCE "CRM_alert_node_sequence"
63 
64 extern const char *crm_alert_keys[CRM_ALERT_INTERNAL_KEY_MAX][3];
65 
67 crm_alert_entry_t *crm_alert_entry_new(const char *id, const char *path);
69 void crm_insert_alert_key(GHashTable *table, enum crm_alert_keys_e name,
70  const char *value);
71 void crm_insert_alert_key_int(GHashTable *table, enum crm_alert_keys_e name,
72  int value);
73 void crm_unset_alert_keys(void);
76 bool crm_patchset_contains_alert(xmlNode *msg, bool config);
77 
78 static inline const char *
79 crm_alert_flag2text(enum crm_alert_flags flag)
80 {
81  switch (flag) {
82  case crm_alert_node:
83  return "node";
84  case crm_alert_fencing:
85  return "fencing";
86  case crm_alert_resource:
87  return "resource";
89  return "attribute";
90  default:
91  return "unknown";
92  }
93 }
94 #endif
const char * crm_alert_keys[CRM_ALERT_INTERNAL_KEY_MAX][3]
Definition: alerts.c:30
GHashTable * envvars
char * recipient
void crm_unset_envvar_list(crm_alert_entry_t *entry)
Definition: alerts.c:184
void crm_set_envvar_list(crm_alert_entry_t *entry)
Definition: alerts.c:173
crm_alert_entry_t * crm_dup_alert_entry(crm_alert_entry_t *entry)
Definition: alerts.c:100
uint32_t flags
char * tstamp_format
char * id
void crm_unset_alert_keys(void)
Definition: alerts.c:120
void crm_insert_alert_key_int(GHashTable *table, enum crm_alert_keys_e name, int value)
Definition: alerts.c:148
bool crm_patchset_contains_alert(xmlNode *msg, bool config)
Definition: alerts.c:214
crm_alert_entry_t * crm_alert_entry_new(const char *id, const char *path)
Create a new alert entry structure.
Definition: alerts.c:62
char ** select_attribute_name
int timeout
crm_alert_keys_e
#define uint32_t
Definition: stdint.in.h:158
char * path
void crm_insert_alert_key(GHashTable *table, enum crm_alert_keys_e name, const char *value)
Definition: alerts.c:134
void crm_free_alert_entry(crm_alert_entry_t *entry)
Definition: alerts.c:75
crm_alert_flags
#define CRM_ALERT_INTERNAL_KEY_MAX