Skip to content

Commit 899b459

Browse files
authored
Revert "Revert "Event and alarm management (#17949)" (#20052)"
This reverts commit 93f3cad.
1 parent 93f3cad commit 899b459

24 files changed

+1866
-10
lines changed

dockers/docker-database/database_config.json.j2

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@
130130
"instance" : {% if include_remote_db %} "remote_redis" {% else %} "redis" {% endif %}
131131
}
132132
{% endif %}
133+
,
134+
"EVENT_DB" : {
135+
"id" : 19,
136+
"separator": "|",
137+
"instance" : "redis"
138+
}
133139
},
134140
"VERSION" : "1.0"
135141
}

dockers/docker-eventd/supervisord.conf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,13 @@ stderr_logfile=syslog
5050
dependent_startup=true
5151
dependent_startup_wait_for=start:exited
5252

53+
[program:eventdb]
54+
command=/usr/bin/eventdb
55+
priority=3
56+
autostart=false
57+
autorestart=false
58+
stdout_logfile=syslog
59+
stderr_logfile=syslog
60+
dependent_startup=true
61+
dependent_startup_wait_for=start:exited
62+

files/build_templates/docker_image_ctl.j2

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,16 @@ function preStartAction()
9191
# Load redis content from /host/warmboot/dump.rdb
9292
docker cp $WARM_DIR/dump.rdb database$DEV:/var/lib/redis/dump.rdb
9393
else
94-
# Create an emtpy file and overwrite any RDB if already there
95-
echo -n > /tmp/dump.rdb
96-
docker cp /tmp/dump.rdb database$DEV:/var/lib/redis/
94+
COLD_DIR=/host/coldboot
95+
#In case of cold reboot, load redis content from /host/coldboot/dump.rdb
96+
if [[ -f $COLD_DIR/dump.rdb ]]; then
97+
#Load redis content from /host/coldboot/dump.rdb
98+
docker cp $COLD_DIR/dump.rdb database$DEV:/var/lib/redis/dump.rdb
99+
else
100+
# Create an emtpy file and overwrite any RDB if already there
101+
echo -n > /tmp/dump.rdb
102+
docker cp /tmp/dump.rdb database$DEV:/var/lib/redis/
103+
fi
97104
fi
98105
fi
99106
{%- elif docker_container_name == "pde" %}

src/sonic-eventd/Makefile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
RM := rm -rf
22
EVENTD_TARGET := eventd
33
EVENTD_TEST := tests/tests
4+
EVENTDB_TEST := tests/eventdb
45
EVENTD_TOOL := tools/events_tool
56
EVENTD_PUBLISH_TOOL := tools/events_publish_tool.py
67
RSYSLOG-PLUGIN_TARGET := rsyslog_plugin/rsyslog_plugin
78
RSYSLOG-PLUGIN_TEST := rsyslog_plugin_tests/tests
89
EVENTD_MONIT := tools/events_monit_test.py
910
EVENTD_MONIT_CONF := tools/monit_events
11+
EVENTDB_TARGET := eventdb
12+
EVENTDB_DEFAULT_PROFILE := var/evprofile/default.json
13+
EVENTDB_PROF := etc/eventd.json
1014

1115
CP := cp
1216
MKDIR := mkdir
@@ -19,7 +23,7 @@ PWD := $(shell pwd)
1923

2024
ifneq ($(MAKECMDGOALS),clean)
2125
ifneq ($(strip $(C_DEPS)),)
22-
-include $(C_DEPS) $(OBJS)
26+
-include $(C_DEPS) $(OBJS) $(EVENTDB_OBJS)
2327
endif
2428
endif
2529

@@ -31,10 +35,11 @@ endif
3135

3236
all: sonic-eventd eventd-tests eventd-tool rsyslog-plugin rsyslog-plugin-tests
3337

34-
sonic-eventd: $(OBJS)
38+
sonic-eventd: $(OBJS) $(EVENTDB_OBJS)
3539
@echo 'Building target: $@'
3640
@echo 'Invoking: G++ Linker'
3741
$(CC) $(LDFLAGS) -o $(EVENTD_TARGET) $(OBJS) $(LIBS)
42+
$(CC) $(LDFLAGS) -o $(EVENTDB_TARGET) $(EVENTDB_OBJS) $(LIBS)
3843
@echo 'Finished building target: $@'
3944
@echo ' '
4045

@@ -52,12 +57,14 @@ rsyslog-plugin: $(RSYSLOG-PLUGIN_OBJS)
5257
@echo 'Finished building target: $@'
5358
@echo ' '
5459

55-
eventd-tests: $(TEST_OBJS)
60+
eventd-tests: $(TEST_OBJS) $(EVENTDB_TEST_OBJS)
5661
@echo 'Building target: $@'
5762
@echo 'Invoking: G++ Linker'
5863
$(CC) $(LDFLAGS) -o $(EVENTD_TEST) $(TEST_OBJS) $(LIBS) $(TEST_LIBS)
64+
$(CC) $(LDFLAGS) -o $(EVENTDB_TEST) $(EVENTDB_TEST_OBJS) $(LIBS) $(TEST_LIBS)
5965
@echo 'Finished building target: $@'
6066
$(EVENTD_TEST)
67+
$(EVENTDB_TEST)
6168
@echo 'Finished running tests'
6269
@echo ' '
6370

@@ -73,12 +80,16 @@ rsyslog-plugin-tests: $(RSYSLOG-PLUGIN-TEST_OBJS)
7380
install:
7481
$(MKDIR) -p $(DESTDIR)/usr/bin
7582
$(MKDIR) -p $(DESTDIR)/etc/monit/conf.d
83+
$(MKDIR) -p $(DESTDIR)/etc/evprofile
7684
$(CP) $(EVENTD_TARGET) $(DESTDIR)/usr/bin
7785
$(CP) $(EVENTD_TOOL) $(DESTDIR)/usr/bin
7886
$(CP) $(EVENTD_PUBLISH_TOOL) $(DESTDIR)/usr/bin
7987
$(CP) $(RSYSLOG-PLUGIN_TARGET) $(DESTDIR)/usr/bin
8088
$(CP) $(EVENTD_MONIT) $(DESTDIR)/usr/bin
8189
$(CP) $(EVENTD_MONIT_CONF) $(DESTDIR)/etc/monit/conf.d
90+
$(CP) $(EVENTDB_TARGET) $(DESTDIR)/usr/bin
91+
$(CP) $(EVENTDB_PROF) $(DESTDIR)/etc/eventd.json
92+
$(CP) $(EVENTDB_DEFAULT_PROFILE) $(DESTDIR)/etc/evprofile/default.json
8293

8394
deinstall:
8495
$(RM) -rf $(DESTDIR)/usr
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
usr/bin/eventd
2+
usr/bin/eventdb
23
usr/bin/events_tool
34
usr/bin/events_publish_tool.py
5+
etc/evprofile/default.json
6+
etc/eventd.json

src/sonic-eventd/etc/eventd.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"__README__": "Specify size of event history table. Whichever limit is hit first, eventd wraps event history table around and deletes older records.",
3+
"max-records": 40000,
4+
"max-days": 30
5+
}

0 commit comments

Comments
 (0)