diff --git a/ansible/install/group_vars/all.yml b/ansible/install/group_vars/all.yml
index 69f731016..5851d06ce 100644
--- a/ansible/install/group_vars/all.yml
+++ b/ansible/install/group_vars/all.yml
@@ -311,6 +311,14 @@ ovsagent_controller_monitor: false
ovsagent_networker_monitor: false
ovs_flows_monitoring: false
+######################################
+# OVN DB Tables Rows Count Monitoring
+######################################
+# Monitors OVN DB Tables rows count on controller.
+# You have to add wheel to sudo list with no password prompt on the controller host,
+# before enabling this plugin.
+ovn_monitoring: false
+
controller_monitored_ints:
- "tap"
diff --git a/ansible/install/roles/collectd-openstack/tasks/main.yml b/ansible/install/roles/collectd-openstack/tasks/main.yml
index 6104cf5ea..5e4825a4c 100644
--- a/ansible/install/roles/collectd-openstack/tasks/main.yml
+++ b/ansible/install/roles/collectd-openstack/tasks/main.yml
@@ -256,6 +256,8 @@
with_items:
- src: ovs_flows.sh
dest: /usr/local/bin/ovs_flows.sh
+ - src: ovn_monitoring.sh
+ dest: /usr/local/bin/ovn_monitoring.sh
when: "('Controller' in group_names ) or ('Compute' in group_names)"
# Rabbitmq monitoring
diff --git a/ansible/install/roles/collectd-openstack/templates/controller.collectd.conf.j2 b/ansible/install/roles/collectd-openstack/templates/controller.collectd.conf.j2
index 0d9443bac..beee1fc75 100644
--- a/ansible/install/roles/collectd-openstack/templates/controller.collectd.conf.j2
+++ b/ansible/install/roles/collectd-openstack/templates/controller.collectd.conf.j2
@@ -133,6 +133,73 @@ PreCacheChain "PreCache"
{% endif %}
+{% if ovn_monitoring %}
+
+ Instance "ovn_sbdb_Address_Set"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "sb" "Address_Set"
+
+
+ Instance "ovn_sbdb_Port_Group"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "sb" "Port_Group"
+
+
+ Instance "ovn_sbdb_Logical_Flow"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "sb" "Logical_Flow"
+
+
+ Instance "ovn_sbdb_Multicast_Group"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "sb" "Multicast_Group"
+
+
+ Instance "ovn_sbdb_Datapath_Binding"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "sb" "Datapath_Binding"
+
+
+ Instance "ovn_sbdb_Port_Binding"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "sb" "Port_Binding"
+
+
+ Instance "ovn_sbdb_MAC_Binding"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "sb" "MAC_Binding"
+
+
+ Instance "ovn_nbdb_Logical_Switch"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "nb" "Logical_Switch"
+
+
+ Instance "ovn_nbdb_Logical_Switch_Port"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "nb" "Logical_Switch_Port"
+
+
+ Instance "ovn_nbdb_Address_Set"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "nb" "Address_Set"
+
+
+ Instance "ovn_nbdb_Port_Group"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "nb" "Port_Group"
+
+
+ Instance "ovn_nbdb_Load_Balancer"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "nb" "Load_Balancer"
+
+
+ Instance "ovn_nbdb_ACL"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "nb" "ACL"
+
+
+ Instance "ovn_nbdb_Logical_Router"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "nb" "Logical_Router"
+
+
+ Instance "ovn_nbdb_Logical_Router_Port"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "nb" "Logical_Router_Port"
+
+
+ Instance "ovn_nbdb_Logical_Router_Static_Route"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "nb" "Logical_Router_Static_Route"
+
+{% endif %}
+
LongRunAvgLatency false
ConvertSpecialMetricTypes true
diff --git a/ansible/install/roles/collectd/tasks/main.yml b/ansible/install/roles/collectd/tasks/main.yml
index 5b7dceb84..5d6fc858e 100644
--- a/ansible/install/roles/collectd/tasks/main.yml
+++ b/ansible/install/roles/collectd/tasks/main.yml
@@ -83,6 +83,13 @@
dest: "{{ browbeat_containers_path }}/collectd-openstack/config/collectd.conf"
when: "config_type == 'compute' and ovn_compute_collectd_plugin"
+- name: Add stack user to wheel
+ shell: |
+ podman exec -it -u root collectd-controller usermod -G wheel stack
+ become: yes
+ become_user: root
+ when: "config_type == 'controller' and ovn_monitoring"
+
- name: Build and Run container
block:
- name: Build collectd-openstack container
@@ -104,6 +111,10 @@
{% if ovs_flows_monitoring %}
-v /etc/openvswitch/:/etc/openvswitch/ -v /var/run/openvswitch/:/var/run/openvswitch/ \
{% endif %}
+ {% if ovn_monitoring %}
+ -v /var/lib/openvswitch/ovn/ovnnb_db.sock:/var/lib/openvswitch/ovn/ovnnb_db.sock \
+ -v /var/lib/openvswitch/ovn/ovnsb_db.sock:/var/lib/openvswitch/ovn/ovnsb_db.sock \
+ {% endif %}
{% endif %}
collectd-openstack
become: yes
diff --git a/ansible/install/roles/collectd/templates/controller.collectd.conf.j2 b/ansible/install/roles/collectd/templates/controller.collectd.conf.j2
index ff9f8c780..0942e21f7 100644
--- a/ansible/install/roles/collectd/templates/controller.collectd.conf.j2
+++ b/ansible/install/roles/collectd/templates/controller.collectd.conf.j2
@@ -454,6 +454,73 @@ PreCacheChain "PreCache"
{% endif %}
+{% if ovn_monitoring %}
+
+ Instance "ovn_sbdb_Address_Set"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "sb" "Address_Set"
+
+
+ Instance "ovn_sbdb_Port_Group"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "sb" "Port_Group"
+
+
+ Instance "ovn_sbdb_Logical_Flow"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "sb" "Logical_Flow"
+
+
+ Instance "ovn_sbdb_Multicast_Group"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "sb" "Multicast_Group"
+
+
+ Instance "ovn_sbdb_Datapath_Binding"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "sb" "Datapath_Binding"
+
+
+ Instance "ovn_sbdb_Port_Binding"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "sb" "Port_Binding"
+
+
+ Instance "ovn_sbdb_MAC_Binding"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "sb" "MAC_Binding"
+
+
+ Instance "ovn_nbdb_Logical_Switch"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "nb" "Logical_Switch"
+
+
+ Instance "ovn_nbdb_Logical_Switch_Port"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "nb" "Logical_Switch_Port"
+
+
+ Instance "ovn_nbdb_Address_Set"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "nb" "Address_Set"
+
+
+ Instance "ovn_nbdb_Port_Group"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "nb" "Port_Group"
+
+
+ Instance "ovn_nbdb_Load_Balancer"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "nb" "Load_Balancer"
+
+
+ Instance "ovn_nbdb_ACL"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "nb" "ACL"
+
+
+ Instance "ovn_nbdb_Logical_Router"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "nb" "Logical_Router"
+
+
+ Instance "ovn_nbdb_Logical_Router_Port"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "nb" "Logical_Router_Port"
+
+
+ Instance "ovn_nbdb_Logical_Router_Static_Route"
+ Exec stack "/usr/local/bin/ovn_monitoring.sh" "nb" "Logical_Router_Static_Route"
+
+{% endif %}
+
{%if iostat_controller_collectd_plugin %}
ModulePath "/usr/local/bin/"
diff --git a/ansible/install/roles/grafana-dashboards/templates/openstack_general_system_performance.yaml.j2 b/ansible/install/roles/grafana-dashboards/templates/openstack_general_system_performance.yaml.j2
index 70bf35bc6..61b3c758a 100644
--- a/ansible/install/roles/grafana-dashboards/templates/openstack_general_system_performance.yaml.j2
+++ b/ansible/install/roles/grafana-dashboards/templates/openstack_general_system_performance.yaml.j2
@@ -164,6 +164,8 @@ dashboard:
{% include 'partials/osp_resources.yaml' %}
{% include 'partials/osp_response_times.yaml' %}
+
+ {% include 'partials/ovn_db_tables.yaml' %}
{% endif %}
{% include 'partials/ovn_metrics.yaml' %}
diff --git a/ansible/install/roles/grafana-dashboards/templates/partials/ovn_db_tables.yaml b/ansible/install/roles/grafana-dashboards/templates/partials/ovn_db_tables.yaml
new file mode 100644
index 000000000..4959f3367
--- /dev/null
+++ b/ansible/install/roles/grafana-dashboards/templates/partials/ovn_db_tables.yaml
@@ -0,0 +1,33 @@
+ - title: OVN DB Tables Rows Count
+ collapse: true
+ height: 200px
+ showTitle: true
+ panels:
+ - title: $Cloud - $Node - OVN DB Tables Rows Count
+ 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-ACL.gauge-ovn_ACL, 'ovn_ACL')
+ - target: alias($Cloud.$Node.ovn-Address_Set.gauge-ovn_Address_Set, 'ovn_Address_Set')
+ - target: alias($Cloud.$Node.ovn-Datapath_Binding.gauge-ovn_Datapath_Binding, 'ovn_Datapath_Binding')
+ - target: alias($Cloud.$Node.ovn-Load_Balancer.gauge-ovn_Load_Balancer, 'ovn_Load_Balancer')
+ - target: alias($Cloud.$Node.ovn-Logical_Flow.gauge-ovn_Logical_Flow, 'ovn_Logical_Flow')
+ - target: alias($Cloud.$Node.ovn-Logical_Router.gauge-ovn_Logical_Router, 'ovn_Logical_Router')
+ - target: alias($Cloud.$Node.ovn-Logical_Router_Port.gauge-ovn_Logical_Router_Port, 'ovn_Logical_Router_Port')
+ - target: alias($Cloud.$Node.ovn-Logical_Router_Static_Route.gauge-ovn_Logical_Router_Static_Route, 'ovn_Logical_Router_Static_Route')
+ - target: alias($Cloud.$Node.ovn-Logical_Switch.gauge-ovn_Logical_Switch, 'ovn_Logical_Switch')
+ - target: alias($Cloud.$Node.ovn-Logical_Switch_Port.gauge-ovn_Logical_Switch_Port, 'ovn_Logical_Switch_Port')
+ - target: alias($Cloud.$Node.ovn-MAC_Binding.gauge-ovn_MAC_Binding, 'ovn_MAC_Binding')
+ - target: alias($Cloud.$Node.ovn-Multicast_Group.gauge-ovn_Multicast_Group, 'ovn_Multicast_Group')
+ - target: alias($Cloud.$Node.ovn-Port_Binding.gauge-ovn_Port_Binding, 'ovn_Port_Binding')
+ - target: alias($Cloud.$Node.ovn-Port_Group.gauge-ovn_Port_Group, 'ovn_Port_Group')
diff --git a/browbeat-containers/collectd-openstack/Dockerfile b/browbeat-containers/collectd-openstack/Dockerfile
index ff07bed16..3f7e06c44 100644
--- a/browbeat-containers/collectd-openstack/Dockerfile
+++ b/browbeat-containers/collectd-openstack/Dockerfile
@@ -27,6 +27,7 @@ ADD files/collectd_gnocchi_status.py /usr/local/bin/collectd_gnocchi_status.py
ADD files/collectd_rabbitmq_monitoring.py /usr/local/bin/collectd_rabbitmq_monitoring.py
ADD files/collectd_swift_stat.py /usr/local/bin/collectd_swift_stat.py
ADD files/ovs_flows.sh /usr/local/bin/ovs_flows.sh
+ADD files/ovn_monitoring.sh /usr/local/bin/ovn_monitoring.sh
ADD config/collectd.conf /etc/collectd.conf
diff --git a/browbeat-containers/collectd-openstack/files/ovn_monitoring.sh b/browbeat-containers/collectd-openstack/files/ovn_monitoring.sh
new file mode 100755
index 000000000..cc72662ba
--- /dev/null
+++ b/browbeat-containers/collectd-openstack/files/ovn_monitoring.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+HOSTNAME="${COLLECTD_HOSTNAME:-`hostname -f`}"
+INTERVAL="${COLLECTD_INTERVAL:-15}"
+
+while sleep "$INTERVAL"; do
+ VALUE=$(sudo ovsdb-client dump unix:/var/lib/openvswitch/ovn/ovn$1_db.sock $2 | wc -l)
+ echo "PUTVAL \"$HOSTNAME/ovn-$2/gauge-ovn_$2\" interval=$INTERVAL N:$VALUE"
+done