-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get-CWAlarm issue with CompositeAlarm #206
Comments
The below C# code utilizing using System.Collections.Generic;
using Amazon.CloudWatch;
using Amazon.CloudWatch.Model;
namespace CloudWatchAlarmListTest
{
class Program
{
static void Main(string[] args)
{
AmazonCloudWatchClient amazonCloudWatchClient = new AmazonCloudWatchClient();
var result = amazonCloudWatchClient.DescribeAlarmsAsync(new DescribeAlarmsRequest() {
AlarmTypes = new List<string>() { "CompositeAlarm", "MetricAlarm" } }
).Result;
}
}
} Not sure if PowerShell is considering both |
Findings: (for Get-CWAlarm-Cmdlet)
Hence, CompositeAlarms returned by service are never returned in output. Possible Solution public System.Func<Amazon.CloudWatch.Model.DescribeAlarmsResponse, GetCWAlarmCmdlet, object> Select { get; set; } =
(response, cmdlet) =>
{
List<object> alarms = new List<object>();
if (response.CompositeAlarms != null && response.CompositeAlarms.Count > 0) alarms.AddRange(response.CompositeAlarms);
if (response.MetricAlarms != null && response.MetricAlarms.Count > 0) alarms.AddRange(response.MetricAlarms);
return alarms;
}; |
Hi @zewar96, Good afternoon. Please try using the Get-CWAlarm -AlarmType @('MetricAlarm', 'CompositeAlarm') -Select 'CompositeAlarms' OR Get-CWAlarm -AlarmType 'CompositeAlarm' -Select 'CompositeAlarms' In case you need to select both Get-CWAlarm -AlarmType @('MetricAlarm', 'CompositeAlarm') -Select '*' This would return an object with Hope this helps. Thanks, |
@ashishdhingra This will work fine until the code is corrected. Thanks for the work around! |
We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue. |
No close. |
In monitoring.xml service model config, DescribeAlarms is configured with To implement this breaking change:
|
Description
When running Get-CWAlarm -AlarmType "CompositeAlarm" I expect to receive all composite alarms created within my account. This actually returns no information from the call. However, when running the same command in the CLI it returns the 2 alarms
Reproduction Steps
Using version 4.1.9
Make sure you have at least 1 composite alarm setup in your account
Run:
Get-CWAlarm -AlarmType "CompositeAlarm"
I get no results. However, If i run:
aws cloudwatch describe-alarms --alarm-types "CompositeAlarm"
I get the 2 composite alarms i have setup
Running the powershell command with -AlarmType "MetricAlarm" returns all individual alarms without issue
Logs
I have enabled logging and was able to see the repsonse is actually returning the information in the repsonse (at least the first 1024 bytes), but for some reason the function doesn't return anything
Environment
Resolution
This is a 🐛 bug-report
The text was updated successfully, but these errors were encountered: