Skip to content

Automation

All NDCLI commands support multiple output formats via the -f flag, making it straightforward to integrate NetDefense into scripts, pipelines, and automation workflows.

Output Formats

FormatFlagUse Case
Table-f table (default)Human-readable aligned columns, ideal for terminal use.
Simple-f simpleCompact key-value output, useful for quick inspection.
Detailed-f detailedExpanded view with all fields and relationships.
JSON-f jsonMachine-readable output for scripting and automation.

JSON Output Example

Terminal window
ndcli device list -f json
{
"devices": [
{
"uuid": "e2eb98b8-0ed3-11f1-8792-66a021937fa2",
"name": "fw-hq-primary",
"status": "ENABLED",
"organization": "example-org",
"organizational_units": ["production"],
"version": "2.4.1",
"heartbeat": "2026-02-21T03:17:31Z",
"auto_sync": true,
"synced_at": "2026-02-21T03:16:43Z"
}
],
"total": 8
}

Scripting with jq

Terminal window
# Get names of all devices not synced
ndcli sync status -f json | jq -r '.items[] | select(.in_sync == false) | .device_name'
# Count devices per OU
ndcli device list -f json | jq -r '.devices[].organizational_units[]' | sort | uniq -c
# Get overlay IPs for all VPN members
ndcli network member list corporate-vpn -f json | jq -r '.members[] | "\(.device): \(.overlay_ip)"'