Skip to content

Manage CloudWatch status-check alarms with VM lifecycle#21

Open
frank-veriff wants to merge 3 commits into
markokr:masterfrom
frank-veriff:cloudwatch-status-alarms
Open

Manage CloudWatch status-check alarms with VM lifecycle#21
frank-veriff wants to merge 3 commits into
markokr:masterfrom
frank-veriff:cloudwatch-status-alarms

Conversation

@frank-veriff

Copy link
Copy Markdown

Adds optional per-VM CloudWatch status-check alarms, managed with the VM
lifecycle like DNS/EIP/ENI attachments:

  • create (all variants): alarms filed in vm_create_finish
  • terminate / gc: alarms deleted; gc additionally prunes orphaned alarms
    of VMs deleted outside vmtool
  • new alarm-sync command: re-ensure alarms for running role VMs

Config-driven, off by default:

  • cloudwatch_alarm_checks - comma list of system, instance, ebs
    (unset = feature fully inert)
  • cloudwatch_alarm_prefix - alarm name prefix (default vm-status-)
  • cloudwatch_alarm_topic - optional SNS topic for system/ebs alarm actions
  • cloudwatch_alarm_desc_<check> - description text per check

Compatibility: purely additive, no existing lines modified; without the
config keys every code path no-ops; alarm API failures warn on stderr and
never fail create/terminate. Verified with live create/terminate/gc
cycles; passes the test suite and .pylintrc lint.

Create per-VM status-check alarms at create, delete at terminate/gc,
plus an alarm-sync command. Config-driven (cloudwatch_alarm_checks,
_prefix, _topic, _desc_*); no-op when unconfigured, non-fatal on AWS
errors.
Create per-VM status-check alarms at create, delete them at
terminate/gc, prune orphans of externally-deleted VMs during gc.
Adds alarm-sync command. Config-driven (cloudwatch_alarm_checks,
_prefix, _topic, _desc_*); off by default, non-fatal on AWS errors.
@frank-veriff

Copy link
Copy Markdown
Author

tests ran through, followed existing patterns.

Comment thread vmtool/aws.py
client = self.get_cloudwatch()
try:
for pos in range(0, len(names), 100):
client.delete_alarms(AlarmNames=names[pos:pos + 100])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while it's unlikely, with large volumes this may get throttled

Comment thread vmtool/aws.py
OKActions=actions)
except Exception as ex:
eprintf("WARNING: alarm create failed (%s/%s): %s", vm_id, check, ex)
return

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should continue instead of returning?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants