hmar
hmar

Reputation: 117

Disable alarm actions in boto3

I'm trying to disable the alarm actions of a specifics alarms, but i'm not able to disable all of once.

With this code i get the list of all the alarms with specific pattern (apache), but i'm not able to disable all of these alarms with [disable_alarm_actions][1]..

Using this code and i got the wanted output:

names = [[alarm['AlarmName'] for alarm in response['MetricAlarms']]]
disable_response = client.disable_alarm_actions(names)

['Alarm-HHAADDD-MAJORCPUAlarm-01010101', 'Alarm-HHAADDD-MAJORMemoryAlarm-SFCJ00NF8K5Y', 'Alarm-HHAADDD-server-i-00cd64e2d815a96b5-DiskSpaceUtilization', 'Alarm-HHAADDD-server-i-00cd64e2d815a96b5-DiskSpaceUtilization_volume', 'Alarm-01010101-MAJORCPUAlarmELSMasters-01010101', 'Alarm-01010101-MAJORCPUAlarmELSNodes-HHAADDD', 'Alarm-01010101-MAJORMemoryAlarmELSMasters-KCOAV57MFCI4', 'Alarm-01010101-MAJORMemoryAlarmELSNodes-GUVOV6TSI259', 'Alarm-01010101-data-i-01010101-DiskSpaceUtilization_root', 'Alarm-01010101-data-i-01010101-DiskSpaceUtilization_volume', 'Alarm-01010101-data-i-01010101-DiskSpaceUtilization_root', 'Alarm-01010101-data-i-01010101-DiskSpaceUtilization_volume', 'Alarm-01010101-master-i-01010101-DiskSpaceUtilization_root', 'Alarm-01010101-master-i-01010101-DiskSpaceUtilization_volume']

Now i'm trying this code but i got error:

disable_response = client.disable_alarm_actions(names)

    "%s() only accepts keyword arguments." % py_operation_name)
TypeError: disable_alarm_actions() only accepts keyword arguments.

Upvotes: 0

Views: 654

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269480

The only accepts keyword arguments error says that you need to name all your inputs, rather than just relying on position.

Try:

disable_response = client.disable_alarm_actions(AlarmNames=names)

Upvotes: 1

Related Questions