Skip to content

Commit df7e89d

Browse files
committed
Latest version
1 parent bb71c99 commit df7e89d

File tree

3 files changed

+35
-13
lines changed

3 files changed

+35
-13
lines changed

pkg/probe/system_sandbox_connection.go

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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

2424
func 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

pkg/probe/system_sandbox_connection_test.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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
@@ -30,9 +30,15 @@ func TestSystemSandboxConnection(t *testing.T) {
3030
}
3131

3232
em := `
33-
# HELP fortigate_sandbox_connection_status Sandbox connection status, (unreachable=0, reachable=1, disabled=-1)
34-
# TYPE fortigate_sandbox_connection_status gauge
35-
fortigate_sandbox_connection_status{type="appliance"} 1
33+
# HELP fortigate_sandbox_connection_status_disabled Sandbox connection status
34+
# TYPE fortigate_sandbox_connection_status_disabled gauge
35+
fortigate_sandbox_connection_status_disabled{sandbox_type="appliance"} 0
36+
# HELP fortigate_sandbox_connection_status_reachable Sandbox connection status
37+
# TYPE fortigate_sandbox_connection_status_reachable gauge
38+
fortigate_sandbox_connection_status_reachable{sandbox_type="appliance"} 1
39+
# HELP fortigate_sandbox_connection_status_unreachable Sandbox connection status
40+
# TYPE fortigate_sandbox_connection_status_unreachable gauge
41+
fortigate_sandbox_connection_status_unreachable{sandbox_type="appliance"} 0
3642
`
3743

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

pkg/probe/system_sandbox_status.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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
@@ -24,7 +24,7 @@ import (
2424

2525
func probeSystemSandboxStatus(c http.FortiHTTP, _ *TargetMetadata) ([]prometheus.Metric, bool) {
2626
Count := prometheus.NewDesc(
27-
"fortigate_system_sandbox_status_signatures",
27+
"fortigate_system_sandbox_status_signatures_count",
2828
"The number of signatures that have been loaded on the FortiSandbox.",
2929
[]string{"configured", "type", "cloud_region", "server", "malware_package_version", "signatures_loaded", "vdom"}, nil,
3030
)

0 commit comments

Comments
 (0)