Skip to content

feat: support add Monitor api plugin#879

Open
susharma-beep wants to merge 3 commits intolinode:devfrom
susharma-beep:monitor-api-plugin
Open

feat: support add Monitor api plugin#879
susharma-beep wants to merge 3 commits intolinode:devfrom
susharma-beep:monitor-api-plugin

Conversation

@susharma-beep
Copy link
Copy Markdown

📝 Description

What does this PR do and why is this change necessary?

This PR adds a new monitor-api plugin for the Linode CLI that provides access to the Linode Monitor API for querying metrics across various services.

Key features:

Query metrics for multiple services: DBaaS, NodeBalancer, NetLoadBalancer, Linode, Firewall, ObjectStorage, BlockStorage, and LKE
Support for both relative time duration (--duration/--duration-unit) and absolute time ranges (--start-time/--end-time)
Mandatory aggregate functions for all metrics (sum, avg, max, min, count)
Optional filtering, grouping, and granularity controls
Region-based queries for services like ObjectStorage
Comprehensive validation for all input parameters

✔️ How to Test

What are the steps to reproduce the issue or verify the changes?
Set the authentication token:
export JWE_TOKEN='your_jwe_token_here'
Test basic metrics query:
linode-cli monitor-api get-metrics objectstorage
--entity-region us-east-1 --duration 15 --duration-unit min
--metrics obj_requests_num:sum
Test with filters:
linode-cli monitor-api get-metrics dbaas --entity-ids 123
--duration 15 --duration-unit min --metrics cpu_usage:avg
--filters 'node_type:in:primary,secondary'
Test help command:
linode-cli monitor-api get-metrics --help

How do I run the relevant unit/integration tests?

Run unit tests (no authentication required)

pytest tests/unit/test_plugin_get_metrics.py -v

Run integration tests (requires JWE_TOKEN)

export JWE_TOKEN='your_token'
pytest tests/integration/monitor/test_plugin_get_metrics.py -v

Run linting

make lint

This plugin provides access to the Linode Monitor API, allowing users to query metrics for various services with options for filtering and time duration.
Add unit tests for monitor-api metrics functionality
Added integration tests for the get_metrics plugin, covering various scenarios including missing arguments, invalid service names, and handling of filters.
@susharma-beep susharma-beep requested review from a team as code owners April 9, 2026 09:18
@susharma-beep susharma-beep requested review from ckulinsk and jbilskiAkam and removed request for a team April 9, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant