认证
此提供商需要身份验证。
- host_url: Grafana 主机 URL(必需:True,敏感:False)
- service_account_token: 服务账户令牌(必需:True,敏感:True)
某些范围可能需要才能通过提供商执行特定操作或查询。以下是相关范围及其用例的摘要:
- authenticated: 用户已身份验证
在工作流中
此提供商可用于工作流。
作为"操作"来进行更改或更新数据,示例:
yaml
actions:
- name: Query grafana_incident
provider: grafana_incident
config: "{{ provider.my_provider_name }}"
with:
operationType: {value}
updateType: {value}请查看以下工作流示例:
入门指南
- 在您的 Grafana Cloud 堆栈中,点击左侧菜单中的 Alerts & IRM。
- 点击 Incident 磁贴以为您的 Grafana Cloud 实例启用该应用。
- 启用 Grafana Incident 后,您的组织中的用户可以访问它。
连接 Provider
- 启用 Grafana Incident 应用后,导航到 Administration > Users and access > Service Accounts。
- 点击 Add Service Account 按钮创建一个新的服务账户。
- 为服务账户命名并分配 Viewer 角色。
- 点击 Add service account token,然后点击 Generate token。
- 复制生成的令牌。
- 这将用作 provider 配置中的
service_account_token参数。
创建和更新 Grafana Incidents
Grafana Incident provider 支持在 Grafana 中创建和更新事件。
operationType- 操作类型可以是create或update。updateType- 更新类型用于更新事件的各种字段。
创建事件
operationType-createtitle(str) - 事件的标题。severity(str) - 事件的严重性。labels(list) - 事件的标签。roomPrefix(str) - 聊天室前缀。isDrill(bool) - 演练状态。status(str) - 事件的状态。attachCaption(str) - 附件标题。attachURL(str) - 附件 URL。
更新事件
operationType-updateupdateType- 可更新的字段有removeLabel、unassignLabel、unassignLabelByUUID、unassignRole、updateIncidentEventTime、updateIncidentIsDrill、updateIncidentSeverity、updateIncidentStatus、updateIncidentTitle。
删除标签
incident_id(str) - 事件 ID。label(str) - 要删除的标签。
取消分配标签
incident_id(str) - 事件 ID。label(str) - 要取消分配的标签。key(str) - 要取消分配的标签的键。
按 UUID 取消分配标签
incident_id(str) - 事件 ID。key_uuid(str) - 要取消分配的标签的键 UUID。value_uuid(str) - 要取消分配的标签的值 UUID。
取消分配角色
incident_id(str) - 事件 ID。role(str) - 要取消分配的角色。user_id(str) - 要取消分配的用户 ID。
更新事件时间
incident_id(str) - 事件 ID。event_time(str) - 要更新的事件时间。event_name(str) - 要更新的事件名称。
更新事件演练状态
incident_id(str) - 事件 ID。isDrill(bool) - 要更新的演练状态。
更新事件严重性
incident_id(str) - 事件 ID。severity(str) - 要更新的严重性。
更新事件状态
incident_id(str) - 事件 ID。status(str) - 要更新的状态。
更新事件标题
incident_id(str) - 事件 ID。title(str) - 要更新的标题。