pacemaker  3.0.0-d8340737c4
Scalable High-Availability cluster resource manager
alerts_internal.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2024 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 PCMK__CRM_COMMON_ALERTS_INTERNAL__H
11 #define PCMK__CRM_COMMON_ALERTS_INTERNAL__H
12 
13 #include <glib.h>
14 #include <stdbool.h>
15 #include <stdint.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /* Default-Timeout to use before killing a alerts script (in milliseconds) */
22 #define PCMK__ALERT_DEFAULT_TIMEOUT_MS (30000)
23 
24 /* Default-Format-String used to pass timestamps to the alerts scripts */
25 #define PCMK__ALERT_DEFAULT_TSTAMP_FORMAT "%H:%M:%S.%06N"
26 
29  pcmk__alert_node = (1 << 0),
30  pcmk__alert_fencing = (1 << 1),
35 };
36 
37 typedef struct {
38  char *id;
39  char *path;
41  char *recipient;
43  GHashTable *envvars;
44  int timeout;
45  uint32_t flags;
47 
70 };
71 
72 #define PCMK__ALERT_INTERNAL_KEY_MAX 19
73 #define PCMK__ALERT_NODE_SEQUENCE "CRM_alert_node_sequence"
74 
76 
78 pcmk__alert_t *pcmk__alert_new(const char *id, const char *path);
79 void pcmk__free_alert(pcmk__alert_t *entry);
80 void pcmk__add_alert_key(GHashTable *table, enum pcmk__alert_keys_e name,
81  const char *value);
82 void pcmk__add_alert_key_int(GHashTable *table, enum pcmk__alert_keys_e name,
83  int value);
84 
85 static inline const char *
86 pcmk__alert_flag2text(enum pcmk__alert_flags flag)
87 {
88  switch (flag) {
89  case pcmk__alert_node: return "node";
90  case pcmk__alert_fencing: return "fencing";
91  case pcmk__alert_resource: return "resource";
92  case pcmk__alert_attribute: return "attribute";
93  default: return "unknown";
94  }
95 }
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 #endif // PCMK__CRM_COMMON_ALERTS_INTERNAL__H
void pcmk__add_alert_key_int(GHashTable *table, enum pcmk__alert_keys_e name, int value)
Definition: alerts.c:122
const char * name
Definition: cib.c:26
#define PCMK__ALERT_INTERNAL_KEY_MAX
char ** select_attribute_name
const char * pcmk__alert_keys[PCMK__ALERT_INTERNAL_KEY_MAX]
Definition: alerts.c:18
char * tstamp_format
pcmk__alert_keys_e
void pcmk__free_alert(pcmk__alert_t *entry)
Definition: alerts.c:65
pcmk__alert_t * pcmk__dup_alert(const pcmk__alert_t *entry)
Definition: alerts.c:90
GHashTable * envvars
const char * path
Definition: cib.c:28
pcmk__alert_t * pcmk__alert_new(const char *id, const char *path)
Create a new alert entry structure.
Definition: alerts.c:52
pcmk__alert_flags
void pcmk__add_alert_key(GHashTable *table, enum pcmk__alert_keys_e name, const char *value)
Definition: alerts.c:106