Delete an alert rule
Updated at:
You can call the DeleteAlert operation to delete a specified alert rule.
Prerequisites
-
Simple Log Service is activated. For more information, see Activate Simple Log Service.
-
The Simple Log Service SDK for Python is initialized. For more information, see Initialize Simple Log Service SDK for Python.
Parameter description
def delete_alert(self, project, entity):
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
|
project |
String |
Yes |
The name of the project. |
demo-test-project |
|
entity |
String |
Yes |
The ID of the alert rule. |
alert-0123456789-123456 |
Response parameters
For more information about the response parameters, see DeleteAlert.
Sample code
from aliyun.log import LogClient
import os
def main():
# In this example, the AccessKey ID and AccessKey secret are obtained from environment variables.
accessKeyId = os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID', '')
accessKey = os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET', '')
# Specify a Simple Log Service endpoint.
endpoint = "cn-hangzhou.log.aliyuncs.com"
project = 'demo-test-project'
alertId = 'alert-0123456789-123456'
client = LogClient(endpoint, accessKeyId, accessKey)
res = client.delete_alert(project, alertId)
res.log_print()
if __name__ == '__main__':
main()
References
-
For more information about alert rule APIs, see the following topics:
-
For more sample code, see Alibaba Cloud Simple Log Service SDK for Python on GitHub.
Is this page helpful?