Hi,
When attempting to deploy the latest version of fortigate_exporter (1.25.0) on Linux amd64 we are getting an errors across all metrics. This is pulling via the API key from a FortiGate 600F running v7.4.11 build2878 (Mature).
An error has occurred while serving metrics:
2971 error(s) occurred:
* collected metric "fortigate_managed_switch_max_poe_budget_watt" { label:{name:"switch_name" value:""} label:{name:"vdom" value:"root"} counter:{value:740}} was collected before with the same name and label values
* collected metric "fortigate_managed_switch_max_poe_budget_watt" { label:{name:"switch_name" value:""} label:{name:"vdom" value:"root"} counter:{value:740}} was collected before with the same name and label values
* collected metric "fortigate_managed_switch_max_poe_budget_watt" { label:{name:"switch_name" value:""} label:{name:"vdom" value:"root"} counter:{value:370}} was collected before with the same name and label values
I believe the root cause to be the results struct in managed_switch.go maps Name to json:"name", however the FortiOS API response at api/v2/monitor/switch-controller/managed-switch/status returns the switch name in the switch-id field, not name. The name field does not appear to exist in the response at all, resulting in an empty string for every switch.
curl -sk "https://fortigate_ip/api/v2/monitor/switch-controller/managed-switch/status reports the following:
{
"http_method": "GET",
"results": [
{
"status": "Connected",
"os_version": "S148FF-v7.6.1-build1047,241217 (GA)",
"connecting_from": "redacted",
"join_time": "Thu Feb 5 16:20:31 2026",
"image_download_progress": 0,
"switch-id": "redacted",
"serial": "redacted",
"fgt_peer_intf_name": "fortilink",
"state": "Authorized",
"ports": [
{
"supported_port_speeds": [
"10half",
"10full",
"100half",
"100full",
"auto",
"1000auto"
],
"interface": "port1",
"fortilink_port": false,
"vlan": "VLAN180SERVICES",
"fgt_peer_port_name": "",
"fgt_peer_device_name": "",
"isl_peer_device_name": "",
"isl_peer_port_name": "",
"isl_peer_trunk_name": "",
"mclag_icl": false,
"mclag": false,
"status": "up",
"duplex": "full",
"speed": 1000,
"poe_capable": true,
"poe_status": "enabled",
"port_power": 0.0,
"power_status": 1,
Updating pkg/probe/managed_switch.go type results struct to 'switch-id' (from 'name') worked in our environment.
type Results struct {
- Name string `json:"name"`
+ Name string `json:"switch-id"`
VDOM string `json:"vdom"`
Serial string `json:"serial"`
OSVersion string `json:"os_version"`
Whether switch-id has always been the correct field, or whether this changed in a specific FortiOS version, I don't know. We have not been able to confirm whether name is present in the API response on other FortiOS versions. It's possible previous versions returned both fields and this only breaks on certain firmware versions. I'm unsure if I'm simply missing something else.
Hi,
When attempting to deploy the latest version of fortigate_exporter (1.25.0) on Linux amd64 we are getting an errors across all metrics. This is pulling via the API key from a FortiGate 600F running v7.4.11 build2878 (Mature).
curl -sk "https://fortigate_ip/api/v2/monitor/switch-controller/managed-switch/status reports the following:
Updating pkg/probe/managed_switch.go type results struct to 'switch-id' (from 'name') worked in our environment.
Whether switch-id has always been the correct field, or whether this changed in a specific FortiOS version, I don't know. We have not been able to confirm whether name is present in the API response on other FortiOS versions. It's possible previous versions returned both fields and this only breaks on certain firmware versions. I'm unsure if I'm simply missing something else.