Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pkg/probe/system_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func probeSystemStatus(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.Met
mVersion = prometheus.NewDesc(
"fortigate_version_info",
"System version and build information",
[]string{"serial", "version", "build"}, nil,
[]string{"hostname", "model", "serial", "version", "build"}, nil,
)
)

Expand All @@ -35,6 +35,10 @@ func probeSystemStatus(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.Met
Serial string
Version string
Build int64
Results struct {
Model string
Hostname string
}
}
var st systemStatus

Expand All @@ -44,7 +48,7 @@ func probeSystemStatus(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.Met
}

m := []prometheus.Metric{
prometheus.MustNewConstMetric(mVersion, prometheus.GaugeValue, 1.0, st.Serial, st.Version, fmt.Sprintf("%d", st.Build)),
prometheus.MustNewConstMetric(mVersion, prometheus.GaugeValue, 1.0, st.Results.Hostname, st.Results.Model, st.Serial, st.Version, fmt.Sprintf("%d", st.Build)),
}
return m, true
}
2 changes: 1 addition & 1 deletion pkg/probe/system_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestSystemStatus(t *testing.T) {
em := `
# HELP fortigate_version_info System version and build information
# TYPE fortigate_version_info gauge
fortigate_version_info{build="1112",serial="FGVMEVZFNTS3OAC8",version="v6.2.4"} 1
fortigate_version_info{build="1112",hostname="Firewall1",model="FG800D",serial="FGVMEVZFNTS3OAC8",version="v6.2.4"} 1
`

if err := testutil.GatherAndCompare(r, strings.NewReader(em)); err != nil {
Expand Down
5 changes: 5 additions & 0 deletions pkg/probe/testdata/status.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
{
"http_method":"GET",
"results":{
"model_name":"FortiGate",
"model_number":"800D",
"model":"FG800D",
"hostname":"Firewall1",
"log_disk_status":"not_available"
},
"vdom":"root",
"path":"system",
Expand Down