@@ -16,12 +16,12 @@ package probe
1616import (
1717 "log"
1818
19- "github.com/prometheus-community/fortigate_exporter/pkg/http"
2019 "github.com/prometheus/client_golang/prometheus"
20+
21+ "github.com/prometheus-community/fortigate_exporter/pkg/http"
2122)
2223
23- func probeSystemVdomResource (c http.FortiHTTP , meta * TargetMetadata ) ([]prometheus.Metric , bool ) {
24-
24+ func probeSystemVdomResource (c http.FortiHTTP , _ * TargetMetadata ) ([]prometheus.Metric , bool ) {
2525 vdomDesc := make (map [string ]* prometheus.Desc )
2626 vdomDesc ["cpu" ] = prometheus .NewDesc (
2727 "fortigate_vdom_resource_cpu_usage_ratio" ,
@@ -46,12 +46,12 @@ func probeSystemVdomResource(c http.FortiHTTP, meta *TargetMetadata) ([]promethe
4646 vdomDesc ["id" ] = prometheus .NewDesc (
4747 "fortigate_vdom_resource_object_id" ,
4848 "Object Resource ID" ,
49- []string {"vdom" , "object" },nil ,
49+ []string {"vdom" , "object" }, nil ,
5050 )
5151 vdomDesc ["custom_max" ] = prometheus .NewDesc (
5252 "fortigate_vdom_resource_object_custom_max" ,
5353 "Object Custom Max" ,
54- []string {"vdom" , "object" },nil ,
54+ []string {"vdom" , "object" }, nil ,
5555 )
5656 vdomDesc ["min_custom_value" ] = prometheus .NewDesc (
5757 "fortigate_vdom_resource_object_custom_min_value" ,
@@ -61,42 +61,42 @@ func probeSystemVdomResource(c http.FortiHTTP, meta *TargetMetadata) ([]promethe
6161 vdomDesc ["max_custom_value" ] = prometheus .NewDesc (
6262 "fortigate_vdom_resource_object_custom_max_value" ,
6363 "Object Maximum custom value" ,
64- []string {"vdom" , "object" },nil ,
64+ []string {"vdom" , "object" }, nil ,
6565 )
6666 vdomDesc ["guaranteed" ] = prometheus .NewDesc (
6767 "fortigate_vdom_resource_object_guaranteed" ,
6868 "Object Guaranteed" ,
69- []string {"vdom" , "object" },nil ,
69+ []string {"vdom" , "object" }, nil ,
7070 )
7171 vdomDesc ["min_guaranteed_value" ] = prometheus .NewDesc (
7272 "fortigate_vdom_resource_object_guaranteed_max_value" ,
7373 "Object Minimum guaranteed value" ,
74- []string {"vdom" , "object" },nil ,
74+ []string {"vdom" , "object" }, nil ,
7575 )
7676 vdomDesc ["max_guaranteed_value" ] = prometheus .NewDesc (
7777 "fortigate_vdom_resource_object_guaranteed_min_value" ,
7878 "Object Maximum guaranteed value" ,
79- []string {"vdom" , "object" },nil ,
79+ []string {"vdom" , "object" }, nil ,
8080 )
8181 vdomDesc ["global_max" ] = prometheus .NewDesc (
8282 "fortigate_vdom_resource_object_global_max" ,
8383 "Object Global max" ,
84- []string {"vdom" , "object" },nil ,
84+ []string {"vdom" , "object" }, nil ,
8585 )
8686 vdomDesc ["current_usage" ] = prometheus .NewDesc (
8787 "fortigate_vdom_resource_object_current_usage" ,
8888 "Object Current usage" ,
89- []string {"vdom" , "object" },nil ,
89+ []string {"vdom" , "object" }, nil ,
9090 )
9191 vdomDesc ["usage_percent" ] = prometheus .NewDesc (
9292 "fortigate_vdom_resource_object_usage_ratio" ,
9393 "Object Usage percentage" ,
94- []string {"vdom" , "object" },nil ,
94+ []string {"vdom" , "object" }, nil ,
9595 )
9696
9797 type VDOMResourceResult struct {
98- Result interface {} `json:"results"`
99- Vdom string `json:"vdom"`
98+ Result any `json:"results"`
99+ Vdom string `json:"vdom"`
100100 }
101101
102102 var res []VDOMResourceResult
@@ -107,7 +107,7 @@ func probeSystemVdomResource(c http.FortiHTTP, meta *TargetMetadata) ([]promethe
107107
108108 m := []prometheus.Metric {}
109109 for _ , result := range res {
110- for k , elem := range result .Result .(map [string ]interface {} ) {
110+ for k , elem := range result .Result .(map [string ]any ) {
111111 switch k {
112112 case "cpu" , "memory" , "setup_rate" :
113113 m = append (m , prometheus .MustNewConstMetric (vdomDesc [k ], prometheus .GaugeValue , elem .(float64 ), result .Vdom ))
@@ -118,24 +118,24 @@ func probeSystemVdomResource(c http.FortiHTTP, meta *TargetMetadata) ([]promethe
118118 m = append (m , prometheus .MustNewConstMetric (vdomDesc [k ], prometheus .GaugeValue , 0 , result .Vdom ))
119119 }
120120 case "session" ,
121- "ipsec-phase1" ,
122- "ipsec-phase2" ,
123- "ipsec-phase1-interface" ,
124- "ipsec-phase2-interface" ,
125- "dialup-tunnel" ,
126- "firewall-policy" ,
127- "firewall-address" ,
128- "firewall-addrgrp" ,
129- "custom-service" ,
130- "service-group" ,
131- "onetime-schedule" ,
132- "recurring-schedule" ,
133- "user" ,
134- "user-group" ,
135- "sslvpn" ,
136- "proxy" ,
137- "log-disk-quota" :
138- for val , e := range elem .(map [string ]interface {} ) {
121+ "ipsec-phase1" ,
122+ "ipsec-phase2" ,
123+ "ipsec-phase1-interface" ,
124+ "ipsec-phase2-interface" ,
125+ "dialup-tunnel" ,
126+ "firewall-policy" ,
127+ "firewall-address" ,
128+ "firewall-addrgrp" ,
129+ "custom-service" ,
130+ "service-group" ,
131+ "onetime-schedule" ,
132+ "recurring-schedule" ,
133+ "user" ,
134+ "user-group" ,
135+ "sslvpn" ,
136+ "proxy" ,
137+ "log-disk-quota" :
138+ for val , e := range elem .(map [string ]any ) {
139139 m = append (m , prometheus .MustNewConstMetric (vdomDesc [val ], prometheus .GaugeValue , e .(float64 ), result .Vdom , k ))
140140 }
141141 default :
0 commit comments