Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5a18495
Local make customizations.
bhaveshdell Apr 21, 2025
f6c7669
Support for event persistence in redis-db.
bhaveshdell Jan 24, 2024
1cf4c19
Updates
bhaveshdell Jan 26, 2024
7d03adf
Updates including fix to eventdb in test enviroment.
bhaveshdell Jan 30, 2024
663fa6e
Add sonic yang to model event and alarm table.
bhaveshdell Feb 1, 2024
6ce9a2b
Add event/alarm persistence related testscases
bhaveshdell Feb 21, 2024
504283d
Remove file eventdb_ut.cpp.
bhaveshdell May 16, 2024
1fc703e
Updates to eventdb testsuite.
bhaveshdell May 17, 2024
3cd9f08
Revert changes to existing eventd UT.
bhaveshdell May 20, 2024
42ee3c2
Commit test related config files.
bhaveshdell May 20, 2024
f80901d
wRevert "Local make customizations."
bhaveshdell Apr 21, 2025
ef84372
Separate eventd and eventdb targets in the makefile.
bhaveshdell May 14, 2025
06ccda5
Address review comments.
bhaveshdell Sep 4, 2025
c6b23c7
Updates.
bhaveshdell Sep 15, 2025
abaada8
Remove debug statements.
bhaveshdell Sep 16, 2025
4a2a705
Add script to start eventdb.
bhaveshdell Sep 16, 2025
1d1d77d
Handle specific exception while parsing json file.
bhaveshdell Nov 10, 2025
f58f782
Add the new yangs to setup.py
bhaveshdell Nov 12, 2025
af2ce6c
Add the sonic-alarm.yang and sonic-event.yang as NON_CONF_YANG_FILES
bhaveshdell Nov 12, 2025
613b9c7
Address review comments.
bhaveshdell Nov 21, 2025
b5b3887
Remove eventdb loading as persistence is not added with this infra
bhaveshdell Dec 1, 2025
213003c
Merge branch 'master' into eventd-comm
bhaveshdell Jan 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions dockers/docker-database/database_config.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@
"instance" : "redis_bmp"
}
{% endif %}
,
"EVENT_DB" : {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some use cases, we just disable eventd.

  1. Will this feature work as expected if eventd disabled?
  2. Did you tested? Do you need adding a testcase?
  3. Do you need a standalone feature enablement/disablement flag?

"id" : 19,
"separator": "|",
"instance" : "redis"
}
},
"VERSION" : "1.0"
}
1 change: 1 addition & 0 deletions dockers/docker-eventd/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["critical_processes", "/etc/supervisor"]
COPY ["*.json", "/etc/rsyslog.d/rsyslog_plugin_conf/"]
COPY ["files/rsyslog_plugin.conf.j2", "/etc/rsyslog.d/rsyslog_plugin_conf/"]
COPY ["eventdb_wrapper.sh", "/usr/bin"]

RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin_conf/rsyslog_plugin.conf.j2 /etc/rsyslog.d/rsyslog_plugin_conf/host_events_info.json > /etc/rsyslog.d/rsyslog_plugin_conf/host_events.conf
RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin_conf/rsyslog_plugin.conf.j2 /etc/rsyslog.d/rsyslog_plugin_conf/bgp_events_info.json > /etc/rsyslog.d/rsyslog_plugin_conf/bgp_events.conf
Expand Down
18 changes: 18 additions & 0 deletions dockers/docker-eventd/eventdb_wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

JSON_FILE="/etc/evprofile/default.json"

# Check if file exists and is not empty
if [ -s "$JSON_FILE" ]; then
# Check if "events" is defined and has at least one entry
if jq -e '.events and (.events | length > 0)' "$JSON_FILE" > /dev/null; then
echo "Valid events found. Starting eventdb."
exec /usr/bin/eventdb
else
echo "'events' list is missing or empty. Skipping eventdb start."
exit 0
fi
else
echo "JSON file missing or empty. Skipping eventdb start."
exit 0
fi
13 changes: 13 additions & 0 deletions dockers/docker-eventd/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,16 @@ stderr_syslog=true
dependent_startup=true
dependent_startup_wait_for=start:exited

[program:eventdb]
command=/usr/bin/eventdb_wrapper.sh
priority=3
autostart=false
autorestart=false
startsecs=0
startretries=0
exitcodes=0
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=start:exited

30 changes: 27 additions & 3 deletions src/sonic-eventd/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
RM := rm -rf
EVENTD_TARGET := eventd
EVENTD_TEST := tests/tests
EVENTDB_TEST := tests/eventdb
EVENTD_TOOL := tools/events_tool
EVENTD_PUBLISH_TOOL := tools/events_publish_tool.py
RSYSLOG-PLUGIN_TARGET := rsyslog_plugin/rsyslog_plugin
RSYSLOG-PLUGIN_TEST := rsyslog_plugin_tests/tests
EVENTD_MONIT := tools/events_monit_test.py
EVENTD_MONIT_CONF := tools/monit_events
EVENTDB_TARGET := eventdb
EVENTDB_DEFAULT_PROFILE := var/evprofile/default.json
EVENTDB_PROF := etc/eventd.json

CP := cp
MKDIR := mkdir
Expand All @@ -19,7 +23,7 @@ PWD := $(shell pwd)

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS) $(OBJS)
-include $(C_DEPS) $(OBJS) $(EVENTDB_OBJS)
endif
endif

Expand All @@ -29,9 +33,9 @@ endif
-include rsyslog_plugin/subdir.mk
-include rsyslog_plugin_tests/subdir.mk

all: sonic-eventd eventd-tool rsyslog-plugin
all: sonic-eventd eventd-tool rsyslog-plugin sonic-eventdb

test: eventd-tests rsyslog-plugin-tests
test: eventd-tests rsyslog-plugin-tests eventdb-tests

sonic-eventd: $(OBJS)
@echo 'Building target: $@'
Expand All @@ -40,6 +44,13 @@ sonic-eventd: $(OBJS)
@echo 'Finished building target: $@'
@echo ' '

sonic-eventdb: $(EVENTDB_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: G++ Linker'
$(CC) $(LDFLAGS) -o $(EVENTDB_TARGET) $(EVENTDB_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '

eventd-tool: $(TOOL_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: G++ Linker'
Expand All @@ -63,6 +74,15 @@ eventd-tests: $(TEST_OBJS)
@echo 'Finished running tests'
@echo ' '

eventdb-tests: $(EVENTDB_TEST_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: G++ Linker'
$(CC) $(LDFLAGS) -o $(EVENTDB_TEST) $(EVENTDB_TEST_OBJS) $(LIBS) $(TEST_LIBS)
@echo 'Finished building target: $@'
$(EVENTDB_TEST)
@echo 'Finished running tests'
@echo ' '

rsyslog-plugin-tests: $(RSYSLOG-PLUGIN-TEST_OBJS)
@echo 'BUILDING target: $@'
@echo 'Invoking G++ Linker'
Expand All @@ -75,12 +95,16 @@ rsyslog-plugin-tests: $(RSYSLOG-PLUGIN-TEST_OBJS)
install:
$(MKDIR) -p $(DESTDIR)/usr/bin
$(MKDIR) -p $(DESTDIR)/etc/monit/conf.d
$(MKDIR) -p $(DESTDIR)/etc/evprofile
$(CP) $(EVENTD_TARGET) $(DESTDIR)/usr/bin
$(CP) $(EVENTD_TOOL) $(DESTDIR)/usr/bin
$(CP) $(EVENTD_PUBLISH_TOOL) $(DESTDIR)/usr/bin
$(CP) $(RSYSLOG-PLUGIN_TARGET) $(DESTDIR)/usr/bin
$(CP) $(EVENTD_MONIT) $(DESTDIR)/usr/bin
$(CP) $(EVENTD_MONIT_CONF) $(DESTDIR)/etc/monit/conf.d
$(CP) $(EVENTDB_TARGET) $(DESTDIR)/usr/bin
$(CP) $(EVENTDB_PROF) $(DESTDIR)/etc/eventd.json
$(CP) $(EVENTDB_DEFAULT_PROFILE) $(DESTDIR)/etc/evprofile/default.json

deinstall:
$(RM) -rf $(DESTDIR)/usr
Expand Down
3 changes: 3 additions & 0 deletions src/sonic-eventd/debian/sonic-eventd.install
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
usr/bin/eventd
usr/bin/eventdb
usr/bin/events_tool
usr/bin/events_publish_tool.py
etc/evprofile/default.json
etc/eventd.json
5 changes: 5 additions & 0 deletions src/sonic-eventd/etc/eventd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"__README__": "Specify size of event history table. Whichever limit is hit first, eventd wraps event history table around and deletes older records.",
"max-records": 40000,
"max-days": 30
}
Loading
Loading