-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Event mgmt #7813
base: master
Are you sure you want to change the base?
Event mgmt #7813
Changes from all commits
7416337
7964d26
766a30a
081b20d
773fd20
8528868
af8b22a
136aa90
4f9000f
d51e64f
cf2506f
98682d9
82e1312
42dc096
385bc0b
1296e95
135275b
1187a22
09f7b1a
96f887d
6db5f12
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
program:redis | ||
program:redis1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM docker-config-engine-buster | ||
|
||
ARG docker_container_name | ||
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf | ||
|
||
## Make apt-get non-interactive | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
COPY \ | ||
{% for deb in docker_eventd_debs.split(' ') -%} | ||
debs/{{ deb }}{{' '}} | ||
{%- endfor -%} | ||
debs/ | ||
|
||
RUN dpkg -i \ | ||
{% for deb in docker_eventd_debs.split(' ') -%} | ||
debs/{{ deb }}{{' '}} | ||
{%- endfor %} | ||
|
||
COPY ["docker-init.sh", "files/supervisor-proc-exit-listener", "/usr/bin/"] | ||
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] | ||
COPY ["critical_processes", "/etc/supervisor"] | ||
|
||
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y | ||
RUN rm -rf /debs | ||
|
||
ENTRYPOINT ["/usr/bin/docker-init.sh"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
program:eventd |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
sonic-db-cli EVENT_DB config set notify-keyspace-events AKE | ||
|
||
cp /var/evprofile/default.json /etc/evprofile/default.json | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cp /var/lib/evprofile/default.json /etc/evprofile/default.json There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previous comment. |
||
|
||
exec /usr/local/bin/supervisord | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
[supervisord] | ||
logfile_maxbytes=1MB | ||
logfile_backups=2 | ||
nodaemon=true | ||
|
||
[eventlistener:dependent-startup] | ||
command=python3 -m supervisord_dependent_startup | ||
autostart=true | ||
autorestart=unexpected | ||
startretries=0 | ||
exitcodes=0,3 | ||
events=PROCESS_STATE | ||
buffer_size=1024 | ||
|
||
[eventlistener:supervisor-proc-exit-listener] | ||
command=/usr/bin/supervisor-proc-exit-listener --container-name eventd | ||
events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING | ||
autostart=true | ||
autorestart=unexpected | ||
buffer_size=1024 | ||
|
||
[program:rsyslogd] | ||
command=/usr/sbin/rsyslogd -n -iNONE | ||
priority=1 | ||
autostart=false | ||
startsecs=1 | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
dependent_startup=true | ||
|
||
[program:eventd] | ||
command=/usr/bin/eventd | ||
priority=2 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
dependent_startup=true | ||
dependent_startup_wait_for=rsyslogd:running | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Unit] | ||
Description=Eventd container | ||
Requires=database.service | ||
After=database.service | ||
Before=ntp-config.service | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any particular reason for the before ntp-config service dependency? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At that time, I thought there might be a scenario ntpd may want to raise an event/alarm. |
||
StartLimitIntervalSec=1200 | ||
StartLimitBurst=20 | ||
|
||
[Service] | ||
ExecStartPre=/usr/bin/{{docker_container_name}}.sh start | ||
ExecStart=/usr/bin/{{docker_container_name}}.sh wait | ||
ExecStop=/usr/bin/{{docker_container_name}}.sh stop | ||
Restart=always | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
DPATH := $($(DOCKER_EVENTD)_PATH) | ||
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/docker-eventd.mk rules/docker-eventd.dep | ||
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) | ||
DEP_FILES += $(shell git ls-files $(DPATH)) | ||
|
||
$(DOCKER_EVENTD)_CACHE_MODE := GIT_CONTENT_SHA | ||
$(DOCKER_EVENTD)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) | ||
$(DOCKER_EVENTD)_DEP_FILES := $(DEP_FILES) | ||
|
||
$(eval $(call add_dbg_docker,$(DOCKER_EVENTD),$(DOCKER_EVENTD_DBG))) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Docker image for EVENTD | ||
|
||
DOCKER_EVENTD_STEM = docker-eventd | ||
DOCKER_EVENTD = $(DOCKER_EVENTD_STEM).gz | ||
DOCKER_EVENTD_DBG = $(DOCKER_EVENTD_STEM)-$(DBG_IMAGE_MARK).gz | ||
|
||
$(DOCKER_EVENTD)_PATH = $(DOCKERS_PATH)/$(DOCKER_EVENTD_STEM) | ||
|
||
$(DOCKER_EVENTD)_DEPENDS += $(EVENTD) $(LIBSWSSCOMMON) $(LIBEVENTNOTIFY) | ||
$(DOCKER_EVENTD)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) | ||
$(DOCKER_EVENTD)_DBG_DEPENDS += $(EVENTD) $(LIBSWSSCOMMON) $(LIBEVENTNOTIFY) | ||
$(DOCKER_EVENTD)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) | ||
|
||
SONIC_DOCKER_IMAGES += $(DOCKER_EVENTD) | ||
#SONIC_STRETCH_DOCKERS += $(DOCKER_EVENTD) | ||
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_EVENTD) | ||
|
||
SONIC_DOCKER_DBG_IMAGES += $(DOCKER_EVENTD_DBG) | ||
#SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_EVENTD_DBG) | ||
SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_EVENTD_DBG) | ||
|
||
$(DOCKER_EVENTD)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER) | ||
|
||
$(DOCKER_EVENTD)_CONTAINER_NAME = eventd | ||
$(DOCKER_EVENTD)_RUN_OPT += --net=host --privileged -t | ||
$(DOCKER_EVENTD)_RUN_OPT += -v /etc/sonic/:/etc/sonic/:ro | ||
$(DOCKER_EVENTD)_RUN_OPT += -v /etc/evprofile:/etc/evprofile:rw | ||
$(DOCKER_EVENTD)_RUN_OPT += -v /host/warmboot:/var/warmboot | ||
|
||
$(DOCKER_EVENTD)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
SPATH := $($(EVENTD)_SRC_PATH) | ||
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/eventd.mk rules/eventd.dep | ||
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) | ||
SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) | ||
|
||
$(EVENTD)_CACHE_MODE := GIT_CONTENT_SHA | ||
$(EVENTD)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) | ||
$(EVENTD)_DEP_FILES := $(DEP_FILES) | ||
$(EVENTD)_SMDEP_FILES := $(SMDEP_FILES) | ||
$(EVENTD)_SMDEP_PATHS := $(SPATH) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# EVENTD package | ||
# | ||
EVENTD_VERSION = 1.0.0 | ||
export EVENTD_VERSION | ||
|
||
EVENTD = eventd_$(EVENTD_VERSION)_amd64.deb | ||
$(EVENTD)_SRC_PATH = $(SRC_PATH)/sonic-eventd | ||
$(EVENTD)_DEPENDS += $(LIBSWSSCOMMON_DEV) $(LIBEVENTNOTIFY_DEV) | ||
$(EVENTD)_RDEPENDS += $(LIBSWSSCOMMON) $(LIBEVENTNOTIFY) | ||
SONIC_DPKG_DEBS += $(EVENTD) | ||
|
||
EVENTD_DBG = eventd-dbg_1.0.0_amd64.deb | ||
$(EVENTD_DBG)_DEPENDS += $(EVENTD) | ||
$(EVENTD_DBG)_RDEPENDS += $(EVENTD) | ||
$(eval $(call add_derived_package,$(EVENTD),$(EVENTD_DBG))) | ||
|
||
export EVENTD | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
SPATH := $($(LIBEVENTNOTIFY)_SRC_PATH) | ||
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/libeventnotify.mk rules/libeventnotify.dep | ||
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) | ||
SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) | ||
|
||
$(LIBEVENTNOTIFY)_CACHE_MODE := GIT_CONTENT_SHA | ||
$(LIBEVENTNOTIFY)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) | ||
$(LIBEVENTNOTIFY)_DEP_FILES := $(DEP_FILES) | ||
$(LIBEVENTNOTIFY)_SMDEP_FILES := $(SMDEP_FILES) | ||
$(LIBEVENTNOTIFY)_SMDEP_PATHS := $(SPATH) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# SONiC event notfiy library | ||
|
||
LIBEVENTNOTIFY_VERSION = 1.0.0 | ||
LIBEVENTNOTIFY = libeventnotify_$(LIBEVENTNOTIFY_VERSION)_amd64.deb | ||
$(LIBEVENTNOTIFY)_DEPENDS += $(LIBSWSSCOMMON_DEV) | ||
$(LIBEVENTNOTIFY)_RDEPENDS += $(LIBSWSSCOMMON) | ||
|
||
$(LIBEVENTNOTIFY)_SRC_PATH = $(SRC_PATH)/sonic-eventd/lib | ||
SONIC_DPKG_DEBS += $(LIBEVENTNOTIFY) | ||
|
||
LIBEVENTNOTIFY_DEV = libeventnotify-dev_$(LIBEVENTNOTIFY_VERSION)_amd64.deb | ||
$(eval $(call add_derived_package,$(LIBEVENTNOTIFY),$(LIBEVENTNOTIFY_DEV))) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
ACLOCAL_AMFLAGS = -I m4 | ||
#INCLUDES = -I $(top_srcdir) | ||
SUBDIRS = src | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
libtoolize --force --copy && | ||
autoreconf --force --install -I m4 | ||
rm -Rf autom4te.cache | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
AC_INIT([sonic-eventd],[1.0.0]) | ||
AC_CONFIG_SRCDIR([]) | ||
AC_CONFIG_AUX_DIR(config) | ||
AM_CONFIG_HEADER(config.h) | ||
AM_INIT_AUTOMAKE([foreign]) | ||
AC_LANG_C | ||
AC_LANG([C++]) | ||
AC_PROG_CC | ||
AC_PROG_CXX | ||
AC_PROG_LIBTOOL | ||
AC_HEADER_STDC | ||
|
||
AC_ARG_ENABLE(debug, | ||
[ --enable-debug Compile with debugging flags], | ||
[case "${enableval}" in | ||
yes) debug=true ;; | ||
no) debug=false ;; | ||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; | ||
esac],[debug=false]) | ||
AM_CONDITIONAL(DEBUG, test x$debug = xtrue) | ||
|
||
AC_ARG_ENABLE(gtest, | ||
[ --enable-gtest Compile with googletest flags], | ||
[case "${enableval}" in | ||
yes) gtest=true ;; | ||
no) gtest=false ;; | ||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-gtest) ;; | ||
esac],[gtest=false]) | ||
AM_CONDITIONAL(GTEST, test x$gtest = xtrue) | ||
|
||
CFLAGS_COMMON="-std=c++11 -Wall -fPIC -Wno-write-strings -I/usr/include/swss -I/usr/include" | ||
|
||
CFLAGS_COMMON+=" -Werror" | ||
|
||
AC_SUBST(CFLAGS_COMMON) | ||
|
||
dnl --------------- | ||
dnl dlopen & dlinfo | ||
dnl --------------- | ||
AC_SEARCH_LIBS([dlopen], [dl dld], [], [ | ||
AC_MSG_ERROR([unable to find the dlopen()]) | ||
]) | ||
|
||
AC_CONFIG_FILES([ | ||
src/Makefile | ||
Makefile | ||
]) | ||
|
||
AC_OUTPUT | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sonic (1.0.0) stable; urgency=medium | ||
|
||
* Initial release. | ||
|
||
-- Eventd <support@dell.com> Thu, 9 Apr 2021 12:00:00 -0800 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
9 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Source: sonic | ||
Maintainer: Dell | ||
Section: net | ||
Priority: optional | ||
Build-Depends: dh-exec (>=0.3), debhelper (>= 9), autotools-dev | ||
Standards-Version: 1.0.0 | ||
|
||
Package: eventd | ||
Architecture: any | ||
Depends: ${shlibs:Depends} | ||
Description: This package contains Eventd for SONiC project. | ||
|
||
Package: eventd-dbg | ||
Architecture: any | ||
Section: debug | ||
Priority: extra | ||
Depends: stp (=${binary:Version}) | ||
Description: debugging symbols for eventd | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/usr/lib |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/etc/eventd.json | ||
/var/evprofile/default.json | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change this to /var/lib/evprofile/default.json There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May I know the reason? But why? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for having a dedicated redis instance for event mgmt is because they are supposed to persist across reboots. If that is the intention, can we name this instance as redisp instead of redis1. Other applications can also use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
During the HLD review, we were asked to keep event/alarm tables in separate instance so that they wont grow too big that impacts other tables.