Skip to content
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

Enable sairedis counter thread in 3 minutes after SONiC was started #1813

Merged
merged 2 commits into from
Jun 26, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
7 changes: 7 additions & 0 deletions files/build_templates/enable_counters.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Unit]
Description=Enable SONiC counters

[Service]
Type=oneshot
ExecStart=/usr/bin/counterpoll queue enable
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we enable counters for all types, including queue, port and pfcwd?
with /usr/bin/counterpoll queue enable /usr/bin/counterpoll port enable, /usr/bin/pfcwd counter_poll enable?
The latter pfcwd counter requires following to be taken into build image

sonic-net/sonic-swss@72a7f3a

sonic-net/sonic-utilities#273

Copy link
Contributor Author

@pavel-shirshov pavel-shirshov Jun 26, 2018

Choose a reason for hiding this comment

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

Sure. I created PR #1814 for master branch. After we test it in the master I'll update this PR

RemainAfterExit=yes
9 changes: 9 additions & 0 deletions files/build_templates/enable_counters.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Delays the SONiC counters gathering until SONiC has started

[Timer]
OnBootSec=3min
Unit=enable_counters.service

[Install]
WantedBy=timers.target
7 changes: 2 additions & 5 deletions files/build_templates/snmp.service.j2
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
[Unit]
Description=SNMP container
Requires=updategraph.service swss.service
After=updategraph.service swss.service
Requires=updategraph.service swss.service enable_counters.service
After=updategraph.service swss.service enable_counters.service

[Service]
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
9 changes: 9 additions & 0 deletions files/build_templates/snmp.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Delays snmp container until SONiC has started

[Timer]
OnBootSec=3min 30 sec
Unit=snmp.service

[Install]
WantedBy=timers.target
8 changes: 8 additions & 0 deletions files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,14 @@ sudo LANG=C chroot $FILESYSTEM_ROOT fuser -km /sys || true
sudo LANG=C chroot $FILESYSTEM_ROOT umount -lf /sys
{% endif %}

# Copy systemd timer configuration
# It implements delayed start of services
sudo cp $BUILD_TEMPLATES/enable_counters.timer $FILESYSTEM_ROOT/etc/systemd/system/
sudo cp $BUILD_TEMPLATES/enable_counters.service $FILESYSTEM_ROOT/etc/systemd/system/
sudo cp $BUILD_TEMPLATES/snmp.timer $FILESYSTEM_ROOT/etc/systemd/system/
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable enable_counters.timer
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable snmp.timer

sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get remove -y python-dev
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get clean -y
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get autoremove -y
Expand Down
2 changes: 1 addition & 1 deletion src/sonic-sairedis
2 changes: 1 addition & 1 deletion src/sonic-swss
2 changes: 1 addition & 1 deletion src/sonic-utilities