{"id":28344,"library":"tencentcloud-sdk-python-monitor","title":"Tencent Cloud Monitor SDK for Python","description":"Official Tencent Cloud SDK for the Cloud Monitor (CM) service. Provides APIs for querying monitoring data, setting alarms, and managing dashboard. Current version 3.1.92. Releases are frequent, often monthly, but breaking changes are rare. Part of the larger tencentcloud-sdk-python ecosystem.","status":"active","version":"3.1.92","language":"python","source_language":"en","source_url":"https://github.com/TencentCloud/tencentcloud-sdk-python","tags":["tencent","cloud","monitor","sdk","api"],"install":[{"cmd":"pip install tencentcloud-sdk-python-monitor","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for authentication and base client classes","package":"tencentcloud-sdk-python-common","optional":false}],"imports":[{"note":"The versioned path is required; omitting the version will cause import error.","wrong":"from tencentcloud.monitor import MonitorClient","symbol":"MonitorClient","correct":"from tencentcloud.monitor.v20180724 import monitor_client"},{"note":"Models must be imported from the versioned subpackage.","wrong":"from tencentcloud.monitor import models","symbol":"DescribeMonitorDataRequest","correct":"from tencentcloud.monitor.v20180724 import models"}],"quickstart":{"code":"import os\nfrom tencentcloud.common import credential\nfrom tencentcloud.monitor.v20180724 import monitor_client, models\n\n# Replace with your credentials\ncred = credential.Credential(\n    os.getenv('TENCENTCLOUD_SECRET_ID', ''),\n    os.getenv('TENCENTCLOUD_SECRET_KEY', '')\n)\nclient = monitor_client.MonitorClient(cred, 'ap-guangzhou')\n\n# Example: describe base metrics\nreq = models.DescribeMonitorDataRequest()\nreq.MetricName = 'cpu_usage'\n# Set other required fields...\nresp = client.DescribeMonitorData(req)\nprint(resp)\n","lang":"python","description":"Minimal authenticated client creation and a call to DescribeMonitorData."},"warnings":[{"fix":"Use `from tencentcloud.monitor.v20180724 import monitor_client` instead of `from tencentcloud.monitor import monitor_client`.","message":"Import paths must include the API version (v20180724). Without it, the import fails silently or raises ModuleNotFoundError.","severity":"gotcha","affected_versions":"all"},{"fix":"Install the sub-package (`tencentcloud-sdk-python-monitor`) and update imports to versioned paths.","message":"Migrating from SDK v2 to v3 changed the package name and import structure. v2 used `tencentcloud-sdk-python` monolithic package.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Check the official API documentation for the latest methods.","message":"Some older APIs (e.g., `DescribeBasicAlarmList`) are deprecated. Use the newer equivalents.","severity":"deprecated","affected_versions":"all"},{"fix":"Always set the region parameter when creating the client, e.g., `MonitorClient(cred, 'ap-guangzhou')`.","message":"Region must be explicitly set. If not provided, defaults to empty string causing request failures.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run: pip install tencentcloud-sdk-python-monitor tencentcloud-sdk-python-common","cause":"Missing dependency or wrong import path. The package tencentcloud-sdk-python-monitor may not be installed, or you are trying to import the module for the first time without the common package.","error":"ModuleNotFoundError: No module named 'tencentcloud.monitor'"},{"fix":"Use: from tencentcloud.monitor.v20180724 import monitor_client","cause":"The import path is incomplete. You need to include the API version.","error":"ImportError: cannot import name 'MonitorClient' from 'tencentcloud.monitor'"},{"fix":"Use the correct metric name from the Tencent Cloud Monitor documentation. For example, `cpu_usage` for CVM.","cause":"The provided metric name is incorrect or not available in the specified region.","error":"TencentCloudSDKException: [InvalidParameter] The metric name is invalid"},{"fix":"Check the exact class name in the API docs. Often it's `DescribeMonitorDataRequest` but might be other camelCase variants.","cause":"The models module may have a slightly different class name due to version differences.","error":"AttributeError: module 'tencentcloud.monitor.v20180724.models' has no attribute 'DescribeMonitorDataRequest'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}