Cato Networks cli wrapper for the GraphQL API.
Project description
Cato Networks GraphQL API CLI
The package provides a simple to use CLI that reflects industry standards (such as the AWS cli), and enables customers to manage Cato Networks configurations and processes via the Cato Networks GraphQL API easily integrating into configurations management, orchestration or automation frameworks to support the DevOps model.
Overview
CatoCLI is a command-line interface that provides access to the Cato Networks GraphQL API, enabling you to:
- Generate detailed network and security reports
- Analyze user and application activity
- Monitor network performance and events
- Export data in multiple formats (JSON, CSV)
- Automate reporting and monitoring tasks
Prerequisites
- Python 3.6 or higher
- CatoCLI installed (
pip3 install catocli) - Valid Cato Networks API token and Account ID
- Proper authentication configuration (see Authentication Setup)
Installation
pip3 install catocli
Authentication Setup
Configure your CatoCLI profile before using any query operations:
# Interactive configuration
catocli configure set
# Non-interactive configuration
catocli configure set --cato-token "your-api-token" --account-id "12345"
# List configured profiles
catocli configure list
# Show current profile
catocli configure show
Enable cli tab auto-completion
For detailed information about enabling tab completion, see TAB_COMPLETION.md.
Documentation
For detailed information about profile management, see PROFILES.md.
CLICK HERE to see how create an API key to authenticate.
Running the CLI
catocli -h
catocli query -h
catocli query entityLookup -h
catocli query entityLookup '{"type":"country"}`
// Override the accountID value as a cli argument
catocli query entityLookup -accountID=12345 '{"type":"country"}`
Check out run locally not as pip package
git clone git@github.com:Cato-Networks/cato-cli.git
cd cato-cli
python3 -m catocli -h
Advanced cato-cli Topics
- Common Patterns & Best Practices - Output formats, time frames, filtering patterns
- Python Integration - Windows - Windows-specific Python automation examples
- Python Integration - Unix/Linux/macOS - Unix-based Python integration guide
- SIEM Integration Guide - Real-time security event streaming to SIEM platforms
- Terraform Rules Integration - Export/import policy rules to Terraform for IaC management
Custom Report Query Operations
Custom Report Analytics Queries
| Operation | Description | Guide |
|---|---|---|
| Account Metrics | Network performance metrics by site, user, or interface | 📊 |
| Application Statistics | User activity and application usage analysis | 📱 |
| Application Statistics Time Series | Traffic analysis over time with hourly/daily breakdowns | 📈 |
| Events Time Series | Security events, connectivity, and threat analysis | 🔒 |
| Socket Port Metrics | Socket interface performance and traffic analysis | 🔌 |
| Socket Port Time Series | Socket performance metrics over time | ⏱️ |
Quick Start Examples
Basic Network Health Check
# Get last hour account metrics
catocli query accountMetrics '{"timeFrame":"last.PT1H"}'
User Activity Report (csv format)
# Export user activity for the last month to CSV
catocli query appStats '{
"appStatsFilter": [],
"appStatsSort": [],
"dimension": [ { "fieldName": "user_name" }, { "fieldName": "domain" } ],
"measure": [
{ "aggType": "sum", "fieldName": "upstream" },
{ "aggType": "sum", "fieldName": "downstream" },
{ "aggType": "sum", "fieldName": "traffic" },
{ "aggType": "sum", "fieldName": "flows_created" }
],
"timeFrame": "last.P1D"
}' -f csv --csv-filename appStats_daily_user_activity_report.csv
Security Events Analysis
# Weekly security events breakdown
catocli query eventsTimeSeries '{
"buckets": 7,
"eventsFilter": [{"fieldName": "event_type", "operator": "is", "values": ["Security"]}],
"eventsMeasure": [{"aggType": "sum", "fieldName": "event_count"}],
"perSecond": false,
"timeFrame": "last.P7D"
}' -f csv --csv-filename eventsTimeSeries_weekly_security_events_report.csv
Output Formats
CatoCLI supports multiple output formats:
- Enhanced JSON (default): Formatted with granularity adjustments
- Raw JSON: Original API response with
-rawflag - CSV: Structured data export with
-f csv - Custom CSV: Named files with
--csv-filenameand--append-timestamp
Time Frame Options
Common time frame patterns:
last.PT1H- Last hourlast.P1D- Last daylast.P7D- Last weeklast.P1M- Last monthutc.2023-02-{28/00:00:00--28/23:59:59}- Custom UTC range
Getting Help
- Use
-hor--helpwith any command for detailed usage - Check the Cato API Documentation
- Review individual operation guides linked above
This CLI is a Python 3 application and has been tested with Python 3.6 -> 3.8
Requirements:
python 3.6 or higher
Confirm your version of python if installed:
Open a terminal
Enter: python -V or python3 -V
Installing the correct version for environment:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file catocli-3.0.47.tar.gz.
File metadata
- Download URL: catocli-3.0.47.tar.gz
- Upload date:
- Size: 7.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e42092cf0e5b6a0df8a3b9fc90bb4050981451f9a28bc8f80379db74a827983a
|
|
| MD5 |
f48ca90b639a57e44de1c88126fb34a8
|
|
| BLAKE2b-256 |
d725f40bf1279e122b3ec209f00065dab7d01da2e20292ed2eaf845217cf4237
|
Provenance
The following attestation bundles were made for catocli-3.0.47.tar.gz:
Publisher:
publish-to-pypi.yml on catonetworks/cato-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
catocli-3.0.47.tar.gz -
Subject digest:
e42092cf0e5b6a0df8a3b9fc90bb4050981451f9a28bc8f80379db74a827983a - Sigstore transparency entry: 781966844
- Sigstore integration time:
-
Permalink:
catonetworks/cato-cli@23736dfb70ee2607481503022bea03b27e1b4855 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/catonetworks
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@23736dfb70ee2607481503022bea03b27e1b4855 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file catocli-3.0.47-py3-none-any.whl.
File metadata
- Download URL: catocli-3.0.47-py3-none-any.whl
- Upload date:
- Size: 8.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a5c72108e6c29c7816f70f21c6285d5540769e81469c1829740d04b608c3633
|
|
| MD5 |
2029b98bea279f9422587ea6c6aaab2a
|
|
| BLAKE2b-256 |
06866001e8c28b9742a72ad0559a8b37122ab522800cb026d1c0f32e7e2a9015
|
Provenance
The following attestation bundles were made for catocli-3.0.47-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on catonetworks/cato-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
catocli-3.0.47-py3-none-any.whl -
Subject digest:
3a5c72108e6c29c7816f70f21c6285d5540769e81469c1829740d04b608c3633 - Sigstore transparency entry: 781966845
- Sigstore integration time:
-
Permalink:
catonetworks/cato-cli@23736dfb70ee2607481503022bea03b27e1b4855 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/catonetworks
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@23736dfb70ee2607481503022bea03b27e1b4855 -
Trigger Event:
workflow_dispatch
-
Statement type: