pacemaker
3.0.0-d8340737c4
Scalable High-Availability cluster resource manager
include
crm
common
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
27
enum
pcmk__alert_flags
{
28
pcmk__alert_none
= 0,
29
pcmk__alert_node
= (1 << 0),
30
pcmk__alert_fencing
= (1 << 1),
31
pcmk__alert_resource
= (1 << 2),
32
pcmk__alert_attribute
= (1 << 3),
33
pcmk__alert_default
=
pcmk__alert_node
|
pcmk__alert_fencing
|
34
pcmk__alert_resource
,
35
};
36
37
typedef
struct
{
38
char
*
id
;
39
char
*
path
;
40
char
*
tstamp_format
;
41
char
*
recipient
;
42
char
**
select_attribute_name
;
43
GHashTable *
envvars
;
44
int
timeout
;
45
uint32_t
flags
;
46
}
pcmk__alert_t
;
47
48
enum
pcmk__alert_keys_e
{
49
PCMK__alert_key_recipient
= 0,
50
PCMK__alert_key_node
,
51
PCMK__alert_key_nodeid
,
52
PCMK__alert_key_rsc
,
53
PCMK__alert_key_task
,
54
PCMK__alert_key_interval
,
55
PCMK__alert_key_desc
,
56
PCMK__alert_key_status
,
57
PCMK__alert_key_target_rc
,
58
PCMK__alert_key_rc
,
59
PCMK__alert_key_kind
,
60
PCMK__alert_key_version
,
61
PCMK__alert_key_node_sequence
,
62
PCMK__alert_key_timestamp
,
63
PCMK__alert_key_attribute_name
,
64
PCMK__alert_key_attribute_value
,
65
PCMK__alert_key_timestamp_epoch
,
66
PCMK__alert_key_timestamp_usec
,
67
PCMK__alert_key_exec_time
,
68
PCMK__alert_key_select_kind
,
69
PCMK__alert_key_select_attribute_name
70
};
71
72
#define PCMK__ALERT_INTERNAL_KEY_MAX 19
73
#define PCMK__ALERT_NODE_SEQUENCE "CRM_alert_node_sequence"
74
75
extern
const
char
*
pcmk__alert_keys
[
PCMK__ALERT_INTERNAL_KEY_MAX
];
76
77
pcmk__alert_t
*
pcmk__dup_alert
(
const
pcmk__alert_t
*entry);
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
pcmk__add_alert_key_int
void pcmk__add_alert_key_int(GHashTable *table, enum pcmk__alert_keys_e name, int value)
Definition:
alerts.c:122
pcmk__alert_resource
Definition:
alerts_internal.h:31
PCMK__alert_key_target_rc
Definition:
alerts_internal.h:57
pcmk__alert_t
Definition:
alerts_internal.h:37
PCMK__alert_key_kind
Definition:
alerts_internal.h:59
PCMK__alert_key_timestamp_usec
Definition:
alerts_internal.h:66
pcmk__alert_attribute
Definition:
alerts_internal.h:32
name
const char * name
Definition:
cib.c:26
PCMK__alert_key_rc
Definition:
alerts_internal.h:58
PCMK__alert_key_exec_time
Definition:
alerts_internal.h:67
PCMK__ALERT_INTERNAL_KEY_MAX
#define PCMK__ALERT_INTERNAL_KEY_MAX
Definition:
alerts_internal.h:72
pcmk__alert_t::select_attribute_name
char ** select_attribute_name
Definition:
alerts_internal.h:42
pcmk__alert_fencing
Definition:
alerts_internal.h:30
pcmk__alert_keys
const char * pcmk__alert_keys[PCMK__ALERT_INTERNAL_KEY_MAX]
Definition:
alerts.c:18
PCMK__alert_key_task
Definition:
alerts_internal.h:53
pcmk__alert_t::tstamp_format
char * tstamp_format
Definition:
alerts_internal.h:40
pcmk__alert_default
Definition:
alerts_internal.h:33
PCMK__alert_key_recipient
Definition:
alerts_internal.h:49
pcmk__alert_keys_e
pcmk__alert_keys_e
Definition:
alerts_internal.h:48
pcmk__free_alert
void pcmk__free_alert(pcmk__alert_t *entry)
Definition:
alerts.c:65
pcmk__alert_t::recipient
char * recipient
Definition:
alerts_internal.h:41
PCMK__alert_key_version
Definition:
alerts_internal.h:60
pcmk__alert_t::flags
uint32_t flags
Definition:
alerts_internal.h:45
pcmk__alert_t::id
char * id
Definition:
alerts_internal.h:38
PCMK__alert_key_desc
Definition:
alerts_internal.h:55
pcmk__dup_alert
pcmk__alert_t * pcmk__dup_alert(const pcmk__alert_t *entry)
Definition:
alerts.c:90
PCMK__alert_key_timestamp
Definition:
alerts_internal.h:62
pcmk__alert_none
Definition:
alerts_internal.h:28
pcmk__alert_t::envvars
GHashTable * envvars
Definition:
alerts_internal.h:43
PCMK__alert_key_select_kind
Definition:
alerts_internal.h:68
pcmk__alert_t::timeout
int timeout
Definition:
alerts_internal.h:44
PCMK__alert_key_node_sequence
Definition:
alerts_internal.h:61
path
const char * path
Definition:
cib.c:28
PCMK__alert_key_interval
Definition:
alerts_internal.h:54
PCMK__alert_key_attribute_name
Definition:
alerts_internal.h:63
PCMK__alert_key_select_attribute_name
Definition:
alerts_internal.h:69
pcmk__alert_new
pcmk__alert_t * pcmk__alert_new(const char *id, const char *path)
Create a new alert entry structure.
Definition:
alerts.c:52
PCMK__alert_key_status
Definition:
alerts_internal.h:56
PCMK__alert_key_nodeid
Definition:
alerts_internal.h:51
PCMK__alert_key_rsc
Definition:
alerts_internal.h:52
PCMK__alert_key_node
Definition:
alerts_internal.h:50
PCMK__alert_key_attribute_value
Definition:
alerts_internal.h:64
pcmk__alert_flags
pcmk__alert_flags
Definition:
alerts_internal.h:27
pcmk__add_alert_key
void pcmk__add_alert_key(GHashTable *table, enum pcmk__alert_keys_e name, const char *value)
Definition:
alerts.c:106
pcmk__alert_t::path
char * path
Definition:
alerts_internal.h:39
pcmk__alert_node
Definition:
alerts_internal.h:29
PCMK__alert_key_timestamp_epoch
Definition:
alerts_internal.h:65
Generated on Wed Jan 8 2025 16:55:39 for pacemaker by
1.8.14