pacemaker 3.0.1-16e74fc4da
Scalable High-Availability cluster resource manager
Loading...
Searching...
No Matches
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 <stdbool.h>
14#include <stdint.h> // uint32_t
15
16#include <glib.h> // GList, GHashTable
17#include <libxml/tree.h> // xmlNode
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23/* Default-Timeout to use before killing a alerts script (in milliseconds) */
24#define PCMK__ALERT_DEFAULT_TIMEOUT_MS (30000)
25
26/* Default-Format-String used to pass timestamps to the alerts scripts */
27#define PCMK__ALERT_DEFAULT_TSTAMP_FORMAT "%H:%M:%S.%06N"
28
38
39typedef struct {
40 char *id;
41 char *path;
43 char *recipient;
45 GHashTable *envvars;
47 uint32_t flags;
49
73
74#define PCMK__ALERT_INTERNAL_KEY_MAX 19
75#define PCMK__ALERT_NODE_SEQUENCE "CRM_alert_node_sequence"
76
78
80pcmk__alert_t *pcmk__alert_new(const char *id, const char *path);
82void pcmk__add_alert_key(GHashTable *table, enum pcmk__alert_keys_e name,
83 const char *value);
84void pcmk__add_alert_key_int(GHashTable *table, enum pcmk__alert_keys_e name,
85 int value);
86GList *pcmk__unpack_alerts(const xmlNode *alerts);
87void pcmk__free_alerts(GList *alert_list);
88
89static inline const char *
90pcmk__alert_flag2text(enum pcmk__alert_flags flag)
91{
92 switch (flag) {
93 case pcmk__alert_node: return "node";
94 case pcmk__alert_fencing: return "fencing";
95 case pcmk__alert_resource: return "resource";
96 case pcmk__alert_attribute: return "attribute";
97 default: return "unknown";
98 }
99}
100
101#ifdef __cplusplus
102}
103#endif
104
105#endif // PCMK__CRM_COMMON_ALERTS_INTERNAL__H
GList * pcmk__unpack_alerts(const xmlNode *alerts)
Definition alerts.c:345
void pcmk__free_alert(pcmk__alert_t *entry)
Definition alerts.c:65
pcmk__alert_t * pcmk__alert_new(const char *id, const char *path)
Create a new alert entry structure.
Definition alerts.c:52
pcmk__alert_t * pcmk__dup_alert(const pcmk__alert_t *entry)
Definition alerts.c:90
const char * pcmk__alert_keys[PCMK__ALERT_INTERNAL_KEY_MAX]
Definition alerts.c:18
pcmk__alert_keys_e
@ PCMK__alert_key_node
@ PCMK__alert_key_task
@ PCMK__alert_key_timestamp_epoch
@ PCMK__alert_key_rc
@ PCMK__alert_key_status
@ PCMK__alert_key_nodeid
@ PCMK__alert_key_interval
@ PCMK__alert_key_timestamp
@ PCMK__alert_key_select_attribute_name
@ PCMK__alert_key_attribute_name
@ PCMK__alert_key_target_rc
@ PCMK__alert_key_timestamp_usec
@ PCMK__alert_key_select_kind
@ PCMK__alert_key_kind
@ PCMK__alert_key_node_sequence
@ PCMK__alert_key_rsc
@ PCMK__alert_key_recipient
@ PCMK__alert_key_exec_time
@ PCMK__alert_key_version
@ PCMK__alert_key_desc
@ PCMK__alert_key_attribute_value
void pcmk__free_alerts(GList *alert_list)
Definition alerts.c:432
void pcmk__add_alert_key_int(GHashTable *table, enum pcmk__alert_keys_e name, int value)
Definition alerts.c:122
pcmk__alert_flags
@ pcmk__alert_resource
@ pcmk__alert_default
@ pcmk__alert_none
@ pcmk__alert_attribute
@ pcmk__alert_fencing
@ pcmk__alert_node
#define PCMK__ALERT_INTERNAL_KEY_MAX
void pcmk__add_alert_key(GHashTable *table, enum pcmk__alert_keys_e name, const char *value)
Definition alerts.c:106
const char * path
Definition cib.c:28
const char * name
Definition cib.c:26
char ** select_attribute_name
GHashTable * envvars