阅读本文,您可以获取 Python SDK 告警管理的接口调用示例,实现快速开发。
调用接口前,请先完成 Python SDK 的安装及初始化操作。
本节为您介绍告警管理相关接口的功能和调用示例。
您可以调用 CreateImageMonitorRule 接口新建告警规则。详细的参数说明可参见 CreateImageMonitorRule 接口文档。
接口调用示例如下所示。
# coding:utf-8 from volcengine.imagex.v2.imagex_service import ImagexService if __name__ == '__main__': service = ImagexService() # call below method if you dont set ak and sk in $HOME/.volc/config service.set_ak('ak') service.set_sk('sk') query = {} body = {} resp = service.create_image_monitor_rule(query, body) print(resp)
您可以调用 DeleteImageMonitorRules 接口删除告警规则。详细的参数说明可参见 DeleteImageMonitorRules 接口文档。
接口调用示例如下所示。
# coding:utf-8 from volcengine.imagex.v2.imagex_service import ImagexService if __name__ == '__main__': service = ImagexService() # call below method if you dont set ak and sk in $HOME/.volc/config service.set_ak('ak') service.set_sk('sk') query = {} body = {} resp = service.delete_image_monitor_rules(query, body) print(resp)
您可以调用 DeleteImageMonitorRecords 接口删除告警记录。详细的参数说明可参见 DeleteImageMonitorRecords 接口文档。
接口调用示例如下所示。
# coding:utf-8 from volcengine.imagex.v2.imagex_service import ImagexService if __name__ == '__main__': service = ImagexService() # call below method if you dont set ak and sk in $HOME/.volc/config service.set_ak('ak') service.set_sk('sk') query = {} body = {} resp = service.delete_image_monitor_records(query, body) print(resp)
您可以调用 UpdateImageMonitorRule 接口更新告警规则。详细的参数说明可参见 UpdateImageMonitorRule 接口文档。
接口调用示例如下所示。
# coding:utf-8 from volcengine.imagex.v2.imagex_service import ImagexService if __name__ == '__main__': service = ImagexService() # call below method if you dont set ak and sk in $HOME/.volc/config service.set_ak('ak') service.set_sk('sk') query = {} body = {} resp = service.update_image_monitor_rule(query, body) print(resp)
您可以调用 UpdateImageMonitorRuleStatus 接口更新告警规则状态。详细的参数说明可参见 UpdateImageMonitorRuleStatus 接口文档。
接口调用示例如下所示。
# coding:utf-8 from volcengine.imagex.v2.imagex_service import ImagexService if __name__ == '__main__': service = ImagexService() # call below method if you dont set ak and sk in $HOME/.volc/config service.set_ak('ak') service.set_sk('sk') query = {} body = {} resp = service.update_image_monitor_rule_status(query, body) print(resp)
您可以调用 GetImageMonitorRules 接口获取所有告警规则。详细的参数说明可参见 GetImageMonitorRules 接口文档。
接口调用示例如下所示。
# coding:utf-8 from volcengine.imagex.v2.imagex_service import ImagexService if __name__ == '__main__': service = ImagexService() # call below method if you dont set ak and sk in $HOME/.volc/config service.set_ak('ak') service.set_sk('sk') query = {} resp = service.get_image_monitor_rules(query) print(resp)
您可以调用 GetImageAlertRecords 接口获取所有告警记录。详细的参数说明可参见 GetImageAlertRecords 接口文档。
接口调用示例如下所示。
# coding:utf-8 from volcengine.imagex.v2.imagex_service import ImagexService if __name__ == '__main__': service = ImagexService() # call below method if you dont set ak and sk in $HOME/.volc/config service.set_ak('ak') service.set_sk('sk') query = {} body = {} resp = service.get_image_alert_records(query, body) print(resp)