pacemaker
2.1.8-3980678f03
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__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
22
enum
pcmk__alert_flags
{
23
pcmk__alert_none
= 0,
24
pcmk__alert_node
= (1 << 0),
25
pcmk__alert_fencing
= (1 << 1),
26
pcmk__alert_resource
= (1 << 2),
27
pcmk__alert_attribute
= (1 << 3),
28
pcmk__alert_default
=
pcmk__alert_node
|
pcmk__alert_fencing
|
29
pcmk__alert_resource
,
30
};
31
32
typedef
struct
{
33
char
*
id
;
34
char
*
path
;
35
char
*
tstamp_format
;
36
char
*
recipient
;
37
char
**
select_attribute_name
;
38
GHashTable *
envvars
;
39
int
timeout
;
40
uint32_t
flags
;
41
}
pcmk__alert_t
;
42
43
enum
pcmk__alert_keys_e
{
44
PCMK__alert_key_recipient
= 0,
45
PCMK__alert_key_node
,
46
PCMK__alert_key_nodeid
,
47
PCMK__alert_key_rsc
,
48
PCMK__alert_key_task
,
49
PCMK__alert_key_interval
,
50
PCMK__alert_key_desc
,
51
PCMK__alert_key_status
,
52
PCMK__alert_key_target_rc
,
53
PCMK__alert_key_rc
,
54
PCMK__alert_key_kind
,
55
PCMK__alert_key_version
,
56
PCMK__alert_key_node_sequence
,
57
PCMK__alert_key_timestamp
,
58
PCMK__alert_key_attribute_name
,
59
PCMK__alert_key_attribute_value
,
60
PCMK__alert_key_timestamp_epoch
,
61
PCMK__alert_key_timestamp_usec
,
62
PCMK__alert_key_exec_time
,
63
PCMK__alert_key_select_kind
,
64
PCMK__alert_key_select_attribute_name
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
72
pcmk__alert_t
*
pcmk__dup_alert
(
const
pcmk__alert_t
*entry);
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
pcmk__add_alert_key_int
void pcmk__add_alert_key_int(GHashTable *table, enum pcmk__alert_keys_e name, int value)
Definition:
alerts.c:163
pcmk__alert_resource
Definition:
alerts_internal.h:26
PCMK__alert_key_target_rc
Definition:
alerts_internal.h:52
pcmk__alert_t
Definition:
alerts_internal.h:32
PCMK__alert_key_kind
Definition:
alerts_internal.h:54
PCMK__alert_key_timestamp_usec
Definition:
alerts_internal.h:61
pcmk__alert_attribute
Definition:
alerts_internal.h:27
name
const char * name
Definition:
cib.c:26
PCMK__alert_key_rc
Definition:
alerts_internal.h:53
PCMK__alert_key_exec_time
Definition:
alerts_internal.h:62
PCMK__ALERT_INTERNAL_KEY_MAX
#define PCMK__ALERT_INTERNAL_KEY_MAX
Definition:
alerts_internal.h:67
pcmk__alert_t::select_attribute_name
char ** select_attribute_name
Definition:
alerts_internal.h:37
pcmk__alert_fencing
Definition:
alerts_internal.h:25
PCMK__alert_key_task
Definition:
alerts_internal.h:48
pcmk__alert_t::tstamp_format
char * tstamp_format
Definition:
alerts_internal.h:35
pcmk__alert_default
Definition:
alerts_internal.h:28
PCMK__alert_key_recipient
Definition:
alerts_internal.h:44
pcmk__alert_keys_e
pcmk__alert_keys_e
Definition:
alerts_internal.h:43
pcmk__free_alert
void pcmk__free_alert(pcmk__alert_t *entry)
Definition:
alerts.c:108
pcmk__alert_t::recipient
char * recipient
Definition:
alerts_internal.h:36
pcmk__alert_keys
const char * pcmk__alert_keys[PCMK__ALERT_INTERNAL_KEY_MAX][3]
Definition:
alerts.c:22
PCMK__alert_key_version
Definition:
alerts_internal.h:55
pcmk__alert_t::flags
uint32_t flags
Definition:
alerts_internal.h:40
pcmk__alert_t::id
char * id
Definition:
alerts_internal.h:33
PCMK__alert_key_desc
Definition:
alerts_internal.h:50
pcmk__dup_alert
pcmk__alert_t * pcmk__dup_alert(const pcmk__alert_t *entry)
Definition:
alerts.c:133
PCMK__alert_key_timestamp
Definition:
alerts_internal.h:57
pcmk__alert_none
Definition:
alerts_internal.h:23
pcmk__alert_t::envvars
GHashTable * envvars
Definition:
alerts_internal.h:38
PCMK__alert_key_select_kind
Definition:
alerts_internal.h:63
pcmk__alert_t::timeout
int timeout
Definition:
alerts_internal.h:39
PCMK__alert_key_node_sequence
Definition:
alerts_internal.h:56
path
const char * path
Definition:
cib.c:28
PCMK__alert_key_interval
Definition:
alerts_internal.h:49
PCMK__alert_key_attribute_name
Definition:
alerts_internal.h:58
PCMK__alert_key_select_attribute_name
Definition:
alerts_internal.h:64
pcmk__alert_new
pcmk__alert_t * pcmk__alert_new(const char *id, const char *path)
Create a new alert entry structure.
Definition:
alerts.c:95
PCMK__alert_key_status
Definition:
alerts_internal.h:51
PCMK__alert_key_nodeid
Definition:
alerts_internal.h:46
PCMK__alert_key_rsc
Definition:
alerts_internal.h:47
PCMK__alert_key_node
Definition:
alerts_internal.h:45
PCMK__alert_key_attribute_value
Definition:
alerts_internal.h:59
pcmk__alert_flags
pcmk__alert_flags
Definition:
alerts_internal.h:22
pcmk__add_alert_key
void pcmk__add_alert_key(GHashTable *table, enum pcmk__alert_keys_e name, const char *value)
Definition:
alerts.c:149
pcmk__alert_t::path
char * path
Definition:
alerts_internal.h:34
pcmk__alert_node
Definition:
alerts_internal.h:24
PCMK__alert_key_timestamp_epoch
Definition:
alerts_internal.h:60
Generated on Thu Aug 8 2024 18:08:10 for pacemaker by
1.8.14