@@ -15,12 +15,13 @@ package probe
1515
1616import (
1717 "log"
18- "github.com/prometheus-community/fortigate_exporter/pkg/http"
18+
1919 "github.com/prometheus/client_golang/prometheus"
20+
21+ "github.com/prometheus-community/fortigate_exporter/pkg/http"
2022)
2123
22- func probeSystemVdomResource (c http.FortiHTTP , meta * TargetMetadata ) ([]prometheus.Metric , bool ) {
23-
24+ func probeSystemVdomResource (c http.FortiHTTP , _ * TargetMetadata ) ([]prometheus.Metric , bool ) {
2425 vdomDesc := make (map [string ]* prometheus.Desc )
2526 vdomDesc ["cpu" ] = prometheus .NewDesc (
2627 "fortigate_vdom_resource_cpu_usage_ratio" ,
@@ -45,12 +46,12 @@ func probeSystemVdomResource(c http.FortiHTTP, meta *TargetMetadata) ([]promethe
4546 vdomDesc ["id" ] = prometheus .NewDesc (
4647 "fortigate_vdom_resource_object_id" ,
4748 "Object Resource ID" ,
48- []string {"vdom" , "object" },nil ,
49+ []string {"vdom" , "object" }, nil ,
4950 )
5051 vdomDesc ["custom_max" ] = prometheus .NewDesc (
5152 "fortigate_vdom_resource_object_custom_max" ,
5253 "Object Custom Max" ,
53- []string {"vdom" , "object" },nil ,
54+ []string {"vdom" , "object" }, nil ,
5455 )
5556 vdomDesc ["min_custom_value" ] = prometheus .NewDesc (
5657 "fortigate_vdom_resource_object_custom_min_value" ,
@@ -60,42 +61,42 @@ func probeSystemVdomResource(c http.FortiHTTP, meta *TargetMetadata) ([]promethe
6061 vdomDesc ["max_custom_value" ] = prometheus .NewDesc (
6162 "fortigate_vdom_resource_object_custom_max_value" ,
6263 "Object Maximum custom value" ,
63- []string {"vdom" , "object" },nil ,
64+ []string {"vdom" , "object" }, nil ,
6465 )
6566 vdomDesc ["guaranteed" ] = prometheus .NewDesc (
6667 "fortigate_vdom_resource_object_guaranteed" ,
6768 "Object Guaranteed" ,
68- []string {"vdom" , "object" },nil ,
69+ []string {"vdom" , "object" }, nil ,
6970 )
7071 vdomDesc ["min_guaranteed_value" ] = prometheus .NewDesc (
7172 "fortigate_vdom_resource_object_guaranteed_max_value" ,
7273 "Object Minimum guaranteed value" ,
73- []string {"vdom" , "object" },nil ,
74+ []string {"vdom" , "object" }, nil ,
7475 )
7576 vdomDesc ["max_guaranteed_value" ] = prometheus .NewDesc (
7677 "fortigate_vdom_resource_object_guaranteed_min_value" ,
7778 "Object Maximum guaranteed value" ,
78- []string {"vdom" , "object" },nil ,
79+ []string {"vdom" , "object" }, nil ,
7980 )
8081 vdomDesc ["global_max" ] = prometheus .NewDesc (
8182 "fortigate_vdom_resource_object_global_max" ,
8283 "Object Global max" ,
83- []string {"vdom" , "object" },nil ,
84+ []string {"vdom" , "object" }, nil ,
8485 )
8586 vdomDesc ["current_usage" ] = prometheus .NewDesc (
8687 "fortigate_vdom_resource_object_current_usage" ,
8788 "Object Current usage" ,
88- []string {"vdom" , "object" },nil ,
89+ []string {"vdom" , "object" }, nil ,
8990 )
9091 vdomDesc ["usage_percent" ] = prometheus .NewDesc (
9192 "fortigate_vdom_resource_object_usage_ratio" ,
9293 "Object Usage percentage" ,
93- []string {"vdom" , "object" },nil ,
94+ []string {"vdom" , "object" }, nil ,
9495 )
9596
9697 type VDOMResourceResult struct {
97- Result interface {} `json:"results"`
98- Vdom string `json:"vdom"`
98+ Result any `json:"results"`
99+ Vdom string `json:"vdom"`
99100 }
100101
101102 var res []VDOMResourceResult
@@ -117,23 +118,23 @@ func probeSystemVdomResource(c http.FortiHTTP, meta *TargetMetadata) ([]promethe
117118 m = append (m , prometheus .MustNewConstMetric (vdomDesc [k ], prometheus .GaugeValue , 0 , result .Vdom ))
118119 }
119120 case "session" ,
120- "ipsec-phase1" ,
121- "ipsec-phase2" ,
122- "ipsec-phase1-interface" ,
123- "ipsec-phase2-interface" ,
124- "dialup-tunnel" ,
125- "firewall-policy" ,
126- "firewall-address" ,
127- "firewall-addrgrp" ,
128- "custom-service" ,
129- "service-group" ,
130- "onetime-schedule" ,
131- "recurring-schedule" ,
132- "user" ,
133- "user-group" ,
134- "sslvpn" ,
135- "proxy" ,
136- "log-disk-quota" :
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" :
137138 for val , e := range elem .(map [string ]any ) {
138139 m = append (m , prometheus .MustNewConstMetric (vdomDesc [val ], prometheus .GaugeValue , e .(float64 ), result .Vdom , k ))
139140 }
0 commit comments