Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

OVS Exporter won't start if all system related info is not configured #7

Open
pawelos99 opened this issue Feb 5, 2023 · 1 comment

Comments

@pawelos99
Copy link

I needed to spend a bit of time to get the ovs exporter working, just because some of the system parameters were not set in the ovs db, for example the simplest one is not having the "system-id.conf" file

caller=main.go:95 level=error msg="failed to init properly" error="open /etc/openvswitch/system-id.conf: no such file or directory"

and even fixing that by adding this file is not finishing this issue, because if any of system related values are not set, then it fails to start

ts=2023-02-04T19:42:23.488Z caller=main.go:95 level=error msg="failed to init properly" error="The 'SELECT ovs_version, db_version, system_type, system_version, external_ids FROM Open_vSwitch' query returned results but erred: data type '[]string' for 'ovs_version' column is unexpected in this context"
root@9adffaccfd8f:/# ovs-vsctl get open_vswitch . ovs_version
[]
root@9adffaccfd8f:/# ./ovs-exporter 
ts=2023-02-04T19:45:00.718Z caller=main.go:81 level=info msg="Starting exporter" exporter=ovs-exporter version="(version=1.0.5, branch=main, revision=v1.0.5-dirty)" build_context="(go=go1.18.10, user=root, date=2023-02-04)"
ts=2023-02-04T19:45:00.725Z caller=main.go:95 level=error msg="failed to init properly" error="The 'SELECT ovs_version, db_version, system_type, system_version, external_ids FROM Open_vSwitch' query returned results but erred: data type '[]string' for 'db_version' column is unexpected in this context"
root@9adffaccfd8f:/# ovs-vsctl get open_vswitch . db_version
[]
root@9adffaccfd8f:/# ovs-vsctl set open_vswitch . db_version="unknown"
root@9adffaccfd8f:/# ./ovs-exporter 
ts=2023-02-04T19:45:26.334Z caller=main.go:81 level=info msg="Starting exporter" exporter=ovs-exporter version="(version=1.0.5, branch=main, revision=v1.0.5-dirty)" build_context="(go=go1.18.10, user=root, date=2023-02-04)"
ts=2023-02-04T19:45:26.344Z caller=main.go:95 level=error msg="failed to init properly" error="The 'SELECT ovs_version, db_version, system_type, system_version, external_ids FROM Open_vSwitch' query returned results but erred: data type '[]string' for 'system_type' column is unexpected in this context"
root@9adffaccfd8f:/# ovs-vsctl set open_vswitch . system_type="unknown"
root@9adffaccfd8f:/# ./ovs-exporter 
ts=2023-02-04T19:45:38.961Z caller=main.go:81 level=info msg="Starting exporter" exporter=ovs-exporter version="(version=1.0.5, branch=main, revision=v1.0.5-dirty)" build_context="(go=go1.18.10, user=root, date=2023-02-04)"
ts=2023-02-04T19:45:38.972Z caller=main.go:95 level=error msg="failed to init properly" error="The 'SELECT ovs_version, db_version, system_type, system_version, external_ids FROM Open_vSwitch' query returned results but erred: data type '[]string' for 'system_version' column is unexpected in this context"
root@9adffaccfd8f:/# ovs-vsctl set open_vswitch . system_version="unknown"
root@9adffaccfd8f:/# ./ovs-exporter 
ts=2023-02-04T19:45:52.057Z caller=main.go:81 level=info msg="Starting exporter" exporter=ovs-exporter version="(version=1.0.5, branch=main, revision=v1.0.5-dirty)" build_context="(go=go1.18.10, user=root, date=2023-02-04)"
ts=2023-02-04T19:45:52.066Z caller=main.go:95 level=error msg="failed to init properly" error="The 'SELECT ovs_version, db_version, system_type, system_version, external_ids FROM Open_vSwitch' query returned results but erred: no 'system-id' found"

I think that ovs_exporter should not force user to set any of those if ovs itself is not complaining about that and you can work normally with any of those set to any value.
So to fix that this function should return empty strings or "unknown" in the case when ovs db contains no entry for system related info instead of raising errors in case of missing information.
What do you think?

@pawelos99 pawelos99 changed the title OVS Exporter won't start if all system info data is set OVS Exporter won't start if all system related info is not configured Feb 5, 2023
@Dmitry-Eremeev
Copy link

Fix will be soon

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants