@@ -17,11 +17,12 @@ import (
1717 "log"
1818 "strconv"
1919
20- "github.com/prometheus-community/fortigate_exporter/pkg/http"
2120 "github.com/prometheus/client_golang/prometheus"
21+
22+ "github.com/prometheus-community/fortigate_exporter/pkg/http"
2223)
2324
24- func probeSystemCentralManagementStatus (c http.FortiHTTP , meta * TargetMetadata ) ([]prometheus.Metric , bool ) {
25+ func probeSystemCentralManagementStatus (c http.FortiHTTP , _ * TargetMetadata ) ([]prometheus.Metric , bool ) {
2526 var (
2627 mode = prometheus .NewDesc (
2728 "fortigate_system_central_management_mode" ,
@@ -45,7 +46,7 @@ func probeSystemCentralManagementStatus (c http.FortiHTTP, meta *TargetMetadata)
4546 Server string `json:"server"`
4647 Status string `json:"status"`
4748 RegStat string `json:"registration_status"`
48- MgmtIp string `json:"mgmt_ip"`
49+ MgmtIP string `json:"mgmt_ip"`
4950 MgmtPort float64 `json:"mgmt_port"`
5051 Sn string `json:"sn"`
5152 PenFortMan string `json:"pending_fortimanager"`
@@ -62,7 +63,7 @@ func probeSystemCentralManagementStatus (c http.FortiHTTP, meta *TargetMetadata)
6263 }
6364
6465 m := []prometheus.Metric {}
65- var normal , backup , down , up , handshake , inProgress , registered , unregistered , defaultValue float64
66+ var normal , backup , down , up , handshake , inProgress , registered , unregistered , defaultValue float64
6667 if res .Result .Mode == "normal" {
6768 normal = 1
6869 } else {
@@ -86,16 +87,15 @@ func probeSystemCentralManagementStatus (c http.FortiHTTP, meta *TargetMetadata)
8687 default :
8788 defaultValue = 1
8889 }
89- m = append (m , prometheus .MustNewConstMetric (mode , prometheus .GaugeValue , normal , "normal" , res .Result .Server , res .Result .MgmtIp , strconv .FormatFloat (res .Result .MgmtPort , 'f' , - 1 , 64 ), res .Result .Sn , res .Result .PenFortMan ))
90- m = append (m , prometheus .MustNewConstMetric (mode , prometheus .GaugeValue , backup , "backup" , res .Result .Server , res .Result .MgmtIp , strconv .FormatFloat (res .Result .MgmtPort , 'f' , - 1 , 64 ), res .Result .Sn , res .Result .PenFortMan ))
91- m = append (m , prometheus .MustNewConstMetric (status , prometheus .GaugeValue , down , "down" , res .Result .Server , res .Result .MgmtIp , strconv .FormatFloat (res .Result .MgmtPort , 'f' , - 1 , 64 ), res .Result .Sn , res .Result .PenFortMan ))
92- m = append (m , prometheus .MustNewConstMetric (status , prometheus .GaugeValue , up , "up" , res .Result .Server , res .Result .MgmtIp , strconv .FormatFloat (res .Result .MgmtPort , 'f' , - 1 , 64 ), res .Result .Sn , res .Result .PenFortMan ))
93- m = append (m , prometheus .MustNewConstMetric (status , prometheus .GaugeValue , handshake , "handshake" , res .Result .Server , res .Result .MgmtIp , strconv .FormatFloat (res .Result .MgmtPort , 'f' , - 1 , 64 ), res .Result .Sn , res .Result .PenFortMan ))
94- m = append (m , prometheus .MustNewConstMetric (registrationStatus , prometheus .GaugeValue , inProgress , "inprogress" , res .Result .Server , res .Result .MgmtIp , strconv .FormatFloat (res .Result .MgmtPort , 'f' , - 1 , 64 ), res .Result .Sn , res .Result .PenFortMan ))
95- m = append (m , prometheus .MustNewConstMetric (registrationStatus , prometheus .GaugeValue , registered , "registered" , res .Result .Server , res .Result .MgmtIp , strconv .FormatFloat (res .Result .MgmtPort , 'f' , - 1 , 64 ), res .Result .Sn , res .Result .PenFortMan ))
96- m = append (m , prometheus .MustNewConstMetric (registrationStatus , prometheus .GaugeValue , unregistered , "unregistered" , res .Result .Server , res .Result .MgmtIp , strconv .FormatFloat (res .Result .MgmtPort , 'f' , - 1 , 64 ), res .Result .Sn , res .Result .PenFortMan ))
97- m = append (m , prometheus .MustNewConstMetric (registrationStatus , prometheus .GaugeValue , defaultValue , "unknown" , res .Result .Server , res .Result .MgmtIp , strconv .FormatFloat (res .Result .MgmtPort , 'f' , - 1 , 64 ), res .Result .Sn , res .Result .PenFortMan ))
98-
99-
90+ m = append (m , prometheus .MustNewConstMetric (mode , prometheus .GaugeValue , normal , "normal" , res .Result .Server , res .Result .MgmtIP , strconv .FormatFloat (res .Result .MgmtPort , 'f' , - 1 , 64 ), res .Result .Sn , res .Result .PenFortMan ))
91+ m = append (m , prometheus .MustNewConstMetric (mode , prometheus .GaugeValue , backup , "backup" , res .Result .Server , res .Result .MgmtIP , strconv .FormatFloat (res .Result .MgmtPort , 'f' , - 1 , 64 ), res .Result .Sn , res .Result .PenFortMan ))
92+ m = append (m , prometheus .MustNewConstMetric (status , prometheus .GaugeValue , down , "down" , res .Result .Server , res .Result .MgmtIP , strconv .FormatFloat (res .Result .MgmtPort , 'f' , - 1 , 64 ), res .Result .Sn , res .Result .PenFortMan ))
93+ m = append (m , prometheus .MustNewConstMetric (status , prometheus .GaugeValue , up , "up" , res .Result .Server , res .Result .MgmtIP , strconv .FormatFloat (res .Result .MgmtPort , 'f' , - 1 , 64 ), res .Result .Sn , res .Result .PenFortMan ))
94+ m = append (m , prometheus .MustNewConstMetric (status , prometheus .GaugeValue , handshake , "handshake" , res .Result .Server , res .Result .MgmtIP , strconv .FormatFloat (res .Result .MgmtPort , 'f' , - 1 , 64 ), res .Result .Sn , res .Result .PenFortMan ))
95+ m = append (m , prometheus .MustNewConstMetric (registrationStatus , prometheus .GaugeValue , inProgress , "inprogress" , res .Result .Server , res .Result .MgmtIP , strconv .FormatFloat (res .Result .MgmtPort , 'f' , - 1 , 64 ), res .Result .Sn , res .Result .PenFortMan ))
96+ m = append (m , prometheus .MustNewConstMetric (registrationStatus , prometheus .GaugeValue , registered , "registered" , res .Result .Server , res .Result .MgmtIP , strconv .FormatFloat (res .Result .MgmtPort , 'f' , - 1 , 64 ), res .Result .Sn , res .Result .PenFortMan ))
97+ m = append (m , prometheus .MustNewConstMetric (registrationStatus , prometheus .GaugeValue , unregistered , "unregistered" , res .Result .Server , res .Result .MgmtIP , strconv .FormatFloat (res .Result .MgmtPort , 'f' , - 1 , 64 ), res .Result .Sn , res .Result .PenFortMan ))
98+ m = append (m , prometheus .MustNewConstMetric (registrationStatus , prometheus .GaugeValue , defaultValue , "unknown" , res .Result .Server , res .Result .MgmtIP , strconv .FormatFloat (res .Result .MgmtPort , 'f' , - 1 , 64 ), res .Result .Sn , res .Result .PenFortMan ))
99+
100100 return m , true
101- }
101+ }
0 commit comments