FortiManager
FortiManager supports network operations use cases for centralized management, best practices compliance, and workflow automation to provide better protection against breaches.
farhanahmed
Staff
Staff
Article Id 412283
Description This article describes how to get details of all DHCP clients connected to all managed FortiGates using ForiManager JSON API and Postman.
Scope FortiManager, FortiGate, JSON API.
Solution

The FortiManager proxy API can be used to query DHCP client information from multiple managed FortiGates.

 

To fetch the list of all managed FortiGates, follow Step 1 in this KB article: Technical Tip: How to fetch Interface IP address of managed FortiGates using FortiManager JSON API.

 

Then use the following API query to fetch the DHCP clients' details:

 

{

    "id": "2",

    "method": "exec",

    "params": [

        {

            "url": "sys/proxy/json",

            "data": {

                "target": {{device_targets}},

                "action": "get",

                "resource": "/api/v2/monitor/system/dhcp"

            }

        }

    ],

    "session": "{{session}}"

}

 

The API response includes interface details for each specified device. To generate a clean and readable summary, using Postman, JavaScript can be used in the Scripts -> Post-res section to extract and display the following fields in the Visualization tab:

  • FortiGate Name.
  • The interface on the FortiGate where clients are connected.
  • Hostname of the connected DHCP client.
  • Client MAC Address.
  • Client IP Address.

 

dhcp_client_info.gif

 

Final output in the visualization tab of Postman:

 

final_dhcp.png

 

  • The API collection can be imported into Postman (tested with v11.64) via the attached zip file.
  • Under the 'Variables' tab of the collection, the following variables are required:
    • host: IP address of FortiManager.
    • ADMIN: FortiManager Admin user.
    • PASSWORD: Admin user password.

 

Related documents:

Postman Release Notes

Technical Tip: Using FortiManager API

Fortinet Development Network (FNDN) - FortiGate

Fortinet Development Network (FNDN) - FortiManager

Technical Tip: How to run a proxy API call from FortiManager to a managed FortiGate