Skip to content

Instantly share code, notes, and snippets.

@stefhen
Last active November 14, 2016 20:47
Show Gist options
  • Save stefhen/4af8e3886a6724c99d3bbad493ca76e5 to your computer and use it in GitHub Desktop.
Save stefhen/4af8e3886a6724c99d3bbad493ca76e5 to your computer and use it in GitHub Desktop.
Create RightScale alert via rsc cli tool
  • Append additional collectd metric to /etc/collectd.conf TypesDb line
  • Find instance self via rsc.txt command above
# Extract hostname to place in collectd.conf
rsc --rl10 cm15 index_instance_session /api/sessions/instance --x1 '.monitoring_id'
usage: rsc [<FLAGS>] cm15 create alert_specs [<PARAMS>]
Creates a new AlertSpec with the given parameters.
Required parameters:
alert_spec
PARAMS:
alert_spec[escalation_name]=string
<optional> Escalate to the named alert escalation when the alert is triggered. Must either escalate or vote.
alert_spec[subject_href]=string
<optional> The href of the resource that this AlertSpec should be associated with. The subject can be a ServerTemplate, Server, ServerArray, or Instance.
alert_spec[description]=string
<optional> The description of the AlertSpec.
alert_spec[threshold]=string
<required> The threshold of the condition sentence.
alert_spec[condition]=string
<required, [>|>=|<|<=|==|!=]> The condition (operator) in the condition sentence.
alert_spec[vote_type]=string
<optional, [grow|shrink]> Vote to grow or shrink a ServerArray when the alert is triggered. Must either escalate or vote.
alert_spec[variable]=string
<required> The RRD variable of the condition sentence.
alert_spec[duration]=string
<required> The duration in minutes of the condition sentence.
alert_spec[vote_tag]=string
<optional> Should correspond to a vote tag on a ServerArray if vote to grow or shrink.
alert_spec[name]=string
<required> The name of the AlertSpec.
alert_spec[file]=string
<required> The RRD path/file_name of the condition sentence.
SESSION=$(rsc --rl10 --x1 ':has(.rel:val("self")).href' cm15 index_instance_session /api/sessions/instance)
rsc --rl10 cm15 create alert_specs \
alert_spec[escalation_name]=warning \
alert_spec[threshold]=5 \
alert_spec[condition]=">" \
alert_spec[variable]="shortterm" \
alert_spec[duration]=2 \
alert_spec[name]="xxx" \
alert_spec[file]="load/load" \
alert_spec[subject_href]=$SESSION
# Extract session id
rsc --rl10 --x1 ':has(.rel:val("self")).href' cm15 index_instance_session /api/sessions/instance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment