Skip to content

Commit 0f7b271

Browse files
committed
Update for v7.6
Signed-off-by: Örnfeldt Philip (66140321) <philip.ornfeldt@forsakringskassan.se>
1 parent a303cbf commit 0f7b271

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

pkg/probe/system_sandbox_connection.go

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,21 @@ func probeSystemSandboxConnection(c http.FortiHTTP, _ *TargetMetadata) ([]promet
3737
"Sandbox connection status",
3838
[]string{"sandbox_type"}, nil,
3939
)
40+
connectionStatusUnauthorized := prometheus.NewDesc(
41+
"fortigate_sandbox_connection_status_unauthorized",
42+
"Sandbox connection status",
43+
[]string{"sandbox_type"}, nil,
44+
)
45+
connectionStatusIncompatible := prometheus.NewDesc(
46+
"fortigate_sandbox_connection_status_incompatible",
47+
"Sandbox connection status",
48+
[]string{"sandbox_type"}, nil,
49+
)
50+
connectionStatusUnverified := prometheus.NewDesc(
51+
"fortigate_sandbox_connection_status_unverified",
52+
"Sandbox connection status",
53+
[]string{"sandbox_type"}, nil,
54+
)
4055

4156
type SystemSandboxConnection struct {
4257
Status string `json:"status"`
@@ -59,14 +74,44 @@ func probeSystemSandboxConnection(c http.FortiHTTP, _ *TargetMetadata) ([]promet
5974
m = append(m, prometheus.MustNewConstMetric(connectionStatusUreachable, prometheus.GaugeValue, 1, r.Type))
6075
m = append(m, prometheus.MustNewConstMetric(connectionStatusReachable, prometheus.GaugeValue, 0, r.Type))
6176
m = append(m, prometheus.MustNewConstMetric(connectionStatusDisable, prometheus.GaugeValue, 0, r.Type))
77+
m = append(m, prometheus.MustNewConstMetric(connectionStatusUnauthorized, prometheus.GaugeValue, 0, r.Type))
78+
m = append(m, prometheus.MustNewConstMetric(connectionStatusIncompatible, prometheus.GaugeValue, 0, r.Type))
79+
m = append(m, prometheus.MustNewConstMetric(connectionStatusUnverified, prometheus.GaugeValue, 0, r.Type))
6280
case "reachable":
6381
m = append(m, prometheus.MustNewConstMetric(connectionStatusUreachable, prometheus.GaugeValue, 0, r.Type))
6482
m = append(m, prometheus.MustNewConstMetric(connectionStatusReachable, prometheus.GaugeValue, 1, r.Type))
6583
m = append(m, prometheus.MustNewConstMetric(connectionStatusDisable, prometheus.GaugeValue, 0, r.Type))
84+
m = append(m, prometheus.MustNewConstMetric(connectionStatusUnauthorized, prometheus.GaugeValue, 0, r.Type))
85+
m = append(m, prometheus.MustNewConstMetric(connectionStatusIncompatible, prometheus.GaugeValue, 0, r.Type))
86+
m = append(m, prometheus.MustNewConstMetric(connectionStatusUnverified, prometheus.GaugeValue, 0, r.Type))
6687
case "disabled":
6788
m = append(m, prometheus.MustNewConstMetric(connectionStatusUreachable, prometheus.GaugeValue, 0, r.Type))
6889
m = append(m, prometheus.MustNewConstMetric(connectionStatusReachable, prometheus.GaugeValue, 0, r.Type))
6990
m = append(m, prometheus.MustNewConstMetric(connectionStatusDisable, prometheus.GaugeValue, 1, r.Type))
91+
m = append(m, prometheus.MustNewConstMetric(connectionStatusUnauthorized, prometheus.GaugeValue, 0, r.Type))
92+
m = append(m, prometheus.MustNewConstMetric(connectionStatusIncompatible, prometheus.GaugeValue, 0, r.Type))
93+
m = append(m, prometheus.MustNewConstMetric(connectionStatusUnverified, prometheus.GaugeValue, 0, r.Type))
94+
case "unauthorized":
95+
m = append(m, prometheus.MustNewConstMetric(connectionStatusUreachable, prometheus.GaugeValue, 0, r.Type))
96+
m = append(m, prometheus.MustNewConstMetric(connectionStatusReachable, prometheus.GaugeValue, 0, r.Type))
97+
m = append(m, prometheus.MustNewConstMetric(connectionStatusDisable, prometheus.GaugeValue, 0, r.Type))
98+
m = append(m, prometheus.MustNewConstMetric(connectionStatusUnauthorized, prometheus.GaugeValue, 1, r.Type))
99+
m = append(m, prometheus.MustNewConstMetric(connectionStatusIncompatible, prometheus.GaugeValue, 0, r.Type))
100+
m = append(m, prometheus.MustNewConstMetric(connectionStatusUnverified, prometheus.GaugeValue, 0, r.Type))
101+
case "incompatible":
102+
m = append(m, prometheus.MustNewConstMetric(connectionStatusUreachable, prometheus.GaugeValue, 0, r.Type))
103+
m = append(m, prometheus.MustNewConstMetric(connectionStatusReachable, prometheus.GaugeValue, 0, r.Type))
104+
m = append(m, prometheus.MustNewConstMetric(connectionStatusDisable, prometheus.GaugeValue, 0, r.Type))
105+
m = append(m, prometheus.MustNewConstMetric(connectionStatusUnauthorized, prometheus.GaugeValue, 0, r.Type))
106+
m = append(m, prometheus.MustNewConstMetric(connectionStatusIncompatible, prometheus.GaugeValue, 1, r.Type))
107+
m = append(m, prometheus.MustNewConstMetric(connectionStatusUnverified, prometheus.GaugeValue, 0, r.Type))
108+
case "unverified":
109+
m = append(m, prometheus.MustNewConstMetric(connectionStatusUreachable, prometheus.GaugeValue, 0, r.Type))
110+
m = append(m, prometheus.MustNewConstMetric(connectionStatusReachable, prometheus.GaugeValue, 0, r.Type))
111+
m = append(m, prometheus.MustNewConstMetric(connectionStatusDisable, prometheus.GaugeValue, 0, r.Type))
112+
m = append(m, prometheus.MustNewConstMetric(connectionStatusUnauthorized, prometheus.GaugeValue, 0, r.Type))
113+
m = append(m, prometheus.MustNewConstMetric(connectionStatusIncompatible, prometheus.GaugeValue, 0, r.Type))
114+
m = append(m, prometheus.MustNewConstMetric(connectionStatusUnverified, prometheus.GaugeValue, 1, r.Type))
70115
}
71116
}
72117
return m, true

pkg/probe/system_sandbox_connection_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,21 @@ func TestSystemSandboxConnection(t *testing.T) {
3333
# HELP fortigate_sandbox_connection_status_disabled Sandbox connection status
3434
# TYPE fortigate_sandbox_connection_status_disabled gauge
3535
fortigate_sandbox_connection_status_disabled{sandbox_type="appliance"} 0
36+
# HELP fortigate_sandbox_connection_status_incompatible Sandbox connection status
37+
# TYPE fortigate_sandbox_connection_status_incompatible gauge
38+
fortigate_sandbox_connection_status_incompatible{sandbox_type="appliance"} 0
3639
# HELP fortigate_sandbox_connection_status_reachable Sandbox connection status
3740
# TYPE fortigate_sandbox_connection_status_reachable gauge
3841
fortigate_sandbox_connection_status_reachable{sandbox_type="appliance"} 1
42+
# HELP fortigate_sandbox_connection_status_unauthorized Sandbox connection status
43+
# TYPE fortigate_sandbox_connection_status_unauthorized gauge
44+
fortigate_sandbox_connection_status_unauthorized{sandbox_type="appliance"} 0
3945
# HELP fortigate_sandbox_connection_status_unreachable Sandbox connection status
4046
# TYPE fortigate_sandbox_connection_status_unreachable gauge
4147
fortigate_sandbox_connection_status_unreachable{sandbox_type="appliance"} 0
48+
# HELP fortigate_sandbox_connection_status_unverified Sandbox connection status
49+
# TYPE fortigate_sandbox_connection_status_unverified gauge
50+
fortigate_sandbox_connection_status_unverified{sandbox_type="appliance"} 0
4251
`
4352

4453
if err := testutil.GatherAndCompare(r, strings.NewReader(em)); err != nil {

0 commit comments

Comments
 (0)