pacemaker  2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
alerts_internal.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2023 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__ALERT_INTERNAL__H
11 #define PCMK__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 
80 static inline const char *
81 pcmk__alert_flag2text(enum pcmk__alert_flags flag)
82 {
83  switch (flag) {
84  case pcmk__alert_node: return "node";
85  case pcmk__alert_fencing: return "fencing";
86  case pcmk__alert_resource: return "resource";
87  case pcmk__alert_attribute: return "attribute";
88  default: return "unknown";
89  }
90 }
91 #endif
void pcmk__add_alert_key_int(GHashTable *table, enum pcmk__alert_keys_e name, int value)
Definition: alerts.c:163
const char * name
Definition: cib.c:26
#define PCMK__ALERT_INTERNAL_KEY_MAX
char ** select_attribute_name
char * tstamp_format
pcmk__alert_keys_e
void pcmk__free_alert(pcmk__alert_t *entry)
Definition: alerts.c:108
const char * pcmk__alert_keys[PCMK__ALERT_INTERNAL_KEY_MAX][3]
Definition: alerts.c:22
pcmk__alert_t * pcmk__dup_alert(const pcmk__alert_t *entry)
Definition: alerts.c:133
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:95
pcmk__alert_flags
void pcmk__add_alert_key(GHashTable *table, enum pcmk__alert_keys_e name, const char *value)
Definition: alerts.c:149