Skip to content

Commit 5ad6d03

Browse files
committed
Fix formating
Signed-off-by: jiri <[email protected]>
1 parent 6d86bb6 commit 5ad6d03

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

pkg/probe/fortiswitch_health.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package probe
22

33
import (
4-
"log"
54
"fmt"
5+
"log"
66

77
"github.com/bluecmd/fortigate_exporter/pkg/http"
88
"github.com/prometheus/client_golang/prometheus"
@@ -142,7 +142,7 @@ func probeSwitchHealth(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.Met
142142
} else {
143143
cpuGood = 0
144144
}
145-
m = append(m, prometheus.MustNewConstMetric(mSumCPU, prometheus.GaugeValue, cpuGood, fmt.Sprintf("%.0f", hr.Summary.CPU.Value), hr.Summary.CPU.Rating, fswitch, r.Vdom))
145+
m = append(m, prometheus.MustNewConstMetric(mSumCPU, prometheus.GaugeValue, cpuGood, fmt.Sprintf("%.0f", hr.Summary.CPU.Value), hr.Summary.CPU.Rating, fswitch, r.Vdom))
146146

147147
var memGood float64
148148
if hr.Summary.Memory.Rating == "good" {
@@ -158,7 +158,7 @@ func probeSwitchHealth(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.Met
158158
} else {
159159
uptimeGood = 0
160160
}
161-
m = append(m, prometheus.MustNewConstMetric(mSumUpTime, prometheus.GaugeValue,uptimeGood, fmt.Sprintf("%0.f", hr.Summary.Uptime.Value), hr.Summary.Uptime.Rating, fswitch, r.Vdom))
161+
m = append(m, prometheus.MustNewConstMetric(mSumUpTime, prometheus.GaugeValue, uptimeGood, fmt.Sprintf("%0.f", hr.Summary.Uptime.Value), hr.Summary.Uptime.Rating, fswitch, r.Vdom))
162162

163163
var tempGood float64
164164
if hr.Summary.Temperature.Rating == "good" {

pkg/probe/fortiswitch_port_stats.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package probe
22

33
import (
4-
"log"
54
"fmt"
65
"github.com/bluecmd/fortigate_exporter/pkg/http"
76
"github.com/prometheus/client_golang/prometheus"
7+
"log"
88
)
99

1010
func probeSwitchPortStats(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
@@ -139,20 +139,20 @@ func probeSwitchPortStats(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.
139139
Vlan string
140140
}
141141
type swResult struct {
142-
Name string
143-
Serial string
144-
FgPeerIntfName string `json:"fgt_peer_intf_name"`
145-
Status string
146-
State string
147-
Connecting_from string `json:"connecting_from"`
148-
Vdom string
149-
Ports []portsInfo
150-
PortStats map[string]portStats `json:"port_stats"`
142+
Name string
143+
Serial string
144+
FgPeerIntfName string `json:"fgt_peer_intf_name"`
145+
Status string
146+
State string
147+
Connecting_from string `json:"connecting_from"`
148+
Vdom string
149+
Ports []portsInfo
150+
PortStats map[string]portStats `json:"port_stats"`
151151
}
152152

153153
type swPortStats struct {
154-
Serial string `json:"serial"`
155-
Ports map[string]portStats `json:"ports"`
154+
Serial string `json:"serial"`
155+
Ports map[string]portStats `json:"ports"`
156156
}
157157

158158
type swResponse struct {

pkg/probe/fortiswitch_port_stats_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func TestSwitchPortStats(t *testing.T) {
1515
c.prepare("api/v2/monitor/switch-controller/managed-switch", "testdata/fsw-interface.jsonnet")
1616

1717
// ✅ New API (FortiOS 7.0.1+)
18-
c.prepare("api/v2/monitor/switch-controller/managed-switch/status", "testdata/fsw-status7.jsonnet") // <-- Add this
18+
c.prepare("api/v2/monitor/switch-controller/managed-switch/status", "testdata/fsw-status7.jsonnet") // <-- Add this
1919
c.prepare("api/v2/monitor/switch-controller/managed-switch/port-stats", "testdata/fsw-port-stats7.jsonnet") // <-- Add this
2020

2121
r := prometheus.NewPedanticRegistry()
@@ -516,4 +516,4 @@ fortiswitch_port_transmit_unicast_packets_total{interface="port8",name="S108EN00
516516
fortiswitch_port_transmit_unicast_packets_total{interface="port8",name="S108EP4N00000000",serial_number="S108EP4N00000000",vdom="root"} 1.856726296e09
517517
fortiswitch_port_transmit_unicast_packets_total{interface="port9",name="S108EN0000000000",serial_number="S108EN0000000000",vdom="root"} 0
518518
fortiswitch_port_transmit_unicast_packets_total{interface="port9",name="S108EP4N00000000",serial_number="S108EP4N00000000",vdom="root"} 0
519-
`
519+
`

pkg/probe/probe_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (c *fakeClient) prepare(path string, jfile string) {
5050
d: []byte(output),
5151
q: u.Query(),
5252
})
53-
53+
5454
}
5555

5656
func (c *fakeClient) Get(path string, query string, obj interface{}) error {

0 commit comments

Comments
 (0)