1- // Copyright 2025 The Prometheus Authors
1+ // Copyright The Prometheus Authors
22// Licensed under the Apache License, Version 2.0 (the "License");
33// you may not use this file except in compliance with the License.
44// You may obtain a copy of the License at
@@ -22,9 +22,19 @@ import (
2222)
2323
2424func probeSystemSandboxConnection (c http.FortiHTTP , _ * TargetMetadata ) ([]prometheus.Metric , bool ) {
25- connectionStatus := prometheus .NewDesc (
26- "fortigate_sandbox_connection_status" ,
27- "Sandbox connection status, (unreachable=0, reachable=1, disabled=-1)" ,
25+ connectionStatusDisable := prometheus .NewDesc (
26+ "fortigate_sandbox_connection_status_disabled" ,
27+ "Sandbox connection status" ,
28+ []string {"sandbox_type" }, nil ,
29+ )
30+ connectionStatusUreachable := prometheus .NewDesc (
31+ "fortigate_sandbox_connection_status_unreachable" ,
32+ "Sandbox connection status" ,
33+ []string {"sandbox_type" }, nil ,
34+ )
35+ connectionStatusReachable := prometheus .NewDesc (
36+ "fortigate_sandbox_connection_status_reachable" ,
37+ "Sandbox connection status" ,
2838 []string {"sandbox_type" }, nil ,
2939 )
3040
@@ -46,11 +56,17 @@ func probeSystemSandboxConnection(c http.FortiHTTP, _ *TargetMetadata) ([]promet
4656 for _ , r := range res .Results {
4757 switch r .Status {
4858 case "unreachable" :
49- m = append (m , prometheus .MustNewConstMetric (connectionStatus , prometheus .GaugeValue , 0 , r .Type ))
59+ m = append (m , prometheus .MustNewConstMetric (connectionStatusUreachable , prometheus .GaugeValue , 1 , r .Type ))
60+ m = append (m , prometheus .MustNewConstMetric (connectionStatusReachable , prometheus .GaugeValue , 0 , r .Type ))
61+ m = append (m , prometheus .MustNewConstMetric (connectionStatusDisable , prometheus .GaugeValue , 0 , r .Type ))
5062 case "reachable" :
51- m = append (m , prometheus .MustNewConstMetric (connectionStatus , prometheus .GaugeValue , 1 , r .Type ))
63+ m = append (m , prometheus .MustNewConstMetric (connectionStatusUreachable , prometheus .GaugeValue , 0 , r .Type ))
64+ m = append (m , prometheus .MustNewConstMetric (connectionStatusReachable , prometheus .GaugeValue , 1 , r .Type ))
65+ m = append (m , prometheus .MustNewConstMetric (connectionStatusDisable , prometheus .GaugeValue , 0 , r .Type ))
5266 case "disabled" :
53- m = append (m , prometheus .MustNewConstMetric (connectionStatus , prometheus .GaugeValue , - 1 , r .Type ))
67+ m = append (m , prometheus .MustNewConstMetric (connectionStatusUreachable , prometheus .GaugeValue , 0 , r .Type ))
68+ m = append (m , prometheus .MustNewConstMetric (connectionStatusReachable , prometheus .GaugeValue , 0 , r .Type ))
69+ m = append (m , prometheus .MustNewConstMetric (connectionStatusDisable , prometheus .GaugeValue , 1 , r .Type ))
5470 }
5571 }
5672 return m , true
0 commit comments