-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch adds monitoring for OVN RAFT. Change-Id: I806507696d5534005c4905ecac3f87ec422f05ce
- Loading branch information
1 parent
38a589e
commit e95a430
Showing
7 changed files
with
187 additions
and
1 deletion.
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
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
73 changes: 73 additions & 0 deletions
73
ansible/install/roles/grafana-dashboards/templates/partials/ovn_raft_monitoring.yaml
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,73 @@ | ||
- title: OVN RAFT Metrics | ||
collapse: true | ||
height: 200px | ||
showTitle: true | ||
panels: | ||
- title: $Cloud - $Node - OVN RAFT Northbound DB Metrics | ||
type: graph | ||
legend: | ||
alignAsTable: true | ||
avg: false | ||
current: true | ||
max: true | ||
min: true | ||
rightSide: true | ||
show: true | ||
total: false | ||
values: true | ||
nullPointMode: 'null' | ||
targets: | ||
- target: alias($Cloud.$Node.ovn_raft_monitoring.gauge-nb_disconnections, 'disconnections') | ||
- target: alias($Cloud.$Node.ovn_raft_monitoring.gauge-nb_election_timer, 'election_timer') | ||
- target: alias($Cloud.$Node.ovn_raft_monitoring.gauge-nb_entries_not_applied, 'entries_not_yet_applied') | ||
- target: alias($Cloud.$Node.ovn_raft_monitoring.gauge-nb_entries_not_committed, 'entries_not_yet_committed') | ||
- target: alias($Cloud.$Node.ovn_raft_monitoring.gauge-nb_term, 'term') | ||
- title: $Cloud - $Node - OVN RAFT Northbound DB Leader Data | ||
type: graph | ||
legend: | ||
alignAsTable: true | ||
avg: false | ||
current: true | ||
max: true | ||
min: true | ||
rightSide: true | ||
show: true | ||
total: false | ||
values: true | ||
nullPointMode: 'null' | ||
targets: | ||
- target: alias($Cloud.$Node.ovn_raft_monitoring.gauge-nb_is_leader, 'is_selected_controller_leader') | ||
- title: $Cloud - $Node - OVN RAFT Southbound DB Metrics | ||
type: graph | ||
legend: | ||
alignAsTable: true | ||
avg: false | ||
current: true | ||
max: true | ||
min: true | ||
rightSide: true | ||
show: true | ||
total: false | ||
values: true | ||
nullPointMode: 'null' | ||
targets: | ||
- target: alias($Cloud.$Node.ovn_raft_monitoring.gauge-sb_disconnections, 'disconnections') | ||
- target: alias($Cloud.$Node.ovn_raft_monitoring.gauge-sb_election_timer, 'election_timer') | ||
- target: alias($Cloud.$Node.ovn_raft_monitoring.gauge-sb_entries_not_applied, 'entries_not_yet_applied') | ||
- target: alias($Cloud.$Node.ovn_raft_monitoring.gauge-sb_entries_not_committed, 'entries_not_yet_committed') | ||
- target: alias($Cloud.$Node.ovn_raft_monitoring.gauge-sb_term, 'term') | ||
- title: $Cloud - $Node - OVN RAFT Southbound DB Leader Data | ||
type: graph | ||
legend: | ||
alignAsTable: true | ||
avg: false | ||
current: true | ||
max: true | ||
min: true | ||
rightSide: true | ||
show: true | ||
total: false | ||
values: true | ||
nullPointMode: 'null' | ||
targets: | ||
- target: alias($Cloud.$Node.ovn_raft_monitoring.gauge-sb_is_leader, 'is_selected_controller_leader') |
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
88 changes: 88 additions & 0 deletions
88
browbeat-containers/collectd-openstack/files/collectd_ovn_raft_monitoring.py
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,88 @@ | ||
import collectd | ||
import subprocess | ||
|
||
INTERVAL = 30 | ||
|
||
def config_func(config): | ||
for node in config.children: | ||
key = node.key.lower() | ||
|
||
if key == 'interval': | ||
global INTERVAL | ||
INTERVAL = int(node.values[0]) | ||
|
||
def read_func(): | ||
global INTERVAL | ||
|
||
nbdb_process = subprocess.Popen(['sudo','ovs-appctl', '-t', '/var/lib/openvswitch/ovn/ovnnb_db.ctl', | ||
'cluster/status', 'OVN_Northbound'], stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE) | ||
nbdb_out, nbdb_err = nbdb_process.communicate() | ||
nbdb_out = nbdb_out.decode("utf-8") | ||
|
||
sbdb_process = subprocess.Popen(['sudo', 'ovs-appctl', '-t', '/var/lib/openvswitch/ovn/ovnsb_db.ctl', | ||
'cluster/status', 'OVN_Southbound'], stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE) | ||
sbdb_out, sbdb_err = sbdb_process.communicate() | ||
sbdb_out = sbdb_out.decode("utf-8") | ||
|
||
components_list = ["nb_term", "nb_election_timer", "nb_entries_not_committed", | ||
"nb_entries_not_applied", "nb_disconnections", "nb_is_leader", | ||
"sb_term", "sb_election_timer", "sb_entries_not_committed", | ||
"sb_entries_not_applied", "sb_disconnections", "sb_is_leader"] | ||
|
||
for component in components_list: | ||
val = 0 | ||
|
||
if "nb" in component: | ||
for line in nbdb_out.split("\n"): | ||
if component == "nb_term" and "Term:" in line: | ||
val = int(line.split(": ")[1]) | ||
break | ||
elif component == "nb_election_timer" and "Election timer:" in line: | ||
val = int(line.split(": ")[1]) | ||
break | ||
elif component == "nb_entries_not_committed" and "Entries not yet committed:" in line: | ||
val = int(line.split(": ")[1]) | ||
break | ||
elif component == "nb_entries_not_applied" and "Entries not yet applied:" in line: | ||
val = int(line.split(": ")[1]) | ||
break | ||
elif component == "nb_disconnections" and "Disconnections:" in line: | ||
val = int(line.split(": ")[1]) | ||
break | ||
elif component == "nb_is_leader" and "Role: leader" in line: | ||
val = 1 | ||
break | ||
|
||
elif "sb" in component: | ||
for line in sbdb_out.split("\n"): | ||
if component == "sb_term" and "Term:" in line: | ||
val = int(line.split(": ")[1]) | ||
break | ||
elif component == "sb_election_timer" and "Election timer:" in line: | ||
val = int(line.split(": ")[1]) | ||
break | ||
elif component == "sb_entries_not_committed" and "Entries not yet committed:" in line: | ||
val = int(line.split(": ")[1]) | ||
break | ||
elif component == "sb_entries_not_applied" and "Entries not yet applied:" in line: | ||
val = int(line.split(": ")[1]) | ||
break | ||
elif component == "sb_disconnections" and "Disconnections:" in line: | ||
val = int(line.split(": ")[1]) | ||
break | ||
elif component == "sb_is_leader" and "Role: leader" in line: | ||
val = 1 | ||
break | ||
|
||
metric = collectd.Values() | ||
metric.plugin = 'ovn_raft_monitoring' | ||
metric.interval = INTERVAL | ||
metric.type = 'gauge' | ||
metric.type_instance = component | ||
metric.values = [val] | ||
metric.dispatch() | ||
|
||
collectd.register_config(config_func) | ||
collectd.register_read(read_func) |