This repository was archived by the owner on Aug 17, 2021. It is now read-only.
Open
Conversation
Member
Author
|
Hi @rayjanoka, |
|
Hey @BartVerc, I checked it out and it looks good! |
jirib
reviewed
Jul 7, 2020
| } | ||
|
|
||
| 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.
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 |
jirib
reviewed
Aug 27, 2020
| cmd.Stdout = &stdout | ||
| cmd.Stderr = &stderr | ||
| err := cmd.Run() | ||
| if err != nil { |
There was a problem hiding this comment.
I suppose this causes whole process die when ./sacli VPNStatus returns error. It smells it's not correct.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merging #30 into master.