Update Function

Updated 4 months ago by Shoreline

Update resource

Syntax:

  • <resource_name>.description = “<a description>”
  • <resource_name>.value> = “<a value>”

Examples:

  • op> host.description = “this command lists all hosts”
  • op> aws.description = "this command lists all resources on AWS"

Update metric

Syntax:

  • <metric_name>.description = “<description>”
  • <metric_name>.formula = “<formula>”

Examples:

  • op> cpu_usage.description = "this metric lists cpu usage"
  • op> cpu_usage.formula =  “100 - 100 * (metric_query(metric_names="node_cpu_seconds_total", tags={"mode":"idle"}) | irate(2) | r_mean”

Update alarm

Before you can update an alarm, you will need to create the alarm, specify the resource, and enable the alarm.  By default, alarms are disabled.

Here are the values that you can update for an alarm:

fire_query

metric_name

resource_type

private

resolve

resource_query

resource_tags

clear_query

condition_type

mute_query

user_id

family

condition_value

enabled

visibility

raise_for

Syntax:

  • <alarm_name>.description = “<a description>”
  • <alarm_name>.fire_query> = “<new query>”
  • enable <alarm_name>
  • disable <alarm_name>

Examples:

  • op> cpu_alarm.fire_query = (metric_query(metric_name="cpu") | window(10s)) > 85
  • op> cpu_alarm.description = "a description"
  • op> mem_alarm.resource_type = "container"
  • op> enable cpu_alarm
  • op> disable cpu_alarm

Update action

Before you can update an action, you will need to create the action, specify the resource, and enable the action.  By default, actions are disabled.

Syntax:

  • <action_name>.description = “<a description>”
  • enable <action_name>
  • disable <action_name>

Examples:

  • op> cpu_info.command = `cat /proc/cpuinfo`
  • op> enable cpu_info
  • op> disable cpu_info

Update bot

Syntax:

  • <bot_name>.description = “<a description>”

Examples:

  • op> cpu_bot.action = cpu_info
  • op> enable cpu_bot


How did we do?