-
Notifications
You must be signed in to change notification settings - Fork 105
Mergepull30 #32
base: master
Are you sure you want to change the base?
Mergepull30 #32
Conversation
Hi @rayjanoka, |
Hey @BartVerc, I checked it out and it looks good! |
@@ -338,26 +488,63 @@ func (e *OpenVPNExporter) collectStatusFromFile(statusPath string, ch chan<- pro | |||
return e.collectStatusFromReader(statusPath, conn, ch) | |||
} | |||
|
|||
func (e *OpenVPNExporter) collectStatusFromApi(statusPath string, ch chan<- prometheus.Metric) error { | |||
cmd := exec.Command("/usr/local/openvpn_as/scripts/sacli", "VPNStatus") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we run it via sudo? I don't want to give full rights to exporter. Sorry, I'm not docker fan :)
This works for me:
--- a/exporters/openvpn_exporter.go
+++ b/exporters/openvpn_exporter.go
@@ -489,7 +489,7 @@ func (e *OpenVPNExporter) collectStatusFromFile(statusPath string, ch chan<- pro
}
func (e *OpenVPNExporter) collectStatusFromApi(statusPath string, ch chan<- prometheus.Metric) error {
- cmd := exec.Command("/usr/local/openvpn_as/scripts/sacli", "VPNStatus")
+ cmd := exec.Command("/bin/sudo", "/usr/local/openvpn_as/scripts/sacli", "VPNStatus")
var stdout, stderr bytes.Buffer
cmd.Stdout = &stdout
cmd.Stderr = &stderr
Works for me but as I don't want run docker at VPN GW:
BTW, what could be also nice would be metrics for certs' expiration. |
I see that whole process dies when there's error from
|
cmd.Stdout = &stdout | ||
cmd.Stderr = &stderr | ||
err := cmd.Run() | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose this causes whole process die when ./sacli VPNStatus
returns error. It smells it's not correct.
Merging #30 into master.