Add status_path label to connected_clients server metric.
This fixes an issue where the exporter would fail to work if a user attempted to monitor multiple OpenVPN processes in server mode as the metrics would clash without the status_path label.
This commit is contained in:
1 parent
8ae1b58a57
commit
6081a1671b
1 file changed
+4
-2
+4
-2
@@ -55,7 +55,8 @@ var (
|
|||||||
// Metrics specific to OpenVPN servers.
|
// Metrics specific to OpenVPN servers.
|
||||||
openvpnConnectedClientsDesc = prometheus.NewDesc(
|
openvpnConnectedClientsDesc = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName("openvpn", "", "openvpn_server_connected_clients"),
|
prometheus.BuildFQName("openvpn", "", "openvpn_server_connected_clients"),
|
||||||
"Number Of Connected Clients", nil, nil)
|
"Number Of Connected Clients",
|
||||||
|
[]string{"status_path"}, nil)
|
||||||
|
|
||||||
openvpnServerHeaders = map[string]OpenvpnServerHeader{
|
openvpnServerHeaders = map[string]OpenvpnServerHeader{
|
||||||
"CLIENT_LIST": {
|
"CLIENT_LIST": {
|
||||||
@@ -248,7 +249,8 @@ func CollectServerStatusFromReader(statusPath string, file io.Reader, ch chan<-
|
|||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
openvpnConnectedClientsDesc,
|
openvpnConnectedClientsDesc,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
float64(numberConnectedClient))
|
float64(numberConnectedClient),
|
||||||
|
statusPath)
|
||||||
return scanner.Err()
|
return scanner.Err()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user