@@ -15,6 +15,7 @@ package probe
1515
1616import (
1717 "log"
18+ "strconv"
1819
1920 "github.com/prometheus/client_golang/prometheus"
2021
@@ -26,42 +27,42 @@ func probeSystemInterface(c fortigatehttpclient.FortiHTTP, _ *TargetMetadata) ([
2627 mLink = prometheus .NewDesc (
2728 "fortigate_interface_link_up" ,
2829 "Whether the link is up or not (not taking into account admin status)" ,
29- []string {"vdom" , "name" , "alias" , "parent" }, nil ,
30+ []string {"vdom" , "name" , "vlanid" , " alias" , "parent" }, nil ,
3031 )
3132 mSpeed = prometheus .NewDesc (
3233 "fortigate_interface_speed_bps" ,
3334 "Speed negotiated on the port in bits/s" ,
34- []string {"vdom" , "name" , "alias" , "parent" }, nil ,
35+ []string {"vdom" , "name" , "vlanid" , " alias" , "parent" }, nil ,
3536 )
3637 mTxPkts = prometheus .NewDesc (
3738 "fortigate_interface_transmit_packets_total" ,
3839 "Number of packets transmitted on the interface" ,
39- []string {"vdom" , "name" , "alias" , "parent" }, nil ,
40+ []string {"vdom" , "name" , "vlanid" , " alias" , "parent" }, nil ,
4041 )
4142 mRxPkts = prometheus .NewDesc (
4243 "fortigate_interface_receive_packets_total" ,
4344 "Number of packets received on the interface" ,
44- []string {"vdom" , "name" , "alias" , "parent" }, nil ,
45+ []string {"vdom" , "name" , "vlanid" , " alias" , "parent" }, nil ,
4546 )
4647 mTxB = prometheus .NewDesc (
4748 "fortigate_interface_transmit_bytes_total" ,
4849 "Number of bytes transmitted on the interface" ,
49- []string {"vdom" , "name" , "alias" , "parent" }, nil ,
50+ []string {"vdom" , "name" , "vlanid" , " alias" , "parent" }, nil ,
5051 )
5152 mRxB = prometheus .NewDesc (
5253 "fortigate_interface_receive_bytes_total" ,
5354 "Number of bytes received on the interface" ,
54- []string {"vdom" , "name" , "alias" , "parent" }, nil ,
55+ []string {"vdom" , "name" , "vlanid" , " alias" , "parent" }, nil ,
5556 )
5657 mTxErr = prometheus .NewDesc (
5758 "fortigate_interface_transmit_errors_total" ,
5859 "Number of transmission errors detected on the interface" ,
59- []string {"vdom" , "name" , "alias" , "parent" }, nil ,
60+ []string {"vdom" , "name" , "vlanid" , " alias" , "parent" }, nil ,
6061 )
6162 mRxErr = prometheus .NewDesc (
6263 "fortigate_interface_receive_errors_total" ,
6364 "Number of reception errors detected on the interface" ,
64- []string {"vdom" , "name" , "alias" , "parent" }, nil ,
65+ []string {"vdom" , "name" , "vlanid" , " alias" , "parent" }, nil ,
6566 )
6667 )
6768
@@ -78,6 +79,7 @@ func probeSystemInterface(c fortigatehttpclient.FortiHTTP, _ *TargetMetadata) ([
7879 RxBytes float64 `json:"rx_bytes"`
7980 TxErrors float64 `json:"tx_errors"`
8081 RxErrors float64 `json:"rx_errors"`
82+ VlanID int `json:"vlanid"`
8183 Interface string
8284 }
8385 type ifResponse struct {
@@ -97,14 +99,15 @@ func probeSystemInterface(c fortigatehttpclient.FortiHTTP, _ *TargetMetadata) ([
9799 if ir .Link {
98100 linkf = 1.0
99101 }
100- m = append (m , prometheus .MustNewConstMetric (mLink , prometheus .GaugeValue , linkf , v .VDOM , ir .Name , ir .Alias , ir .Interface ))
101- m = append (m , prometheus .MustNewConstMetric (mSpeed , prometheus .GaugeValue , ir .Speed * 1000 * 1000 , v .VDOM , ir .Name , ir .Alias , ir .Interface ))
102- m = append (m , prometheus .MustNewConstMetric (mTxPkts , prometheus .CounterValue , ir .TxPackets , v .VDOM , ir .Name , ir .Alias , ir .Interface ))
103- m = append (m , prometheus .MustNewConstMetric (mRxPkts , prometheus .CounterValue , ir .RxPackets , v .VDOM , ir .Name , ir .Alias , ir .Interface ))
104- m = append (m , prometheus .MustNewConstMetric (mTxB , prometheus .CounterValue , ir .TxBytes , v .VDOM , ir .Name , ir .Alias , ir .Interface ))
105- m = append (m , prometheus .MustNewConstMetric (mRxB , prometheus .CounterValue , ir .RxBytes , v .VDOM , ir .Name , ir .Alias , ir .Interface ))
106- m = append (m , prometheus .MustNewConstMetric (mTxErr , prometheus .CounterValue , ir .TxErrors , v .VDOM , ir .Name , ir .Alias , ir .Interface ))
107- m = append (m , prometheus .MustNewConstMetric (mRxErr , prometheus .CounterValue , ir .RxErrors , v .VDOM , ir .Name , ir .Alias , ir .Interface ))
102+ vlan_string := strconv .Itoa (ir .VlanID )
103+ m = append (m , prometheus .MustNewConstMetric (mLink , prometheus .GaugeValue , linkf , v .VDOM , ir .Name , vlan_string , ir .Alias , ir .Interface ))
104+ m = append (m , prometheus .MustNewConstMetric (mSpeed , prometheus .GaugeValue , ir .Speed * 1000 * 1000 , v .VDOM , ir .Name , vlan_string , ir .Alias , ir .Interface ))
105+ m = append (m , prometheus .MustNewConstMetric (mTxPkts , prometheus .CounterValue , ir .TxPackets , v .VDOM , ir .Name , vlan_string , ir .Alias , ir .Interface ))
106+ m = append (m , prometheus .MustNewConstMetric (mRxPkts , prometheus .CounterValue , ir .RxPackets , v .VDOM , ir .Name , vlan_string , ir .Alias , ir .Interface ))
107+ m = append (m , prometheus .MustNewConstMetric (mTxB , prometheus .CounterValue , ir .TxBytes , v .VDOM , ir .Name , vlan_string , ir .Alias , ir .Interface ))
108+ m = append (m , prometheus .MustNewConstMetric (mRxB , prometheus .CounterValue , ir .RxBytes , v .VDOM , ir .Name , vlan_string , ir .Alias , ir .Interface ))
109+ m = append (m , prometheus .MustNewConstMetric (mTxErr , prometheus .CounterValue , ir .TxErrors , v .VDOM , ir .Name , vlan_string , ir .Alias , ir .Interface ))
110+ m = append (m , prometheus .MustNewConstMetric (mRxErr , prometheus .CounterValue , ir .RxErrors , v .VDOM , ir .Name , vlan_string , ir .Alias , ir .Interface ))
108111 }
109112 }
110113 return m , true
0 commit comments