From be6cc86d9543f821e76bb823c2c2764fad567d13 Mon Sep 17 00:00:00 2001 From: bobz965 Date: Mon, 11 Mar 2024 19:03:10 +0800 Subject: [PATCH] fix cmd inject (#3809) Signed-off-by: bobz965 --- pkg/ovnmonitor/util.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/ovnmonitor/util.go b/pkg/ovnmonitor/util.go index f6dbad4bd0b..14dbd662962 100644 --- a/pkg/ovnmonitor/util.go +++ b/pkg/ovnmonitor/util.go @@ -43,12 +43,12 @@ func (e *Exporter) getOvnStatus() map[string]int { result["ovsdb-server-southbound"] = parseDbStatus(string(output)) // get ovn-northd status - pid, err := os.ReadFile("/var/run/ovn/ovn-northd.pid") + pid, err := os.ReadFile(e.Client.Service.Northd.File.Pid.Path) if err != nil { klog.Errorf("read ovn-northd pid failed, err %v", err) result["ovn-northd"] = 0 } else { - cmdstr := "ovs-appctl -t /var/run/ovn/ovn-northd." + strings.Trim(string(pid), "\n") + ".ctl status" + cmdstr := fmt.Sprintf("ovs-appctl -t /var/run/ovn/ovn-northd.%s.ctl status", strings.Trim(string(pid), "\n")) klog.V(3).Infof("cmd is %v", cmdstr) cmd := exec.Command("sh", "-c", cmdstr) output, err := cmd.CombinedOutput()