pacemaker  2.0.4-2deceaa
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-2020 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 PCMK__ALERT_DEFAULT_TIMEOUT_MS (30000)
18 
19 /* Default-Format-String used to pass timestamps to the alerts scripts */
20 # define PCMK__ALERT_DEFAULT_TSTAMP_FORMAT "%H:%M:%S.%06N"
21 
24  pcmk__alert_node = (1 << 0),
25  pcmk__alert_fencing = (1 << 1),
30 };
31 
32 typedef struct {
33  char *id;
34  char *path;
36  char *recipient;
38  GHashTable *envvars;
39  int timeout;
40  uint32_t flags;
42 
65 };
66 
67 #define PCMK__ALERT_INTERNAL_KEY_MAX 19
68 #define PCMK__ALERT_NODE_SEQUENCE "CRM_alert_node_sequence"
69 
70 extern const char *pcmk__alert_keys[PCMK__ALERT_INTERNAL_KEY_MAX][3];
71 
73 pcmk__alert_t *pcmk__alert_new(const char *id, const char *path);
74 void pcmk__free_alert(pcmk__alert_t *entry);
75 void pcmk__add_alert_key(GHashTable *table, enum pcmk__alert_keys_e name,
76  const char *value);
77 void pcmk__add_alert_key_int(GHashTable *table, enum pcmk__alert_keys_e name,
78  int value);
79 bool pcmk__alert_in_patchset(xmlNode *msg, bool config);
80 
81 static inline const char *
82 pcmk__alert_flag2text(enum pcmk__alert_flags flag)
83 {
84  switch (flag) {
85  case pcmk__alert_node: return "node";
86  case pcmk__alert_fencing: return "fencing";
87  case pcmk__alert_resource: return "resource";
88  case pcmk__alert_attribute: return "attribute";
89  default: return "unknown";
90  }
91 }
92 #endif
void pcmk__add_alert_key_int(GHashTable *table, enum pcmk__alert_keys_e name, int value)
Definition: alerts.c:166
#define PCMK__ALERT_INTERNAL_KEY_MAX
char ** select_attribute_name
char * tstamp_format
pcmk__alert_t * pcmk__dup_alert(pcmk__alert_t *entry)
Definition: alerts.c:132
bool pcmk__alert_in_patchset(xmlNode *msg, bool config)
Definition: alerts.c:198
pcmk__alert_keys_e
void pcmk__free_alert(pcmk__alert_t *entry)
Definition: alerts.c:107
const char * pcmk__alert_keys[PCMK__ALERT_INTERNAL_KEY_MAX][3]
Definition: alerts.c:21
GHashTable * envvars
pcmk__alert_t * pcmk__alert_new(const char *id, const char *path)
Create a new alert entry structure.
Definition: alerts.c:94
char * name
Definition: pcmk_fence.c:30
pcmk__alert_flags
void pcmk__add_alert_key(GHashTable *table, enum pcmk__alert_keys_e name, const char *value)
Definition: alerts.c:152