@@ -36,6 +36,11 @@ type SystemSDNConnector struct {
3636
3737func probeSystemSDNConnector (c http.FortiHTTP , _ * TargetMetadata ) ([]prometheus.Metric , bool ) {
3838 var (
39+ SDNConnectorsStatus = prometheus .NewDesc (
40+ "fortigate_system_sdn_connector_status" ,
41+ "Status of SDN connectors (0=Disabled, 1=Down, 2=Unknown, 3=Up, 4=Updating)" ,
42+ []string {"vdom" , "name" , "type" }, nil ,
43+ )
3944 SDNConnectorsState = prometheus .NewDesc (
4045 "fortigate_system_sdn_connector_state" ,
4146 "Status of SDN connectors disabled" ,
@@ -66,14 +71,19 @@ func probeSystemSDNConnector(c http.FortiHTTP, _ *TargetMetadata) ([]prometheus.
6671 }
6772 switch sdnConn .Status {
6873 case "Disabled" :
74+ m = append (m , prometheus .MustNewConstMetric (SDNConnectorsStatus , prometheus .GaugeValue , float64 (0 ), r .VDOM , sdnConn .Name , sdnConn .Type ))
6975 t [0 ] = prometheus .MustNewConstMetric (SDNConnectorsState , prometheus .GaugeValue , 1.0 , r .VDOM , sdnConn .Name , sdnConn .Type , sdnConn .Status )
7076 case "Down" :
77+ m = append (m , prometheus .MustNewConstMetric (SDNConnectorsStatus , prometheus .GaugeValue , float64 (1 ), r .VDOM , sdnConn .Name , sdnConn .Type ))
7178 t [1 ] = prometheus .MustNewConstMetric (SDNConnectorsState , prometheus .GaugeValue , 1.0 , r .VDOM , sdnConn .Name , sdnConn .Type , sdnConn .Status )
7279 case "Unknown" :
80+ m = append (m , prometheus .MustNewConstMetric (SDNConnectorsStatus , prometheus .GaugeValue , float64 (2 ), r .VDOM , sdnConn .Name , sdnConn .Type ))
7381 t [2 ] = prometheus .MustNewConstMetric (SDNConnectorsState , prometheus .GaugeValue , 1.0 , r .VDOM , sdnConn .Name , sdnConn .Type , sdnConn .Status )
7482 case "Up" :
83+ m = append (m , prometheus .MustNewConstMetric (SDNConnectorsStatus , prometheus .GaugeValue , float64 (3 ), r .VDOM , sdnConn .Name , sdnConn .Type ))
7584 t [3 ] = prometheus .MustNewConstMetric (SDNConnectorsState , prometheus .GaugeValue , 1.0 , r .VDOM , sdnConn .Name , sdnConn .Type , sdnConn .Status )
7685 case "Updating" :
86+ m = append (m , prometheus .MustNewConstMetric (SDNConnectorsStatus , prometheus .GaugeValue , float64 (4 ), r .VDOM , sdnConn .Name , sdnConn .Type ))
7787 t [4 ] = prometheus .MustNewConstMetric (SDNConnectorsState , prometheus .GaugeValue , 1.0 , r .VDOM , sdnConn .Name , sdnConn .Type , sdnConn .Status )
7888 }
7989 m = append (m , prometheus .MustNewConstMetric (SDNConnectorsLastUpdate , prometheus .GaugeValue , float64 (sdnConn .LastUpdate ), r .VDOM , sdnConn .Name , sdnConn .Type ))
0 commit comments