Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
Dannу
Contributor

Get output of config-script via API?

I created a config-script to show VPN diagnostics via

POST /api/v2/monitor/system/config-script/upload

I can run the script via

POST /api/v2/monitor/system/config-script/run

I tried to fetch the output of my script via

GET /api/v2/monitor/system/config-script

which didn't show the output of my script.

4 REPLIES 4
gfleming
Staff
Staff

So just to confirm, you can actually upload and run the scripts?

 

And you get no output from the GET /api/v2/monitor/system/config-script method?

Cheers,
Graham
Dannу

Correct. The output I get just shows success without the actual CLI output of my script:

{
    "http_method": "GET",
    "results": {
        "conf_scripts": {
            "remote": [],
            "history": [
                {
                    "id": 0,
                    "timestamp": 1676620011,
                    "name": "script",
                    "type": "Local",
                    "status": "Success"
                }
            ]
        },
        "backup_service_available": false
    },
    "vdom": "root",
    "path": "system",
    "name": "config-script",
    "action": "",
    "status": "success",
    "serial": "FWF40FTK20000000",
    "version": "v7.2.3",
    "build": 1262
}

If there is no way to get the script's CLI output via API, maybe websockets can help?

gfleming

Based on the info on https://fndn.fortinet.net/index.php?/fortiapi/1-fortios/2420/1/system/ this is expected behaviour.


I think the problem is you are trying to use the config-script method to get output via a diagnose or show command which is not the intended purpose.

 

What information exactly are you trying to glean from the Fortigate?

Cheers,
Graham
Dannу

Correct, I want to get diagnose output like get vpn ike which doesn't seem to be possible via API while other vendors have these features built-in.

Anyways, I figured out how to run such commands via websockets, so I can continue building diagnostic tools for the FortiGate WebUI.

 

Still it would be nice to be able to utilize the API for this task. Maybe it's possible to tell the config-script/run routine to save the executed commands' output to some other place in the configuration from which another API call could then read it out.

Labels
Top Kudoed Authors