Skip to content

Commit 6c12a04

Browse files
committed
Remove the unused support of pluggable alerting
1 parent 6e6ce1c commit 6c12a04

File tree

5 files changed

+2
-239
lines changed

5 files changed

+2
-239
lines changed

main/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ target_link_libraries(gridinit-utils
1111

1212
add_executable(gridinit
1313
gridinit.c
14-
alerting.c
1514
utils.c
1615
cnx.c)
1716
target_link_libraries(gridinit

main/alerting.c

Lines changed: 0 additions & 109 deletions
This file was deleted.

main/gridinit.c

Lines changed: 2 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
4444

4545
#include <gridinit-utils.h>
4646
#include "./gridinit_internals.h"
47-
#include "./gridinit_alerts.h"
4847

4948
#define USERFLAG_PROCESS_DIED 0x00000002
5049
#define USERFLAG_PROCESS_RESTARTED 0x00000004
@@ -222,20 +221,17 @@ static void
222221
alert_send_deferred(void *udata, struct child_info_s *ci)
223222
{
224223
(void) udata;
225-
gchar buff[1024];
226224

227225
/* Handle the alerting of broken services */
228226
if ((ci->user_flags & USERFLAG_PROCESS_DIED) && ci->broken) {
229227
supervisor_children_del_user_flags(ci->key, USERFLAG_PROCESS_DIED);
230-
g_snprintf(buff, sizeof(buff), "Process broken [%s] %s", ci->key, ci->cmd);
231-
gridinit_alerting_send(GRIDINIT_EVENT_BROKEN, buff);
228+
ERROR("Process broken [%s] %s", ci->key, ci->cmd);
232229
}
233230

234231
/* Handle the alerting of successfully restarted services */
235232
if (!(ci->user_flags & USERFLAG_PROCESS_DIED) && (ci->user_flags & USERFLAG_PROCESS_RESTARTED)) {
236233
supervisor_children_del_user_flags(ci->key, USERFLAG_PROCESS_RESTARTED);
237-
g_snprintf(buff, sizeof(buff), "Process restarted [%s] %s", ci->key, ci->cmd);
238-
gridinit_alerting_send(GRIDINIT_EVENT_RESTARTED, buff);
234+
NOTICE("Process restarted [%s] %s", ci->key, ci->cmd);
239235
}
240236
}
241237

@@ -1271,60 +1267,6 @@ _cfg_section_service(GKeyFile *kf, const gchar *section, GError **err)
12711267
return rc;
12721268
}
12731269

1274-
static gboolean
1275-
_cfg_section_alert(GKeyFile *kf, const gchar *section, GError **err)
1276-
{
1277-
gchar cfg_plugin[1024], cfg_symbol[128];
1278-
gchar **p_key, **keys;
1279-
1280-
bzero(cfg_plugin, sizeof(cfg_plugin));
1281-
bzero(cfg_symbol, sizeof(cfg_symbol));
1282-
1283-
keys = g_key_file_get_keys(kf, section, NULL, err);
1284-
if (!keys)
1285-
return FALSE;
1286-
1287-
for (p_key=keys; *p_key ;p_key++) {
1288-
gchar *str;
1289-
1290-
str = g_key_file_get_string(kf, section, *p_key, NULL);
1291-
1292-
if (!g_ascii_strcasecmp(*p_key, "plugin")) {
1293-
if (*cfg_plugin)
1294-
NOTICE("Alerting plugin already known : plugin=[%s]", cfg_plugin);
1295-
else
1296-
g_strlcpy(cfg_plugin, str, sizeof(cfg_plugin)-1);
1297-
}
1298-
else if (!g_ascii_strcasecmp(*p_key, "symbol")) {
1299-
if (*cfg_symbol)
1300-
NOTICE("Alerting symbol already known : symbol=[%s]", cfg_symbol);
1301-
else
1302-
g_strlcpy(cfg_symbol, str, sizeof(cfg_symbol)-1);
1303-
}
1304-
1305-
g_free(str);
1306-
}
1307-
1308-
g_strfreev(keys);
1309-
1310-
if (!*cfg_symbol || !*cfg_plugin) {
1311-
WARN("Missing configuration keys : both \"plugin\" and \"symbol\""
1312-
" must be present in section [%s]", section);
1313-
return FALSE;
1314-
}
1315-
else {
1316-
GHashTable *ht_params;
1317-
gboolean rc;
1318-
ht_params = _cfg_extract_parameters(kf, section, "config.", err);
1319-
rc = gridinit_alerting_configure(cfg_plugin, cfg_symbol, ht_params, err);
1320-
g_hash_table_destroy(ht_params);
1321-
if (!rc)
1322-
return FALSE;
1323-
}
1324-
1325-
return TRUE;
1326-
}
1327-
13281270
static gboolean
13291271
_cfg_section_default(GKeyFile *kf, const gchar *section, GError **err)
13301272
{
@@ -1489,13 +1431,6 @@ _cfg_reload_file(GKeyFile *kf, gboolean services_only, GError **err)
14891431
goto label_exit;
14901432
}
14911433
}
1492-
else if (!services_only && !g_ascii_strcasecmp(*p_group, "alerts")) {
1493-
INFO("reconfigure : loading alerting parameters from section [%s]", *p_group);
1494-
if (!_cfg_section_alert(kf, *p_group, err)) {
1495-
WARN("Invalid alerts section");
1496-
goto label_exit;
1497-
}
1498-
}
14991434
else {
15001435
INFO("reconfigure : ignoring section [%s]", *p_group);
15011436
}
@@ -1986,7 +1921,6 @@ main(int argc, char ** args)
19861921
signals_clean();
19871922
g_free(config_path);
19881923

1989-
gridinit_alerting_close();
19901924
closelog();
19911925
return rc;
19921926
}

main/gridinit_alerts.h

Lines changed: 0 additions & 53 deletions
This file was deleted.

main/gridinit_internals.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,6 @@ int __open_unix_client(const char *path);
8686

8787
int __open_inet_server(const char *url);
8888

89-
/* Alerting */
90-
91-
gboolean gridinit_alerting_configure(const gchar *path, const gchar *symbol, GHashTable *ht, GError **err);
92-
93-
void gridinit_alerting_send(int event, const char *msg);
94-
95-
void gridinit_alerting_close(void);
96-
9789
/* Groups matching */
9890

9991
gboolean gridinit_group_in_set(const gchar *group, const gchar *set);

0 commit comments

Comments
 (0)