@@ -22,21 +22,21 @@ import (
2222 "github.com/prometheus-community/fortigate_exporter/pkg/http"
2323)
2424
25- type BGPNeighborOld struct {
25+ type BGPNeighbor7_4 struct {
2626 NeighborIP string `json:"neighbor_ip"`
2727 LocalIP string `json:"local_ip"`
2828 RemoteAS int `json:"remote_as"`
2929 AdminStatus bool `json:"admin_status"`
3030 State string `json:"state"`
3131}
3232
33- type BGPNeighborResponseOld struct {
34- Results []BGPNeighborOld `json:"results"`
33+ type BGPNeighborResponse7_4 struct {
34+ Results []BGPNeighbor7_4 `json:"results"`
3535 VDOM string `json:"vdom"`
3636 Version string `json:"version"`
3737}
3838
39- func probeBGPNeighborsIPv4Old (c http.FortiHTTP , meta * TargetMetadata ) ([]prometheus.Metric , bool ) {
39+ func probeBGPNeighborsIPv47_4 (c http.FortiHTTP , meta * TargetMetadata ) ([]prometheus.Metric , bool ) {
4040 if meta .VersionMajor < 7 {
4141 // not supported version. Before 7.0.0 the requested endpoint doesn't exist
4242 return nil , true
@@ -47,7 +47,7 @@ func probeBGPNeighborsIPv4Old(c http.FortiHTTP, meta *TargetMetadata) ([]prometh
4747 []string {"vdom" , "remote_as" , "state" , "admin_status" , "local_ip" , "neighbor_ip" }, nil ,
4848 )
4949
50- var rs []BGPNeighborResponseOld
50+ var rs []BGPNeighborResponse7_4
5151
5252 if err := c .Get ("api/v2/monitor/router/bgp/neighbors" , "vdom=*" , & rs ); err != nil {
5353 log .Printf ("Error: %v" , err )
@@ -65,7 +65,7 @@ func probeBGPNeighborsIPv4Old(c http.FortiHTTP, meta *TargetMetadata) ([]prometh
6565 return m , true
6666}
6767
68- func probeBGPNeighborsIPv6Old (c http.FortiHTTP , meta * TargetMetadata ) ([]prometheus.Metric , bool ) {
68+ func probeBGPNeighborsIPv67_4 (c http.FortiHTTP , meta * TargetMetadata ) ([]prometheus.Metric , bool ) {
6969 if meta .VersionMajor < 7 {
7070 // not supported version. Before 7.0.0 the requested endpoint doesn't exist
7171 return nil , true
@@ -77,7 +77,7 @@ func probeBGPNeighborsIPv6Old(c http.FortiHTTP, meta *TargetMetadata) ([]prometh
7777 []string {"vdom" , "remote_as" , "state" , "admin_status" , "local_ip" , "neighbor_ip" }, nil ,
7878 )
7979
80- var rs []BGPNeighborResponseOld
80+ var rs []BGPNeighborResponse7_4
8181
8282 if err := c .Get ("api/v2/monitor/router/bgp/neighbors6" , "vdom=*" , & rs ); err != nil {
8383 log .Printf ("Error: %v" , err )
@@ -130,7 +130,7 @@ type BGPNeighborResponse struct {
130130
131131func probeBGPNeighborsIPv4 (c http.FortiHTTP , meta * TargetMetadata ) ([]prometheus.Metric , bool ) {
132132 if meta .VersionMajor == 7 && meta .VersionMinor < 6 {
133- return probeBGPNeighborsIPv4Old (c , meta )
133+ return probeBGPNeighborsIPv47_4 (c , meta )
134134 }
135135
136136 mBGPNeighborState := prometheus .NewDesc (
@@ -181,7 +181,7 @@ func probeBGPNeighborsIPv4(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus
181181
182182func probeBGPNeighborsIPv6 (c http.FortiHTTP , meta * TargetMetadata ) ([]prometheus.Metric , bool ) {
183183 if meta .VersionMajor == 7 && meta .VersionMinor < 6 {
184- return probeBGPNeighborsIPv6Old (c , meta )
184+ return probeBGPNeighborsIPv67_4 (c , meta )
185185 }
186186
187187 mBGPNeighborState := prometheus .NewDesc (
0 commit comments