-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
SONiC system telemetry Support #1526
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
FROM docker-config-engine | ||
|
||
## Make apt-get non-interactive | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update | ||
|
||
RUN apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4 | ||
|
||
## Install redis-tools dependencies | ||
## TODO: implicitly install dependencies | ||
RUN apt-get -y install libjemalloc1 | ||
|
||
COPY \ | ||
{% for deb in docker_sonic_telemetry_debs.split(' ') -%} | ||
debs/{{ deb }}{{' '}} | ||
{%- endfor -%} | ||
debs/ | ||
|
||
RUN dpkg -i \ | ||
{% for deb in docker_sonic_telemetry_debs.split(' ') -%} | ||
debs/{{ deb }}{{' '}} | ||
{%- endfor %} | ||
|
||
COPY ["start.sh", "telemetry.sh", "dialout.sh", "/usr/bin/"] | ||
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] | ||
|
||
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y | ||
RUN rm -rf /debs | ||
|
||
ENTRYPOINT ["/usr/bin/supervisord"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Start with default config | ||
|
||
exec /usr/sbin/dialout_client_cli -insecure -logtostderr -v 2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
mkdir -p /var/sonic | ||
echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status | ||
|
||
rm -f /var/run/rsyslogd.pid | ||
|
||
supervisorctl start rsyslogd | ||
|
||
supervisorctl start telemetry | ||
supervisorctl start dialout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[supervisord] | ||
logfile_maxbytes=1MB | ||
logfile_backups=2 | ||
nodaemon=true | ||
|
||
[program:start.sh] | ||
command=/usr/bin/start.sh | ||
priority=1 | ||
autostart=true | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
|
||
[program:rsyslogd] | ||
command=/usr/sbin/rsyslogd -n | ||
priority=2 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
|
||
[program:telemetry] | ||
command=/usr/bin/telemetry.sh | ||
priority=3 | ||
autostart=false | ||
autorestart=true | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
|
||
[program:dialout] | ||
command=/usr/bin/dialout.sh | ||
priority=4 | ||
autostart=false | ||
autorestart=true | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Try to read telemetry and x509 config from ConfigDB. | ||
# Use default value if no valid config exists | ||
X509=`sonic-cfggen -d -v "DEVICE_METADATA['x509']"` | ||
TELEMETRY=`sonic-cfggen -d -v 'TELEMETRY.keys() | join(" ") if TELEMETRY'` | ||
|
||
TELEMETRY_ARGS=" -logtostderr" | ||
|
||
if [ ! -z $X509 ]; then | ||
SERVER_CRT=`sonic-cfggen -d -v "DEVICE_METADATA['x509']['server_crt']"` | ||
SERVER_KEY=`sonic-cfggen -d -v "DEVICE_METADATA['x509']['server_key']"` | ||
if [ -z $SERVER_CRT ] || [ -z $SERVER_KEY ]; then | ||
TELEMETRY_ARGS+=" --insecure" | ||
else | ||
TELEMETRY_ARGS+=" --server_crt $SERVER_CRT --server_key $SERVER_KEY " | ||
fi | ||
else | ||
TELEMETRY_ARGS+=" --insecure" | ||
fi | ||
|
||
if [ ! -z $X509 ]; then | ||
CA_CRT=`sonic-cfggen -d -v "DEVICE_METADATA['x509']['ca_crt']"` | ||
if [ ! -z $CA_CRT ]; then | ||
TELEMETRY_ARGS+=" --ca_crt $CA_CRT" | ||
fi | ||
fi | ||
|
||
# If no configuration entry exists for TELEMETRY, create one default port | ||
if [ -z $TELEMETRY ]; then | ||
redis-cli -n 4 hset "TELEMETRY|gnmi" port 8080 | ||
fi | ||
|
||
PORT=`sonic-cfggen -d -v "TELEMETRY['gnmi']['port']"` | ||
TELEMETRY_ARGS+=" --port $PORT" | ||
|
||
CLIENT_AUTH=`sonic-cfggen -d -v "TELEMETRY['gnmi']['client_auth']"` | ||
if [ -z $CLIENT_AUTH ] || [ $CLIENT_AUTH == "false" ]; then | ||
TELEMETRY_ARGS+=" --allow_no_client_auth" | ||
fi | ||
|
||
LOG_LEVEL=`sonic-cfggen -d -v "TELEMETRY['gnmi']['log_level']"` | ||
if [ ! -z $LOG_LEVEL ]; then | ||
TELEMETRY_ARGS+=" -v=$LOG_LEVEL" | ||
else | ||
TELEMETRY_ARGS+=" -v=2" | ||
fi | ||
|
||
exec /usr/sbin/telemetry ${TELEMETRY_ARGS} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[Unit] | ||
Description=Telemetry container | ||
Requires=swss.service | ||
After=swss.service | ||
|
||
[Service] | ||
User={{ sonicadmin_user }} | ||
ExecStartPre=/usr/bin/{{docker_container_name}}.sh start | ||
ExecStart=/usr/bin/{{docker_container_name}}.sh attach | ||
ExecStop=/usr/bin/{{docker_container_name}}.sh stop | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# docker image for telemetry agent | ||
|
||
DOCKER_TELEMETRY = docker-sonic-telemetry.gz | ||
$(DOCKER_TELEMETRY)_PATH = $(DOCKERS_PATH)/docker-sonic-telemetry | ||
$(DOCKER_TELEMETRY)_DEPENDS += $(REDIS_TOOLS) $(SONIC_TELEMETRY) | ||
$(DOCKER_TELEMETRY)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) | ||
SONIC_DOCKER_IMAGES += $(DOCKER_TELEMETRY) | ||
ifeq ($(ENABLE_SYSTEM_TELEMETRY), y) | ||
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_TELEMETRY) | ||
endif | ||
|
||
$(DOCKER_TELEMETRY)_CONTAINER_NAME = telemetry | ||
$(DOCKER_TELEMETRY)_RUN_OPT += --net=host --privileged -t | ||
$(DOCKER_TELEMETRY)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# SONiC telemetry package | ||
|
||
SONIC_TELEMETRY = sonic-telemetry_0.1_amd64.deb | ||
$(SONIC_TELEMETRY)_SRC_PATH = $(SRC_PATH)/telemetry | ||
SONIC_DPKG_DEBS += $(SONIC_TELEMETRY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export GOPATH=/tmp/go | ||
|
||
INSTALL := /usr/bin/install | ||
|
||
all: sonic-telemetry | ||
|
||
sonic-telemetry: | ||
/usr/local/go/bin/go get -v github.com/Azure/sonic-telemetry/telemetry | ||
/usr/local/go/bin/go get -v github.com/Azure/sonic-telemetry/dialout/dialout_client_cli | ||
|
||
install: | ||
$(INSTALL) -D ${GOPATH}/bin/telemetry $(DESTDIR)/usr/sbin/telemetry | ||
$(INSTALL) -D ${GOPATH}/bin/dialout_client_cli $(DESTDIR)/usr/sbin/dialout_client_cli | ||
|
||
deinstall: | ||
rm $(DESTDIR)/usr/sbin/telemetry | ||
rm $(DESTDIR)/usr/sbin/dialout_client_cli | ||
|
||
clean: | ||
rm -fr ${GOPATH} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
sonic-telemetry (0.1) UNRELEASED; urgency=medium | ||
|
||
* Initial release. | ||
|
||
-- Jipan Yang <[email protected]> Sat, 24 Mar 2018 12:48:22 -0700 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Source: sonic-telemetry | ||
Section: devel | ||
Priority: optional | ||
Maintainer: Jipan Yang <[email protected]> | ||
Build-Depends: debhelper (>= 8.0.0), | ||
dh-systemd | ||
Standards-Version: 3.9.3 | ||
Homepage: https://github.com/Azure/sonic-telemetry | ||
XS-Go-Import-Path: github.com/Azure/sonic-telemetry | ||
|
||
Package: sonic-telemetry | ||
Architecture: any | ||
Built-Using: ${misc:Built-Using} | ||
Depends: ${misc:Depends}, | ||
${shlibs:Depends} | ||
Description: SONiC telemetry | ||
sonic-telemetry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/make -f | ||
%: | ||
dh $@ --with systemd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
# | ||
### BEGIN INIT INFO | ||
# Provides: sonic-telemetry | ||
# Required-Start: $local_fs $network $remote_fs $syslog | ||
# Required-Stop: $local_fs $network $remote_fs $syslog | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Short-Description: start and stop the telemetry | ||
# Description: sonic-telemetry is an implementation of sonic telemetry daemon in Go | ||
### END INIT INFO | ||
# | ||
|
||
exit 0 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
better to move all these files into telemtry repo, the idea is that people can build debian package in the repo and can use it independent of other projects.
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.
Having problem creating debian package for the sonic-telemetry application in its own repo. Probably need more time to figure out the appropriate way to do it.