@@ -2,7 +2,7 @@ package probe
2
2
3
3
import (
4
4
"log"
5
-
5
+ "strconv"
6
6
"github.com/bluecmd/fortigate_exporter/pkg/http"
7
7
"github.com/prometheus/client_golang/prometheus"
8
8
)
@@ -12,42 +12,42 @@ func probeSystemInterface(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.
12
12
mLink = prometheus .NewDesc (
13
13
"fortigate_interface_link_up" ,
14
14
"Whether the link is up or not (not taking into account admin status)" ,
15
- []string {"vdom" , "name" , "alias" , "parent" }, nil ,
15
+ []string {"vdom" , "name" , "vlanid" , " alias" , "parent" }, nil ,
16
16
)
17
17
mSpeed = prometheus .NewDesc (
18
18
"fortigate_interface_speed_bps" ,
19
19
"Speed negotiated on the port in bits/s" ,
20
- []string {"vdom" , "name" , "alias" , "parent" }, nil ,
20
+ []string {"vdom" , "name" , "vlanid" , " alias" , "parent" }, nil ,
21
21
)
22
22
mTxPkts = prometheus .NewDesc (
23
23
"fortigate_interface_transmit_packets_total" ,
24
24
"Number of packets transmitted on the interface" ,
25
- []string {"vdom" , "name" , "alias" , "parent" }, nil ,
25
+ []string {"vdom" , "name" , "vlanid" , " alias" , "parent" }, nil ,
26
26
)
27
27
mRxPkts = prometheus .NewDesc (
28
28
"fortigate_interface_receive_packets_total" ,
29
29
"Number of packets received on the interface" ,
30
- []string {"vdom" , "name" , "alias" , "parent" }, nil ,
30
+ []string {"vdom" , "name" , "vlanid" , " alias" , "parent" }, nil ,
31
31
)
32
32
mTxB = prometheus .NewDesc (
33
33
"fortigate_interface_transmit_bytes_total" ,
34
34
"Number of bytes transmitted on the interface" ,
35
- []string {"vdom" , "name" , "alias" , "parent" }, nil ,
35
+ []string {"vdom" , "name" , "vlanid" , " alias" , "parent" }, nil ,
36
36
)
37
37
mRxB = prometheus .NewDesc (
38
38
"fortigate_interface_receive_bytes_total" ,
39
39
"Number of bytes received on the interface" ,
40
- []string {"vdom" , "name" , "alias" , "parent" }, nil ,
40
+ []string {"vdom" , "name" , "vlanid" , " alias" , "parent" }, nil ,
41
41
)
42
42
mTxErr = prometheus .NewDesc (
43
43
"fortigate_interface_transmit_errors_total" ,
44
44
"Number of transmission errors detected on the interface" ,
45
- []string {"vdom" , "name" , "alias" , "parent" }, nil ,
45
+ []string {"vdom" , "name" , "vlanid" , " alias" , "parent" }, nil ,
46
46
)
47
47
mRxErr = prometheus .NewDesc (
48
48
"fortigate_interface_receive_errors_total" ,
49
49
"Number of reception errors detected on the interface" ,
50
- []string {"vdom" , "name" , "alias" , "parent" }, nil ,
50
+ []string {"vdom" , "name" , "vlanid" , " alias" , "parent" }, nil ,
51
51
)
52
52
)
53
53
@@ -64,6 +64,7 @@ func probeSystemInterface(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.
64
64
RxBytes float64 `json:"rx_bytes"`
65
65
TxErrors float64 `json:"tx_errors"`
66
66
RxErrors float64 `json:"rx_errors"`
67
+ VlanID int `json:"vlanid"`
67
68
Interface string
68
69
}
69
70
type ifResponse struct {
@@ -83,14 +84,15 @@ func probeSystemInterface(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.
83
84
if ir .Link {
84
85
linkf = 1.0
85
86
}
86
- m = append (m , prometheus .MustNewConstMetric (mLink , prometheus .GaugeValue , linkf , v .VDOM , ir .Name , ir .Alias , ir .Interface ))
87
- m = append (m , prometheus .MustNewConstMetric (mSpeed , prometheus .GaugeValue , ir .Speed * 1000 * 1000 , v .VDOM , ir .Name , ir .Alias , ir .Interface ))
88
- m = append (m , prometheus .MustNewConstMetric (mTxPkts , prometheus .CounterValue , ir .TxPackets , v .VDOM , ir .Name , ir .Alias , ir .Interface ))
89
- m = append (m , prometheus .MustNewConstMetric (mRxPkts , prometheus .CounterValue , ir .RxPackets , v .VDOM , ir .Name , ir .Alias , ir .Interface ))
90
- m = append (m , prometheus .MustNewConstMetric (mTxB , prometheus .CounterValue , ir .TxBytes , v .VDOM , ir .Name , ir .Alias , ir .Interface ))
91
- m = append (m , prometheus .MustNewConstMetric (mRxB , prometheus .CounterValue , ir .RxBytes , v .VDOM , ir .Name , ir .Alias , ir .Interface ))
92
- m = append (m , prometheus .MustNewConstMetric (mTxErr , prometheus .CounterValue , ir .TxErrors , v .VDOM , ir .Name , ir .Alias , ir .Interface ))
93
- m = append (m , prometheus .MustNewConstMetric (mRxErr , prometheus .CounterValue , ir .RxErrors , v .VDOM , ir .Name , ir .Alias , ir .Interface ))
87
+ vlan_string := strconv .Itoa (ir .VlanID )
88
+ m = append (m , prometheus .MustNewConstMetric (mLink , prometheus .GaugeValue , linkf , v .VDOM , ir .Name , vlan_string , ir .Alias , ir .Interface ))
89
+ m = append (m , prometheus .MustNewConstMetric (mSpeed , prometheus .GaugeValue , ir .Speed * 1000 * 1000 , v .VDOM , ir .Name , vlan_string , ir .Alias , ir .Interface ))
90
+ m = append (m , prometheus .MustNewConstMetric (mTxPkts , prometheus .CounterValue , ir .TxPackets , v .VDOM , ir .Name , vlan_string , ir .Alias , ir .Interface ))
91
+ m = append (m , prometheus .MustNewConstMetric (mRxPkts , prometheus .CounterValue , ir .RxPackets , v .VDOM , ir .Name , vlan_string , ir .Alias , ir .Interface ))
92
+ m = append (m , prometheus .MustNewConstMetric (mTxB , prometheus .CounterValue , ir .TxBytes , v .VDOM , ir .Name , vlan_string , ir .Alias , ir .Interface ))
93
+ m = append (m , prometheus .MustNewConstMetric (mRxB , prometheus .CounterValue , ir .RxBytes , v .VDOM , ir .Name , vlan_string , ir .Alias , ir .Interface ))
94
+ m = append (m , prometheus .MustNewConstMetric (mTxErr , prometheus .CounterValue , ir .TxErrors , v .VDOM , ir .Name , vlan_string , ir .Alias , ir .Interface ))
95
+ m = append (m , prometheus .MustNewConstMetric (mRxErr , prometheus .CounterValue , ir .RxErrors , v .VDOM , ir .Name , vlan_string , ir .Alias , ir .Interface ))
94
96
}
95
97
}
96
98
return m , true
0 commit comments