pingera-cli 0.1.14__tar.gz → 0.1.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pingera_cli-0.1.14/pingera_cli.egg-info → pingera_cli-0.1.16}/PKG-INFO +2 -2
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/docs/cli-commands.md +39 -21
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/__init__.py +1 -1
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/commands/checks.py +74 -27
- pingera_cli-0.1.16/pingera_cli/commands/components.py +539 -0
- pingera_cli-0.1.16/pingera_cli/commands/incidents.py +578 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/commands/on_demand_checks.py +58 -15
- pingera_cli-0.1.16/pingera_cli/commands/pages.py +810 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/formatters/__init__.py +2 -1
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/formatters/base_formatter.py +7 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/formatters/multistep_formatter.py +30 -31
- pingera_cli-0.1.16/pingera_cli/formatters/portscan_formatter.py +189 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/formatters/registry.py +2 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/formatters/ssl_formatter.py +77 -27
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/formatters/web_formatter.py +37 -32
- pingera_cli-0.1.16/pingera_cli/main.py +458 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16/pingera_cli.egg-info}/PKG-INFO +2 -2
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli.egg-info/SOURCES.txt +4 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli.egg-info/requires.txt +1 -1
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pyproject.toml +1 -1
- pingera_cli-0.1.14/pingera_cli/main.py +0 -227
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/.gitignore +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/.replit +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/LICENSE +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/README.md +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/assert +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/docs/example-check.yaml +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/docs/example-synthetic-screenshot.json +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/docs/example-web-check.json +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/__main__.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/commands/__init__.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/commands/auth.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/commands/base.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/commands/check_groups.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/commands/check_secrets.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/commands/execution_groups.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/commands/secrets.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/formatters/dns_formatter.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/formatters/generic_formatter.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/formatters/icmp_formatter.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/formatters/synthetic_formatter.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/utils/__init__.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/utils/config.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/utils/console.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli/utils/file_utils.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli.egg-info/dependency_links.txt +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli.egg-info/entry_points.txt +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pingera_cli.egg-info/top_level.txt +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/pwscript.js +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/replit.md +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/run_tests.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/setup.cfg +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/setup.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/tests/__init__.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/tests/conftest.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/tests/requirements.txt +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/tests/test_auth.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/tests/test_checks.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/tests/test_config.py +0 -0
- {pingera_cli-0.1.14 → pingera_cli-0.1.16}/tests/test_on_demand_checks.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pingera-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.16
|
|
4
4
|
Summary: A beautiful Python CLI tool built with typer and rich, distributed via pip and based on Pingera SDK
|
|
5
5
|
Home-page: https://github.com/pingera/pingera-cli
|
|
6
6
|
Author: PingeraCLI Team
|
|
@@ -31,7 +31,7 @@ Description-Content-Type: text/markdown
|
|
|
31
31
|
License-File: LICENSE
|
|
32
32
|
Requires-Dist: typer[all]>=0.9.0
|
|
33
33
|
Requires-Dist: rich>=13.0.0
|
|
34
|
-
Requires-Dist: pingera-sdk>=1.0.
|
|
34
|
+
Requires-Dist: pingera-sdk>=1.0.15
|
|
35
35
|
Requires-Dist: click>=8.0.0
|
|
36
36
|
Provides-Extra: dev
|
|
37
37
|
Requires-Dist: pytest>=6.0; extra == "dev"
|
|
@@ -195,7 +195,7 @@ pngr heartbeats ping <heartbeat-id>
|
|
|
195
195
|
pngr heartbeats logs <heartbeat-id> [--from <date>] [--to <date>] [--page <num>]
|
|
196
196
|
```
|
|
197
197
|
|
|
198
|
-
## Status Pages Commands
|
|
198
|
+
## Status Pages Commands
|
|
199
199
|
|
|
200
200
|
### `pngr pages`
|
|
201
201
|
Manage status pages.
|
|
@@ -207,43 +207,40 @@ pngr pages list [--page <num>] [--page-size <size>]
|
|
|
207
207
|
# Get specific status page
|
|
208
208
|
pngr pages get <page-id>
|
|
209
209
|
|
|
210
|
-
# Create status page
|
|
211
|
-
pngr pages create --name <
|
|
210
|
+
# Create a new status page
|
|
211
|
+
pngr pages create --name "My Status Page" [--subdomain <sub>] [--description <desc>] [--headline <text>] [--url <url>] [--private] [--timezone <tz>]
|
|
212
212
|
|
|
213
|
-
# Update status page
|
|
214
|
-
pngr pages update <page-id> --name <name> --description <desc> --
|
|
213
|
+
# Update an existing status page
|
|
214
|
+
pngr pages update <page-id> [--name <name>] [--subdomain <sub>] [--description <desc>] [--headline <text>] [--url <url>] [--public/--private] [--timezone <tz>]
|
|
215
215
|
|
|
216
|
-
# Delete status page
|
|
216
|
+
# Delete a status page
|
|
217
217
|
pngr pages delete <page-id> [--confirm]
|
|
218
218
|
```
|
|
219
219
|
|
|
220
|
-
### `pngr components`
|
|
221
|
-
Manage status page components.
|
|
220
|
+
### `pngr pages components`
|
|
221
|
+
Manage status page components (nested under pages).
|
|
222
222
|
|
|
223
223
|
```bash
|
|
224
|
-
# List components
|
|
225
|
-
pngr components list
|
|
224
|
+
# List components for a page
|
|
225
|
+
pngr pages components list --page-id <page-id>
|
|
226
226
|
|
|
227
227
|
# Get specific component
|
|
228
|
-
pngr components get <component-id>
|
|
228
|
+
pngr pages components get <component-id> --page-id <page-id>
|
|
229
229
|
|
|
230
230
|
# Create component
|
|
231
|
-
pngr components create --name <name> [--description <desc>] [--status <status>] [--
|
|
231
|
+
pngr pages components create --name <name> --page-id <page-id> [--description <desc>] [--status <status>] [--group-id <id>] [--position <num>] [--showcase] [--only-if-degraded] [--start-date <YYYY-MM-DD>]
|
|
232
232
|
|
|
233
233
|
# Update component
|
|
234
|
-
pngr components update <component-id> --name <name> --description <desc> --
|
|
234
|
+
pngr pages components update <component-id> --page-id <page-id> [--name <name>] [--description <desc>] [--status <status>] [--group-id <id>] [--position <num>] [--showcase/--no-showcase] [--only-if-degraded/--always-show]
|
|
235
235
|
|
|
236
236
|
# Delete component
|
|
237
|
-
pngr components delete <component-id>
|
|
238
|
-
|
|
239
|
-
# Update component status
|
|
240
|
-
pngr components status <component-id> --status <status> [--page-id <id>]
|
|
237
|
+
pngr pages components delete <component-id> --page-id <page-id> [--confirm]
|
|
241
238
|
|
|
242
239
|
# Get component uptime
|
|
243
|
-
pngr components uptime <component-id>
|
|
240
|
+
pngr pages components uptime <component-id> --page-id <page-id> [--start <date>] [--end <date>]
|
|
244
241
|
|
|
245
|
-
#
|
|
246
|
-
pngr components uptime-bulk --
|
|
242
|
+
# Get uptime for all components (bulk)
|
|
243
|
+
pngr pages components uptime-bulk --page-id <page-id> [--start <date>] [--end <date>]
|
|
247
244
|
```
|
|
248
245
|
|
|
249
246
|
### `pngr incidents`
|
|
@@ -515,11 +512,32 @@ pngr checks run custom --url https://example.com --type ssl --name "SSL Certific
|
|
|
515
512
|
# Execute existing check and wait for result
|
|
516
513
|
pngr checks run existing check_123 --wait-for-result
|
|
517
514
|
|
|
515
|
+
# Update a status page
|
|
516
|
+
pngr pages update page_123 --name "Updated Name" --description "New description"
|
|
517
|
+
|
|
518
|
+
# Make a page public
|
|
519
|
+
pngr pages update page_123 --public
|
|
520
|
+
|
|
521
|
+
# Update page timezone and language
|
|
522
|
+
pngr pages update page_123 --timezone "America/New_York" --language "en"
|
|
523
|
+
|
|
518
524
|
# Create an incident
|
|
519
525
|
pngr incidents create --name "Database Issues" --body "Investigating connectivity" --status investigating --impact major
|
|
520
526
|
|
|
521
527
|
# Update component status
|
|
522
|
-
pngr components
|
|
528
|
+
pngr pages components update comp_123 --page-id page_123 --status degraded_performance
|
|
529
|
+
|
|
530
|
+
# Get uptime for a specific component
|
|
531
|
+
pngr pages components uptime comp_123 --page-id page_123
|
|
532
|
+
|
|
533
|
+
# Get uptime for a specific component with date range
|
|
534
|
+
pngr pages components uptime comp_123 --page-id page_123 --start 2024-01-01 --end 2024-01-31
|
|
535
|
+
|
|
536
|
+
# Get uptime for all components on a page
|
|
537
|
+
pngr pages components uptime-bulk --page-id page_123
|
|
538
|
+
|
|
539
|
+
# Get uptime for all components with date range
|
|
540
|
+
pngr pages components uptime-bulk --page-id page_123 --start 2024-01-01 --end 2024-01-31
|
|
523
541
|
|
|
524
542
|
# Update check with custom parameters (Playwright script and regions)
|
|
525
543
|
pngr checks update check_123 --parameters '{"pw_script": "const { test, expect } = require(\"@playwright/test\"); test(\"example\", async ({ page }) => { await page.goto(\"https://example.com\"); await expect(page).toHaveTitle(/Example/); });", "regions": ["US", "EU"]}'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Pingera CLI - A beautiful CLI tool for Pingera Platform
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
__version__ = "0.1.
|
|
5
|
+
__version__ = "0.1.16"
|
|
6
6
|
__author__ = "Pingera Team"
|
|
7
7
|
__description__ = "A beautiful Python CLI tool built with typer and rich, distributed via pip and based on Pingera SDK"
|
|
8
8
|
|
|
@@ -14,6 +14,9 @@ from rich.prompt import Confirm
|
|
|
14
14
|
from .base import BaseCommand
|
|
15
15
|
from ..utils.config import get_api_key
|
|
16
16
|
|
|
17
|
+
# Supported check types
|
|
18
|
+
SUPPORTED_CHECK_TYPES = ["web", "api", "tcp", "ssl", "dns", "icmp", "portscan", "synthetic", "multistep"]
|
|
19
|
+
|
|
17
20
|
|
|
18
21
|
class ChecksCommand(BaseCommand):
|
|
19
22
|
"""
|
|
@@ -412,7 +415,7 @@ class ChecksCommand(BaseCommand):
|
|
|
412
415
|
self.display_error(str(e))
|
|
413
416
|
raise typer.Exit(1)
|
|
414
417
|
|
|
415
|
-
def create_check(self, name: str, check_type: str, url: Optional[str] = None, host: Optional[str] = None, port: Optional[int] = None, interval: int = 300, timeout: int = 30, parameters: Optional[str] = None, pw_script_file: Optional[str] = None, from_file: Optional[str] = None):
|
|
418
|
+
def create_check(self, name: str, check_type: str, url: Optional[str] = None, host: Optional[str] = None, port: Optional[int] = None, interval: int = 300, timeout: int = 30, parameters: Optional[str] = None, pw_script_file: Optional[str] = None, from_file: Optional[str] = None, regions: Optional[str] = None):
|
|
416
419
|
"""Create a new monitoring check"""
|
|
417
420
|
try:
|
|
418
421
|
import json
|
|
@@ -525,7 +528,14 @@ class ChecksCommand(BaseCommand):
|
|
|
525
528
|
self.display_error(f"Failed to read Playwright script file: {str(e)}")
|
|
526
529
|
raise typer.Exit(1)
|
|
527
530
|
|
|
528
|
-
#
|
|
531
|
+
# Handle regions parameter - add to params_dict if provided and not in parameters
|
|
532
|
+
if regions is not None and parameters is None:
|
|
533
|
+
# Parse comma-separated regions into a list
|
|
534
|
+
regions_list = [r.strip() for r in regions.split(',') if r.strip()]
|
|
535
|
+
if regions_list:
|
|
536
|
+
params_dict["regions"] = regions_list
|
|
537
|
+
|
|
538
|
+
# Parse parameters JSON if provided (this takes precedence over --regions)
|
|
529
539
|
if parameters is not None:
|
|
530
540
|
try:
|
|
531
541
|
parsed_params = json.loads(parameters)
|
|
@@ -583,7 +593,7 @@ class ChecksCommand(BaseCommand):
|
|
|
583
593
|
self.display_error(f"Failed to create check: {str(e)}")
|
|
584
594
|
raise typer.Exit(1)
|
|
585
595
|
|
|
586
|
-
def update_check(self, check_id: str, name: Optional[str] = None, url: Optional[str] = None, host: Optional[str] = None, port: Optional[int] = None, interval: Optional[int] = None, timeout: Optional[int] = None, active: Optional[bool] = None, parameters: Optional[str] = None, pw_script_file: Optional[str] = None):
|
|
596
|
+
def update_check(self, check_id: str, name: Optional[str] = None, url: Optional[str] = None, host: Optional[str] = None, port: Optional[int] = None, interval: Optional[int] = None, timeout: Optional[int] = None, active: Optional[bool] = None, parameters: Optional[str] = None, pw_script_file: Optional[str] = None, regions: Optional[str] = None):
|
|
587
597
|
"""Update an existing check"""
|
|
588
598
|
try:
|
|
589
599
|
import json
|
|
@@ -629,7 +639,14 @@ class ChecksCommand(BaseCommand):
|
|
|
629
639
|
self.display_error(f"Failed to read Playwright script file: {str(e)}")
|
|
630
640
|
raise typer.Exit(1)
|
|
631
641
|
|
|
632
|
-
#
|
|
642
|
+
# Handle regions parameter - add to params_dict if provided and not in parameters
|
|
643
|
+
if regions is not None and parameters is None:
|
|
644
|
+
# Parse comma-separated regions into a list
|
|
645
|
+
regions_list = [r.strip() for r in regions.split(',') if r.strip()]
|
|
646
|
+
if regions_list:
|
|
647
|
+
params_dict["regions"] = regions_list
|
|
648
|
+
|
|
649
|
+
# Parse parameters JSON if provided (this takes precedence over --regions)
|
|
633
650
|
if parameters is not None:
|
|
634
651
|
try:
|
|
635
652
|
parsed_params = json.loads(parameters)
|
|
@@ -749,7 +766,7 @@ class ChecksCommand(BaseCommand):
|
|
|
749
766
|
# If result_id was specified, we're fetching a single result - display it with full formatting
|
|
750
767
|
if result_id and len(response.results) == 1:
|
|
751
768
|
result = response.results[0]
|
|
752
|
-
|
|
769
|
+
|
|
753
770
|
if self.output_format in ['json', 'yaml']:
|
|
754
771
|
result_dict = {
|
|
755
772
|
"id": str(result.id) if hasattr(result, 'id') and result.id else None,
|
|
@@ -901,10 +918,8 @@ class ChecksCommand(BaseCommand):
|
|
|
901
918
|
|
|
902
919
|
# Provide helpful hints based on context
|
|
903
920
|
hints = []
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
else:
|
|
907
|
-
hints.append("Use 'pngr checks results --result-id <result-id>' for detailed result info")
|
|
921
|
+
hints.append("Use 'pngr checks result <result-id>' for detailed result info")
|
|
922
|
+
if not check_id:
|
|
908
923
|
hints.append("Use 'pngr checks list' to see all available checks and their IDs")
|
|
909
924
|
hints.append("Filter results: --type <type>, --status <status>, --region <region>")
|
|
910
925
|
|
|
@@ -935,16 +950,19 @@ class ChecksCommand(BaseCommand):
|
|
|
935
950
|
self.display_error(f"Failed to get result details: {str(e)}")
|
|
936
951
|
raise typer.Exit(1)
|
|
937
952
|
|
|
938
|
-
def get_check_result_detailed(self,
|
|
939
|
-
"""Get detailed information for a specific check result using
|
|
953
|
+
def get_check_result_detailed(self, result_id: str, verbose: bool = False):
|
|
954
|
+
"""Get detailed information for a specific check result using result_id"""
|
|
940
955
|
try:
|
|
941
|
-
|
|
956
|
+
unified_api = self.get_unified_results_client()
|
|
942
957
|
|
|
943
|
-
# Use the
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
958
|
+
# Use the unified results API with result_id filter
|
|
959
|
+
response = unified_api.v1_checks_all_results_get(result_id=result_id)
|
|
960
|
+
|
|
961
|
+
if not hasattr(response, 'results') or not response.results or len(response.results) == 0:
|
|
962
|
+
self.display_error(f"Result {result_id} not found")
|
|
963
|
+
raise typer.Exit(1)
|
|
964
|
+
|
|
965
|
+
result = response.results[0]
|
|
948
966
|
|
|
949
967
|
if self.output_format in ['json', 'yaml']:
|
|
950
968
|
# Full result data for JSON/YAML
|
|
@@ -979,7 +997,7 @@ class ChecksCommand(BaseCommand):
|
|
|
979
997
|
response_time_display = f"{result.response_time}ms"
|
|
980
998
|
else:
|
|
981
999
|
response_time_display = 'N/A'
|
|
982
|
-
|
|
1000
|
+
|
|
983
1001
|
basic_info = f"""[bold cyan]Basic Information:[/bold cyan]
|
|
984
1002
|
• Result ID: [white]{result.id}[/white]
|
|
985
1003
|
• Check ID: [white]{result.check_id}[/white]
|
|
@@ -1058,6 +1076,7 @@ class ChecksCommand(BaseCommand):
|
|
|
1058
1076
|
region_dict = {
|
|
1059
1077
|
"id": str(region.id) if hasattr(region, 'id') and region.id else None,
|
|
1060
1078
|
"display_name": region.display_name if hasattr(region, 'display_name') and region.display_name else None,
|
|
1079
|
+
"aliases": region.aliases if hasattr(region, 'aliases') and region.aliases else None,
|
|
1061
1080
|
"available_check_types": region.available_check_types if hasattr(region, 'available_check_types') and region.available_check_types else None
|
|
1062
1081
|
}
|
|
1063
1082
|
regions_data.append(region_dict)
|
|
@@ -1073,6 +1092,7 @@ class ChecksCommand(BaseCommand):
|
|
|
1073
1092
|
table = Table(title=table_title)
|
|
1074
1093
|
table.add_column("Region ID", style="cyan", min_width=15)
|
|
1075
1094
|
table.add_column("Display Name", style="green", min_width=25)
|
|
1095
|
+
table.add_column("Aliases", style="yellow", min_width=20)
|
|
1076
1096
|
table.add_column("Available Check Types", style="white")
|
|
1077
1097
|
|
|
1078
1098
|
for region in response.regions:
|
|
@@ -1080,6 +1100,14 @@ class ChecksCommand(BaseCommand):
|
|
|
1080
1100
|
region_id = str(region.id) if hasattr(region, 'id') and region.id else "-"
|
|
1081
1101
|
display_name = region.display_name if hasattr(region, 'display_name') and region.display_name else "-"
|
|
1082
1102
|
|
|
1103
|
+
# Handle aliases
|
|
1104
|
+
aliases_display = "-"
|
|
1105
|
+
if hasattr(region, 'aliases') and region.aliases:
|
|
1106
|
+
if isinstance(region.aliases, list):
|
|
1107
|
+
aliases_display = ", ".join(region.aliases)
|
|
1108
|
+
else:
|
|
1109
|
+
aliases_display = str(region.aliases)
|
|
1110
|
+
|
|
1083
1111
|
# Handle available check types
|
|
1084
1112
|
available_types = "-"
|
|
1085
1113
|
if hasattr(region, 'available_check_types') and region.available_check_types:
|
|
@@ -1091,6 +1119,7 @@ class ChecksCommand(BaseCommand):
|
|
|
1091
1119
|
table.add_row(
|
|
1092
1120
|
region_id,
|
|
1093
1121
|
display_name,
|
|
1122
|
+
aliases_display,
|
|
1094
1123
|
available_types
|
|
1095
1124
|
)
|
|
1096
1125
|
|
|
@@ -1169,15 +1198,15 @@ def list_checks(
|
|
|
1169
1198
|
):
|
|
1170
1199
|
"""List monitoring checks with advanced filtering options"""
|
|
1171
1200
|
from ..utils.config import get_output_format
|
|
1172
|
-
|
|
1201
|
+
|
|
1173
1202
|
# Validate name length
|
|
1174
1203
|
if name and len(name) > 100:
|
|
1175
1204
|
typer.echo("Error: Name filter cannot exceed 100 characters", err=True)
|
|
1176
1205
|
raise typer.Exit(1)
|
|
1177
1206
|
|
|
1178
1207
|
# Validate check type
|
|
1179
|
-
if check_type and check_type not in
|
|
1180
|
-
typer.echo("Error: Invalid check type. Must be one of:
|
|
1208
|
+
if check_type and check_type not in SUPPORTED_CHECK_TYPES:
|
|
1209
|
+
typer.echo(f"Error: Invalid check type '{check_type}'. Must be one of: {', '.join(SUPPORTED_CHECK_TYPES)}", err=True)
|
|
1181
1210
|
raise typer.Exit(1)
|
|
1182
1211
|
|
|
1183
1212
|
# Validate status values if provided
|
|
@@ -1214,7 +1243,8 @@ def create_check(
|
|
|
1214
1243
|
timeout: int = typer.Option(30, "--timeout", help="Timeout in seconds"),
|
|
1215
1244
|
parameters: Optional[str] = typer.Option(None, "--parameters", help="JSON string with check parameters (e.g., '{\"regions\": [\"US\", \"EU\"]}')"),
|
|
1216
1245
|
pw_script_file: Optional[str] = typer.Option(None, "--pw-script-file", help="Path to file containing Playwright script for synthetic/multistep checks"),
|
|
1217
|
-
from_file: Optional[str] = typer.Option(None, "--from-file", "-f", help="Path to JSON or YAML file containing check configuration")
|
|
1246
|
+
from_file: Optional[str] = typer.Option(None, "--from-file", "-f", help="Path to JSON or YAML file containing check configuration"),
|
|
1247
|
+
regions: Optional[str] = typer.Option(None, "--regions", help="Comma-separated list of regions (e.g., 'ru-central1,eu-west1')"),
|
|
1218
1248
|
):
|
|
1219
1249
|
"""Create a new monitoring check. Can be created from command line options or from a JSON/YAML file.
|
|
1220
1250
|
|
|
@@ -1236,8 +1266,13 @@ def create_check(
|
|
|
1236
1266
|
typer.echo("Error: --name is required when not using --from-file", err=True)
|
|
1237
1267
|
raise typer.Exit(1)
|
|
1238
1268
|
|
|
1269
|
+
# Validate check type
|
|
1270
|
+
if check_type not in SUPPORTED_CHECK_TYPES:
|
|
1271
|
+
typer.echo(f"Error: Invalid check type '{check_type}'. Must be one of: {', '.join(SUPPORTED_CHECK_TYPES)}", err=True)
|
|
1272
|
+
raise typer.Exit(1)
|
|
1273
|
+
|
|
1239
1274
|
checks_cmd = ChecksCommand(get_output_format())
|
|
1240
|
-
checks_cmd.create_check(name, check_type, url, host, port, interval, timeout, parameters, pw_script_file, from_file)
|
|
1275
|
+
checks_cmd.create_check(name, check_type, url, host, port, interval, timeout, parameters, pw_script_file, from_file, regions)
|
|
1241
1276
|
|
|
1242
1277
|
|
|
1243
1278
|
@app.command("update")
|
|
@@ -1251,12 +1286,13 @@ def update_check(
|
|
|
1251
1286
|
timeout: Optional[int] = typer.Option(None, "--timeout", help="New timeout in seconds"),
|
|
1252
1287
|
active: bool = typer.Option(None, "--active/--inactive", help="Enable or disable the check"),
|
|
1253
1288
|
parameters: Optional[str] = typer.Option(None, "--parameters", help="JSON string with check parameters (e.g., '{\"pw_script\": \"...\", \"regions\": [\"US\", \"EU\"]}')"),
|
|
1254
|
-
pw_script_file: Optional[str] = typer.Option(None, "--pw-script-file", help="Path to file containing Playwright script for synthetic/multistep checks")
|
|
1289
|
+
pw_script_file: Optional[str] = typer.Option(None, "--pw-script-file", help="Path to file containing Playwright script for synthetic/multistep checks"),
|
|
1290
|
+
regions: Optional[str] = typer.Option(None, "--regions", help="Comma-separated list of regions (e.g., 'ru-central1,eu-west1')"),
|
|
1255
1291
|
):
|
|
1256
1292
|
"""Update an existing check. Use --parameters to provide complex parameters like Playwright scripts, regions, etc."""
|
|
1257
1293
|
from ..utils.config import get_output_format
|
|
1258
1294
|
checks_cmd = ChecksCommand(get_output_format())
|
|
1259
|
-
checks_cmd.update_check(check_id, name, url, host, port, interval, timeout, active, parameters, pw_script_file)
|
|
1295
|
+
checks_cmd.update_check(check_id, name, url, host, port, interval, timeout, active, parameters, pw_script_file, regions)
|
|
1260
1296
|
|
|
1261
1297
|
|
|
1262
1298
|
@app.command("delete")
|
|
@@ -1284,20 +1320,25 @@ def get_results(
|
|
|
1284
1320
|
):
|
|
1285
1321
|
"""Get check results with advanced filtering. If no check_id is provided, returns unified results across all checks. Use --result-id to fetch a specific result."""
|
|
1286
1322
|
from ..utils.config import get_output_format
|
|
1323
|
+
|
|
1324
|
+
# Validate check type
|
|
1325
|
+
if check_type and check_type not in SUPPORTED_CHECK_TYPES:
|
|
1326
|
+
typer.echo(f"Error: Invalid check type '{check_type}'. Must be one of: {', '.join(SUPPORTED_CHECK_TYPES)}", err=True)
|
|
1327
|
+
raise typer.Exit(1)
|
|
1328
|
+
|
|
1287
1329
|
checks_cmd = ChecksCommand(get_output_format())
|
|
1288
1330
|
checks_cmd.get_check_results(check_id, from_date, to_date, page, page_size, status, check_type, region, result_id)
|
|
1289
1331
|
|
|
1290
1332
|
|
|
1291
1333
|
@app.command("result")
|
|
1292
1334
|
def get_result(
|
|
1293
|
-
check_id: str = typer.Argument(..., help="Check ID"),
|
|
1294
1335
|
result_id: str = typer.Argument(..., help="Result ID to retrieve detailed information for"),
|
|
1295
1336
|
verbose: bool = typer.Option(False, "--verbose", "-v", help="Show full detailed information including network requests"),
|
|
1296
1337
|
):
|
|
1297
1338
|
"""Get detailed information for a specific check result"""
|
|
1298
1339
|
from ..utils.config import get_output_format
|
|
1299
1340
|
checks_cmd = ChecksCommand(get_output_format())
|
|
1300
|
-
checks_cmd.get_check_result_detailed(
|
|
1341
|
+
checks_cmd.get_check_result_detailed(result_id, verbose)
|
|
1301
1342
|
|
|
1302
1343
|
|
|
1303
1344
|
@app.command("list-regions")
|
|
@@ -1306,6 +1347,12 @@ def list_regions(
|
|
|
1306
1347
|
):
|
|
1307
1348
|
"""List available regions for monitoring checks"""
|
|
1308
1349
|
from ..utils.config import get_output_format
|
|
1350
|
+
|
|
1351
|
+
# Validate check type
|
|
1352
|
+
if check_type and check_type not in SUPPORTED_CHECK_TYPES:
|
|
1353
|
+
typer.echo(f"Error: Invalid check type '{check_type}'. Must be one of: {', '.join(SUPPORTED_CHECK_TYPES)}", err=True)
|
|
1354
|
+
raise typer.Exit(1)
|
|
1355
|
+
|
|
1309
1356
|
checks_cmd = ChecksCommand(get_output_format())
|
|
1310
1357
|
checks_cmd.list_regions(check_type)
|
|
1311
1358
|
|