pacemaker  1.1.18-7fdfbbe
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
alerts_internal.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Andrew Beekhof <andrew@beekhof.net>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This software is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef ALERT_INTERNAL_H
20 #define ALERT_INTERNAL_H
21 
22 #include <glib.h>
23 #include <stdbool.h>
24 
25 /* Default-Timeout to use before killing a alerts script (in milliseconds) */
26 # define CRM_ALERT_DEFAULT_TIMEOUT_MS (30000)
27 
28 /* Default-Format-String used to pass timestamps to the alerts scripts */
29 # define CRM_ALERT_DEFAULT_TSTAMP_FORMAT "%H:%M:%S.%06N"
30 
31 typedef struct {
32  char *name;
33  char *value;
35 
37  crm_alert_none = 0x0000,
38  crm_alert_node = 0x0001,
43 };
44 
45 typedef struct {
46  char *id;
47  char *path;
49  char *recipient;
51  GHashTable *envvars;
52  int timeout;
55 
75 };
76 
77 #define CRM_ALERT_INTERNAL_KEY_MAX 16
78 #define CRM_ALERT_NODE_SEQUENCE "CRM_alert_node_sequence"
79 
80 extern const char *crm_alert_keys[CRM_ALERT_INTERNAL_KEY_MAX][3];
81 
84 crm_alert_entry_t *crm_alert_entry_new(const char *id, const char *path);
87 void crm_insert_alert_key(GHashTable *table, enum crm_alert_keys_e name,
88  const char *value);
89 void crm_insert_alert_key_int(GHashTable *table, enum crm_alert_keys_e name,
90  int value);
91 void crm_unset_alert_keys(void);
94 bool crm_patchset_contains_alert(xmlNode *msg, bool config);
95 
96 static inline const char *
97 crm_alert_flag2text(enum crm_alert_flags flag)
98 {
99  switch (flag) {
100  case crm_alert_node:
101  return "node";
102  case crm_alert_fencing:
103  return "fencing";
104  case crm_alert_resource:
105  return "resource";
106  case crm_alert_attribute:
107  return "attribute";
108  default:
109  return "unknown";
110  }
111 }
112 #endif
const char * crm_alert_keys[CRM_ALERT_INTERNAL_KEY_MAX][3]
Definition: alerts.c:30
GHashTable * envvars
crm_alert_envvar_t * crm_dup_alert_envvar(crm_alert_envvar_t *src)
Definition: alerts.c:100
char * recipient
void crm_unset_envvar_list(crm_alert_entry_t *entry)
Definition: alerts.c:203
void crm_set_envvar_list(crm_alert_entry_t *entry)
Definition: alerts.c:192
crm_alert_entry_t * crm_dup_alert_entry(crm_alert_entry_t *entry)
Definition: alerts.c:119
uint32_t flags
char * tstamp_format
char * id
void crm_unset_alert_keys(void)
Definition: alerts.c:139
void crm_insert_alert_key_int(GHashTable *table, enum crm_alert_keys_e name, int value)
Definition: alerts.c:167
bool crm_patchset_contains_alert(xmlNode *msg, bool config)
Definition: alerts.c:233
crm_alert_entry_t * crm_alert_entry_new(const char *id, const char *path)
Create a new alert entry structure.
Definition: alerts.c:70
char ** select_attribute_name
int timeout
void crm_free_alert_envvar(crm_alert_envvar_t *entry)
Definition: alerts.c:51
crm_alert_keys_e
#define uint32_t
Definition: stdint.in.h:158
char * path
void crm_insert_alert_key(GHashTable *table, enum crm_alert_keys_e name, const char *value)
Definition: alerts.c:153
void crm_free_alert_entry(crm_alert_entry_t *entry)
Definition: alerts.c:83
crm_alert_flags
#define CRM_ALERT_INTERNAL_KEY_MAX