Skip to content

Commit b10ab25

Browse files
lucadelmonteclaude
andcommitted
Drop OVS dependency from OVN exporter
The OVN exporter no longer connects to or depends on the Open vSwitch database. All identity and version labels now come from local sources and the OVN Northbound/Southbound databases that the exporter already talks to. ovn_info labels: - kept: system_id, hostname, system_type, system_version - dropped: rundir, ovs_version, db_version - added: nb_schema_version, sb_schema_version Sources: - system_id and hostname come from os.Hostname() - system_type and system_version come from /etc/os-release (fall back to "unknown" if the file is missing) - nb_schema_version and sb_schema_version come from GetSchema() on the NB and SB databases Flags removed (unknown flag now errors at startup): - system.run.dir - database.vswitch.* (name, socket.remote, file.data.path, file.log.path, file.pid.path, file.system.id.path) - service.vswitchd.* (file.log.path, file.pid.path) Component lists for process probes, log file probes, and OVSDB clustering queries no longer include plain "ovsdb-server" or "ovs-vswitchd" -- only OVN NB/SB DB servers and ovn-northd remain. Dashboards and the kolla-ansible contrib templates are updated to match the new label set and no longer reference OVS container units. go.mod pins github.com/lucadelmonte/ovsdb at the commit where OvnClient.Connect() stops dialing the Open_vSwitch socket. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 9a127bd commit b10ab25

9 files changed

Lines changed: 25 additions & 72 deletions

File tree

cmd/ovn_exporter/main.go

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@ func main() {
2020
var pollInterval int
2121
var isShowVersion bool
2222
var logLevel string
23-
var systemRunDir string
24-
var databaseVswitchName string
25-
var databaseVswitchSocketRemote string
26-
var databaseVswitchFileDataPath string
27-
var databaseVswitchFileLogPath string
28-
var databaseVswitchFilePidPath string
29-
var databaseVswitchFileSystemIDPath string
3023
var databaseNorthboundName string
3124
var databaseNorthboundSocketRemote string
3225
var databaseNorthboundSocketControl string
@@ -45,8 +38,6 @@ func main() {
4538
var databaseSouthboundPortDefault int
4639
var databaseSouthboundPortSsl int
4740
var databaseSouthboundPortRaft int
48-
var serviceVswitchdFileLogPath string
49-
var serviceVswitchdFilePidPath string
5041
var serviceNorthdFileLogPath string
5142
var serviceNorthdFilePidPath string
5243

@@ -57,15 +48,6 @@ func main() {
5748
flag.BoolVar(&isShowVersion, "version", false, "version information")
5849
flag.StringVar(&logLevel, "log.level", "info", "logging severity level")
5950

60-
flag.StringVar(&systemRunDir, "system.run.dir", "/var/run/openvswitch", "OVS default run directory.")
61-
62-
flag.StringVar(&databaseVswitchName, "database.vswitch.name", "Open_vSwitch", "The name of OVS db.")
63-
flag.StringVar(&databaseVswitchSocketRemote, "database.vswitch.socket.remote", "unix:/var/run/openvswitch/db.sock", "JSON-RPC unix socket to OVS db.")
64-
flag.StringVar(&databaseVswitchFileDataPath, "database.vswitch.file.data.path", "/etc/openvswitch/conf.db", "OVS db file.")
65-
flag.StringVar(&databaseVswitchFileLogPath, "database.vswitch.file.log.path", "/var/log/openvswitch/ovsdb-server.log", "OVS db log file.")
66-
flag.StringVar(&databaseVswitchFilePidPath, "database.vswitch.file.pid.path", "/var/run/openvswitch/ovsdb-server.pid", "OVS db process id file.")
67-
flag.StringVar(&databaseVswitchFileSystemIDPath, "database.vswitch.file.system.id.path", "/etc/openvswitch/system-id.conf", "OVS system id file.")
68-
6951
flag.StringVar(&databaseNorthboundName, "database.northbound.name", "OVN_Northbound", "The name of OVN NB (northbound) db.")
7052
flag.StringVar(&databaseNorthboundSocketRemote, "database.northbound.socket.remote", "unix:/run/openvswitch/ovnnb_db.sock", "JSON-RPC unix socket to OVN NB db.")
7153
flag.StringVar(&databaseNorthboundSocketControl, "database.northbound.socket.control", "unix:/run/openvswitch/ovnnb_db.ctl", "JSON-RPC unix socket to OVN NB app.")
@@ -86,9 +68,6 @@ func main() {
8668
flag.IntVar(&databaseSouthboundPortSsl, "database.southbound.port.ssl", 6632, "OVN SB db network socket secure port.")
8769
flag.IntVar(&databaseSouthboundPortRaft, "database.southbound.port.raft", 6644, "OVN SB db network port for clustering (raft)")
8870

89-
flag.StringVar(&serviceVswitchdFileLogPath, "service.vswitchd.file.log.path", "/var/log/openvswitch/ovs-vswitchd.log", "OVS vswitchd daemon log file.")
90-
flag.StringVar(&serviceVswitchdFilePidPath, "service.vswitchd.file.pid.path", "/var/run/openvswitch/ovs-vswitchd.pid", "OVS vswitchd daemon process id file.")
91-
9271
flag.StringVar(&serviceNorthdFileLogPath, "service.ovn.northd.file.log.path", "/var/log/openvswitch/ovn-northd.log", "OVN northd daemon log file.")
9372
flag.StringVar(&serviceNorthdFilePidPath, "service.ovn.northd.file.pid.path", "/run/openvswitch/ovn-northd.pid", "OVN northd daemon process id file.")
9473

@@ -138,15 +117,6 @@ func main() {
138117
os.Exit(1)
139118
}
140119

141-
exporter.Client.System.RunDir = systemRunDir
142-
143-
exporter.Client.Database.Vswitch.Name = databaseVswitchName
144-
exporter.Client.Database.Vswitch.Socket.Remote = databaseVswitchSocketRemote
145-
exporter.Client.Database.Vswitch.File.Data.Path = databaseVswitchFileDataPath
146-
exporter.Client.Database.Vswitch.File.Log.Path = databaseVswitchFileLogPath
147-
exporter.Client.Database.Vswitch.File.Pid.Path = databaseVswitchFilePidPath
148-
exporter.Client.Database.Vswitch.File.SystemID.Path = databaseVswitchFileSystemIDPath
149-
150120
exporter.Client.Database.Northbound.Name = databaseNorthboundName
151121
exporter.Client.Database.Northbound.Socket.Remote = databaseNorthboundSocketRemote
152122
exporter.Client.Database.Northbound.Socket.Control = databaseNorthboundSocketControl
@@ -167,9 +137,6 @@ func main() {
167137
exporter.Client.Database.Southbound.Port.Ssl = databaseSouthboundPortSsl
168138
exporter.Client.Database.Southbound.Port.Raft = databaseSouthboundPortRaft
169139

170-
exporter.Client.Service.Vswitchd.File.Log.Path = serviceVswitchdFileLogPath
171-
exporter.Client.Service.Vswitchd.File.Pid.Path = serviceVswitchdFilePidPath
172-
173140
exporter.Client.Service.Northd.File.Log.Path = serviceNorthdFileLogPath
174141
exporter.Client.Service.Northd.File.Pid.Path = serviceNorthdFilePidPath
175142

contrib/kolla-ansible/README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ curl -s http://localhost:9476/metrics | wc -l
107107
| SB log | `/var/log/openvswitch/ovsdb-server-sb.log` | `/var/log/kolla/openvswitch/ovn-sb-db.log` |
108108
| northd PID | `/run/openvswitch/ovn-northd.pid` | `/run/ovn/ovn-northd.pid` |
109109
| northd log | `/var/log/openvswitch/ovn-northd.log` | `/var/log/kolla/openvswitch/ovn-northd.log` |
110-
| OVS data | `/etc/openvswitch/conf.db` | `/var/lib/docker/volumes/openvswitch_db/_data/conf.db` |
111-
| OVS log | `/var/log/openvswitch/ovsdb-server.log` | `/var/log/kolla/openvswitch/ovsdb-server.log` |
112-
| vswitchd log | `/var/log/openvswitch/ovs-vswitchd.log` | `/var/log/kolla/openvswitch/ovs-vswitchd.log` |
113110

114111
## Deployment Notes
115112

@@ -127,6 +124,6 @@ Both exporters complement each other for complete OVN/OVS visibility.
127124

128125
## Notes
129126

130-
- The systemd unit depends on `kolla-openvswitch_db-container.service` (required) and OVN containers (wanted)
131-
- System information is queried directly from the OVS database - no manual system-id file needed
127+
- The systemd unit depends on the OVN NB/SB DB containers (required) and the northd container (wanted); OVS is not required
128+
- `system_id` and `hostname` labels are derived from `os.Hostname()`; `system_type`/`system_version` come from `/etc/os-release`; NB/SB schema versions come from the OVN databases
132129
- Metrics are exposed on port 9476 by default

contrib/kolla-ansible/ovn-exporter-kolla.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
# without modifying the original service file.
1111

1212
[Unit]
13-
After=docker.service kolla-openvswitch_db-container.service kolla-ovn_nb_db-container.service kolla-ovn_sb_db-container.service kolla-ovn_northd-container.service
14-
Requires=kolla-openvswitch_db-container.service
15-
Wants=kolla-ovn_nb_db-container.service kolla-ovn_sb_db-container.service kolla-ovn_northd-container.service
13+
After=docker.service kolla-ovn_nb_db-container.service kolla-ovn_sb_db-container.service kolla-ovn_northd-container.service
14+
Requires=kolla-ovn_nb_db-container.service kolla-ovn_sb_db-container.service
15+
Wants=kolla-ovn_northd-container.service

contrib/kolla-ansible/ovn-exporter.env

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ OPTIONS="-database.northbound.socket.remote unix:/run/ovn/ovnnb_db.sock \
1414
-database.southbound.file.pid.path /run/ovn/ovnsb_db.pid \
1515
-database.southbound.file.data.path /var/lib/docker/volumes/ovn_sb_db/_data/ovnsb.db \
1616
-database.southbound.file.log.path /var/log/kolla/openvswitch/ovn-sb-db.log \
17-
-database.vswitch.file.data.path /var/lib/docker/volumes/openvswitch_db/_data/conf.db \
18-
-database.vswitch.file.log.path /var/log/kolla/openvswitch/ovsdb-server.log \
1917
-service.ovn.northd.file.log.path /var/log/kolla/openvswitch/ovn-northd.log \
20-
-service.ovn.northd.file.pid.path /run/ovn/ovn-northd.pid \
21-
-service.vswitchd.file.log.path /var/log/kolla/openvswitch/ovs-vswitchd.log"
18+
-service.ovn.northd.file.pid.path /run/ovn/ovn-northd.pid"
2219

2320
# Additional examples (commented out):
2421
# Change metrics port (default: 9476)

dashboards/ovn-sla-performance.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"uid": "${datasource}"
8686
},
8787
"editorMode": "code",
88-
"expr": "max by (hostname, ovn_version, db_version, system_type, system_version) (ovn_info)",
88+
"expr": "max by (hostname, nb_schema_version, sb_schema_version, system_type, system_version) (ovn_info)",
8989
"format": "table",
9090
"instant": true,
9191
"refId": "A"
@@ -105,15 +105,15 @@
105105
},
106106
"indexByName": {
107107
"hostname": 0,
108-
"ovn_version": 1,
109-
"db_version": 2,
108+
"nb_schema_version": 1,
109+
"sb_schema_version": 2,
110110
"system_type": 3,
111111
"system_version": 4
112112
},
113113
"renameByName": {
114114
"hostname": "Hostname",
115-
"ovn_version": "OVN Version",
116-
"db_version": "DB Version",
115+
"nb_schema_version": "NB Schema Version",
116+
"sb_schema_version": "SB Schema Version",
117117
"system_type": "System Type",
118118
"system_version": "OS Version"
119119
}

dashboards/ovn-system-overview.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"uid": "${datasource}"
8686
},
8787
"editorMode": "code",
88-
"expr": "max by (hostname, ovn_version, db_version, system_type, system_version) (ovn_info)",
88+
"expr": "max by (hostname, nb_schema_version, sb_schema_version, system_type, system_version) (ovn_info)",
8989
"format": "table",
9090
"instant": true,
9191
"refId": "A"
@@ -105,15 +105,15 @@
105105
},
106106
"indexByName": {
107107
"hostname": 0,
108-
"ovn_version": 1,
109-
"db_version": 2,
108+
"nb_schema_version": 1,
109+
"sb_schema_version": 2,
110110
"system_type": 3,
111111
"system_version": 4
112112
},
113113
"renameByName": {
114114
"hostname": "Hostname",
115-
"ovn_version": "OVN Version",
116-
"db_version": "DB Version",
115+
"nb_schema_version": "NB Schema Version",
116+
"sb_schema_version": "SB Schema Version",
117117
"system_type": "System Type",
118118
"system_version": "OS Version"
119119
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ require (
2525
google.golang.org/protobuf v1.36.9 // indirect
2626
)
2727

28-
replace github.com/greenpau/ovsdb => github.com/lucadelmonte/ovsdb v1.0.4-0.20251226203325-87e68f9104f3
28+
replace github.com/greenpau/ovsdb => github.com/lucadelmonte/ovsdb v1.0.8-0.20260420184110-d033504f3c1d

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
2121
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
2222
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
2323
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
24-
github.com/lucadelmonte/ovsdb v1.0.4-0.20251226203325-87e68f9104f3 h1:Qv+kEgfuBYOKzsRbGbFNRkOrI03D4EDnllDAq542Zpk=
25-
github.com/lucadelmonte/ovsdb v1.0.4-0.20251226203325-87e68f9104f3/go.mod h1:eZ72kooepm3wDa9o4YgmfEmbFCeibzSYrrZazwaopxo=
24+
github.com/lucadelmonte/ovsdb v1.0.8-0.20260420184110-d033504f3c1d h1:YKLG/SEOKVFOnuGlAfqypKGS0d5fExqSOewGChypm8A=
25+
github.com/lucadelmonte/ovsdb v1.0.8-0.20260420184110-d033504f3c1d/go.mod h1:eZ72kooepm3wDa9o4YgmfEmbFCeibzSYrrZazwaopxo=
2626
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
2727
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
2828
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=

pkg/ovn_exporter/ovn_exporter.go

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,11 @@ var (
6464
"This metric provides basic information about OVN stack. It is always set to 1.",
6565
[]string{
6666
"system_id",
67-
"rundir",
6867
"hostname",
6968
"system_type",
7069
"system_version",
71-
"ovs_version",
72-
"db_version",
70+
"nb_schema_version",
71+
"sb_schema_version",
7372
}, nil,
7473
)
7574
requestErrors = prometheus.NewDesc(
@@ -515,9 +514,9 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
515514
info,
516515
prometheus.GaugeValue,
517516
1,
518-
e.Client.System.ID, e.Client.System.RunDir, e.Client.System.Hostname,
517+
e.Client.System.ID, e.Client.System.Hostname,
519518
e.Client.System.Type, e.Client.System.Version,
520-
e.Client.Database.Vswitch.Version, e.Client.Database.Vswitch.Schema.Version,
519+
e.Client.Database.Northbound.Schema.Version, e.Client.Database.Southbound.Schema.Version,
521520
)
522521
ch <- prometheus.MustNewConstMetric(
523522
requestErrors,
@@ -587,7 +586,6 @@ func (e *Exporter) GatherMetrics() {
587586
if err != nil {
588587
level.Error(e.logger).Log(
589588
"msg", "GetSystemInfo() failed",
590-
"vswitch_name", e.Client.Database.Vswitch.Name,
591589
"system_id", e.Client.System.ID,
592590
"error", err.Error(),
593591
)
@@ -597,20 +595,17 @@ func (e *Exporter) GatherMetrics() {
597595
e.IncrementSuccessCounter()
598596
level.Debug(e.logger).Log(
599597
"msg", "GetSystemInfo() successful",
600-
"vswitch_name", e.Client.Database.Vswitch.Name,
601598
"system_id", e.Client.System.ID,
602599
)
603600
}
604601

605602
components := []string{
606-
"ovsdb-server",
607603
"ovsdb-server-southbound",
608604
"ovsdb-server-southbound-monitoring",
609605
"ovsdb-server-northbound",
610606
"ovsdb-server-northbound-monitoring",
611607
"ovn-northd",
612608
"ovn-northd-monitoring",
613-
"ovs-vswitchd",
614609
}
615610
for _, component := range components {
616611
p, err := e.Client.GetProcessInfo(component)
@@ -650,11 +645,9 @@ func (e *Exporter) GatherMetrics() {
650645
}
651646

652647
components = []string{
653-
"ovsdb-server",
654648
"ovsdb-server-southbound",
655649
"ovsdb-server-northbound",
656650
"ovn-northd",
657-
"ovs-vswitchd",
658651
}
659652
for _, component := range components {
660653
level.Debug(e.logger).Log(
@@ -1000,7 +993,6 @@ func (e *Exporter) GatherMetrics() {
1000993
southClusterID := ""
1001994

1002995
components = []string{
1003-
"ovsdb-server",
1004996
"ovsdb-server-southbound",
1005997
"ovsdb-server-northbound",
1006998
}
@@ -1455,9 +1447,9 @@ func (e *Exporter) GatherMetrics() {
14551447
info,
14561448
prometheus.GaugeValue,
14571449
1,
1458-
e.Client.System.ID, e.Client.System.RunDir, e.Client.System.Hostname,
1450+
e.Client.System.ID, e.Client.System.Hostname,
14591451
e.Client.System.Type, e.Client.System.Version,
1460-
e.Client.Database.Vswitch.Version, e.Client.Database.Vswitch.Schema.Version,
1452+
e.Client.Database.Northbound.Schema.Version, e.Client.Database.Southbound.Schema.Version,
14611453
))
14621454

14631455
e.metrics = append(e.metrics, prometheus.MustNewConstMetric(

0 commit comments

Comments
 (0)