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

Create a bgp-neighbor stats and mount result to metal-core #352

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions partition/roles/metal-core/files/bgp-neighbor-stats.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Unit]
Description=Docker System Prune
robertvolkmann marked this conversation as resolved.
Show resolved Hide resolved

[Service]
Type=simple
ExecStart=/usr/bin/bgp-neighbor-stats.sh
robertvolkmann marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 10 additions & 0 deletions partition/roles/metal-core/files/bgp-neighbor-stats.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -e
robertvolkmann marked this conversation as resolved.
Show resolved Hide resolved
tmpfile=$(mktemp /var/run/bgp-neighbors/bgp-neighbors.XXXXXX)
destfile=/var/run/bgp-neighbors/bgp-neighbors.json

/usr/bin/vtysh -c "show ip bgp vrf all neighbors json" > "${tmpfile}"

mv "${tmpfile}" "${destfile}"
rm "${tmpfile}"
robertvolkmann marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 9 additions & 0 deletions partition/roles/metal-core/files/bgp-neighbor-stats.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Collect BGP Neighbor statistics

[Timer]
OnCalendar=*:0/2
robertvolkmann marked this conversation as resolved.
Show resolved Hide resolved
Persistent=false

[Install]
WantedBy=timers.target
35 changes: 35 additions & 0 deletions partition/roles/metal-core/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,41 @@
- frr-reload.service
when: metal_stack_switch_os_is_sonic

- name: create bgp-neighbor-stats directory
file:
path: /var/run/bgp-neighbors
state: directory
robertvolkmann marked this conversation as resolved.
Show resolved Hide resolved

- name: create bgp-neighbor-stats.sh
copy:
src: bgp-neighbor-stats.sh
dest: /usr/bin/bgp-neighbor-stats.sh
owner: root
group: root
mode: "0755"

- name: create bgp-neighbor-stats.service
copy:
src: bgp-neighbor-stats.service
dest: /etc/systemd/system/bgp-neighbor-stats.service
owner: root
group: root
mode: "0644"
robertvolkmann marked this conversation as resolved.
Show resolved Hide resolved

- name: create bgp-neighbor-stats.timer
copy:
src: bgp-neighbor-stats.timer
dest: /etc/systemd/system/bgp-neighbor-stats.timer
owner: root
group: root
mode: "0644"

- name: bgp-neighbor-stats.timer must be enabled and running
systemd:
name: bgp-neighbor-stats.timer
enabled: yes
state: started

- name: deploy metal-core
include_role:
name: ansible-common/roles/systemd-docker-service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
- "{{ metal_core_grpc_cert_dir }}:/certs/grpc:ro"
{% for volume_mount in metal_core_additional_volume_mounts %}
- {{ volume_mount }}
{% endfor %}
{% endfor %}
- /var/run/bgp-neighbors:/var/run/bgp-neighbors
Loading