pacemaker  2.0.1-15814c6c0d
Scalable High-Availability cluster resource manager
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 
78 };
79 
80 #define CRM_ALERT_INTERNAL_KEY_MAX 19
81 #define CRM_ALERT_NODE_SEQUENCE "CRM_alert_node_sequence"
82 
83 extern const char *crm_alert_keys[CRM_ALERT_INTERNAL_KEY_MAX][3];
84 
87 crm_alert_entry_t *crm_alert_entry_new(const char *id, const char *path);
90 void crm_insert_alert_key(GHashTable *table, enum crm_alert_keys_e name,
91  const char *value);
92 void crm_insert_alert_key_int(GHashTable *table, enum crm_alert_keys_e name,
93  int value);
94 void crm_unset_alert_keys(void);
97 bool crm_patchset_contains_alert(xmlNode *msg, bool config);
98 
99 static inline const char *
100 crm_alert_flag2text(enum crm_alert_flags flag)
101 {
102  switch (flag) {
103  case crm_alert_node:
104  return "node";
105  case crm_alert_fencing:
106  return "fencing";
107  case crm_alert_resource:
108  return "resource";
109  case crm_alert_attribute:
110  return "attribute";
111  default:
112  return "unknown";
113  }
114 }
115 #endif
const char * crm_alert_keys[CRM_ALERT_INTERNAL_KEY_MAX][3]
Definition: alerts.c:19
GHashTable * envvars
crm_alert_envvar_t * crm_dup_alert_envvar(crm_alert_envvar_t *src)
Definition: alerts.c:92
char * recipient
void crm_unset_envvar_list(crm_alert_entry_t *entry)
Definition: alerts.c:195
void crm_set_envvar_list(crm_alert_entry_t *entry)
Definition: alerts.c:184
crm_alert_entry_t * crm_dup_alert_entry(crm_alert_entry_t *entry)
Definition: alerts.c:111
uint32_t flags
char * tstamp_format
char * id
void crm_unset_alert_keys(void)
Definition: alerts.c:131
void crm_insert_alert_key_int(GHashTable *table, enum crm_alert_keys_e name, int value)
Definition: alerts.c:159
bool crm_patchset_contains_alert(xmlNode *msg, bool config)
Definition: alerts.c:225
crm_alert_entry_t * crm_alert_entry_new(const char *id, const char *path)
Create a new alert entry structure.
Definition: alerts.c:62
char ** select_attribute_name
int timeout
void crm_free_alert_envvar(crm_alert_envvar_t *entry)
Definition: alerts.c:43
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:145
void crm_free_alert_entry(crm_alert_entry_t *entry)
Definition: alerts.c:75
crm_alert_flags
#define CRM_ALERT_INTERNAL_KEY_MAX