pacemaker  2.0.1-9e909a5bdd
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 
62 };
63 
64 #define CRM_ALERT_INTERNAL_KEY_MAX 19
65 #define CRM_ALERT_NODE_SEQUENCE "CRM_alert_node_sequence"
66 
67 extern const char *crm_alert_keys[CRM_ALERT_INTERNAL_KEY_MAX][3];
68 
70 crm_alert_entry_t *crm_alert_entry_new(const char *id, const char *path);
72 void crm_insert_alert_key(GHashTable *table, enum crm_alert_keys_e name,
73  const char *value);
74 void crm_insert_alert_key_int(GHashTable *table, enum crm_alert_keys_e name,
75  int value);
76 void crm_unset_alert_keys(void);
79 bool crm_patchset_contains_alert(xmlNode *msg, bool config);
80 
81 static inline const char *
82 crm_alert_flag2text(enum crm_alert_flags flag)
83 {
84  switch (flag) {
85  case crm_alert_node:
86  return "node";
87  case crm_alert_fencing:
88  return "fencing";
89  case crm_alert_resource:
90  return "resource";
92  return "attribute";
93  default:
94  return "unknown";
95  }
96 }
97 #endif
const char * crm_alert_keys[CRM_ALERT_INTERNAL_KEY_MAX][3]
Definition: alerts.c:19
GHashTable * envvars
char * recipient
void crm_unset_envvar_list(crm_alert_entry_t *entry)
Definition: alerts.c:176
void crm_set_envvar_list(crm_alert_entry_t *entry)
Definition: alerts.c:165
crm_alert_entry_t * crm_dup_alert_entry(crm_alert_entry_t *entry)
Definition: alerts.c:92
uint32_t flags
char * tstamp_format
char * id
void crm_unset_alert_keys(void)
Definition: alerts.c:112
void crm_insert_alert_key_int(GHashTable *table, enum crm_alert_keys_e name, int value)
Definition: alerts.c:140
bool crm_patchset_contains_alert(xmlNode *msg, bool config)
Definition: alerts.c:206
crm_alert_entry_t * crm_alert_entry_new(const char *id, const char *path)
Create a new alert entry structure.
Definition: alerts.c:54
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:126
void crm_free_alert_entry(crm_alert_entry_t *entry)
Definition: alerts.c:67
crm_alert_flags
#define CRM_ALERT_INTERNAL_KEY_MAX