pacemaker  2.0.2-debe490
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
alerts_internal.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2019 the Pacemaker project contributors
3  *
4  * The version control history for this file may have further details.
5  *
6  * This source code is licensed under the GNU Lesser General Public License
7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8  */
9 
10 #ifndef ALERT_INTERNAL_H
11 #define ALERT_INTERNAL_H
12 
13 #include <glib.h>
14 #include <stdbool.h>
15 
16 /* Default-Timeout to use before killing a alerts script (in milliseconds) */
17 # define CRM_ALERT_DEFAULT_TIMEOUT_MS (30000)
18 
19 /* Default-Format-String used to pass timestamps to the alerts scripts */
20 # define CRM_ALERT_DEFAULT_TSTAMP_FORMAT "%H:%M:%S.%06N"
21 
23  crm_alert_none = 0x0000,
24  crm_alert_node = 0x0001,
29 };
30 
31 typedef struct {
32  char *id;
33  char *path;
35  char *recipient;
37  GHashTable *envvars;
38  int timeout;
39  uint32_t flags;
41 
64 };
65 
66 #define CRM_ALERT_INTERNAL_KEY_MAX 19
67 #define CRM_ALERT_NODE_SEQUENCE "CRM_alert_node_sequence"
68 
69 extern const char *crm_alert_keys[CRM_ALERT_INTERNAL_KEY_MAX][3];
70 
72 crm_alert_entry_t *crm_alert_entry_new(const char *id, const char *path);
74 void crm_insert_alert_key(GHashTable *table, enum crm_alert_keys_e name,
75  const char *value);
76 void crm_insert_alert_key_int(GHashTable *table, enum crm_alert_keys_e name,
77  int value);
78 void crm_unset_alert_keys(void);
81 bool crm_patchset_contains_alert(xmlNode *msg, bool config);
82 
83 static inline const char *
84 crm_alert_flag2text(enum crm_alert_flags flag)
85 {
86  switch (flag) {
87  case crm_alert_node:
88  return "node";
89  case crm_alert_fencing:
90  return "fencing";
91  case crm_alert_resource:
92  return "resource";
94  return "attribute";
95  default:
96  return "unknown";
97  }
98 }
99 #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
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