0
votes

I have ec2 instance running on amazon I want this ec2 instance to publish performance counter metrics to Cloud Watch

I can see some examples over the internet but the problem I face that metrics do not appear in cloud watch (tried on several different instances and different amazon accounts)

Can someone point me the minimum list of actions to achieve this goal? Or point me to the direction where I can find some logs about what is wrong?

And trying to send Performance counter data using Amazon SSM Agent and Ec2 Config

Update: I am trying to implement stuff described here https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/send_logs_to_cwl.html But can't make it work

{
    "IsEnabled" : true,
    "EngineConfiguration": {
        "PollInterval": "00:00:15",
        "Components": [
        {
            {
                "Id": "ApplicationEventLog",
                "FullName": "AWS.EC2.Windows.CloudWatch.EventLog.EventLogInputComponent,AWS.EC2.Windows.CloudWatch",
                "Parameters": {
                    "LogName": "Application",
                    "Levels": "1"
                }
            },
            {
                "Id": "SystemEventLog",
                "FullName": "AWS.EC2.Windows.CloudWatch.EventLog.EventLogInputComponent,AWS.EC2.Windows.CloudWatch",
                "Parameters": {
                    "LogName": "System",
                    "Levels": "7"
                }
            },
            {
                "Id": "SecurityEventLog",
                "FullName": "AWS.EC2.Windows.CloudWatch.EventLog.EventLogInputComponent,AWS.EC2.Windows.CloudWatch",
                "Parameters": {
                "LogName": "Security",
                "Levels": "7"
                }
            },
            {
                "Id": "ETW",
                "FullName": "AWS.EC2.Windows.CloudWatch.EventLog.EventLogInputComponent,AWS.EC2.Windows.CloudWatch",
                "Parameters": {
                    "LogName": "Microsoft-Windows-WinINet/Analytic",
                    "Levels": "7"
                }
            },
            {
                "Id": "IISLog",
                "FullName": "AWS.EC2.Windows.CloudWatch.IisLog.IisLogInputComponent,AWS.EC2.Windows.CloudWatch",
                "Parameters": {
                    "LogDirectoryPath": "C:\\inetpub\\logs\\LogFiles\\W3SVC1"
                }
            },
            {
                "Id": "CustomLogs",
                "FullName": "AWS.EC2.Windows.CloudWatch.CustomLog.CustomLogInputComponent,AWS.EC2.Windows.CloudWatch",
                "Parameters": {
                    "LogDirectoryPath": "C:\\CustomLogs\\",
                    "TimestampFormat": "MM/dd/yyyy HH:mm:ss",
                    "Encoding": "UTF-8",
                    "Filter": "",
                    "CultureName": "en-US",
                    "TimeZoneKind": "Local"
                }
            },
            {
                "Id": "PerformanceCounter",
                "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch",
                "Parameters": {
                    "CategoryName": "Memory",
                    "CounterName": "Available MBytes",
                    "InstanceName": "",
                    "MetricName": "Memory",
                    "Unit": "Megabytes",
                    "DimensionName": "",
                    "DimensionValue": ""
                }
            },
            {
                "Id": "CloudWatchLogs",
                "FullName": "AWS.EC2.Windows.CloudWatch.CloudWatchLogsOutput,AWS.EC2.Windows.CloudWatch",
                "Parameters": {
                    "AccessKey": "",
                    "SecretKey": "",
                    "Region": "eu-west-2",
                    "LogGroup": "Default-Log-Group",
                    "LogStream": "{instance_id}"
                }
            },
            {
                "Id": "CloudWatch",
                "FullName": "AWS.EC2.Windows.CloudWatch.CloudWatch.CloudWatchOutputComponent,AWS.EC2.Windows.CloudWatch",
                "Parameters": 
                {
                    "AccessKey": "",
                    "SecretKey": "",
                    "Region": "eu-west-2",
                    "NameSpace": "Windows/Default"
                }
            }
        ],
        "Flows": {
            "Flows": 
            [
                "(ApplicationEventLog,SystemEventLog,PerformanceCounter),CloudWatchLogs,CloudWatch"
            ]
        }
    } 
}

Attached my config file I am trying to find something called Memory or Available MBytes to make sure if it works

2
There's not enough information here to help. It's safe to assume that the directions work, and that you're missing some configuration that's needed. But you don't show any of your configuration, or even say which of the three approaches you're using. - kdgregory
In addition, the question is not about programming, but about system configuration, so belongs on serverfault - kdgregory
I added my config file please let me know if something else needed - Yuriy Gavriluk

2 Answers

0
votes

If I read your question correctly you would need to create a custom metric to which you would then publish your data points to, usually via the AWS API. After you have this you can use that metric in alarms and so on.

0
votes

Follow the steps described here. I followed them to be able to monitor the memory of my EC2 Instances and it worked perfectly.

Amazon CloudWatch Metrics and Dimensions Reference

The unified CloudWatch agent enables you to do the following:

Collect more system-level metrics from Amazon EC2 instances, including in-guest metrics, in addition to the metrics listed in Amazon EC2 Metrics and Dimensions. The additional metrics are listed in Metrics Collected by the CloudWatch Agent.

Collect system-level metrics from on-premises servers. These can include servers in a hybrid environment as well as servers not managed by AWS.

Collect logs from Amazon EC2 instances and on-premises servers, running either Linux or Windows Server.

Supported Operating Systems

The CloudWatch agent is supported on the following operating systems:

Amazon Linux version 2014.03.02 or later

Ubuntu Server version 16.04 and 14.04

CentOS version 7.0 and 6.5

Red Hat Enterprise Linux (RHEL) version 7.4, 7.0, and 6.5

Debian 8.0

64-bit versions of Windows Server 2016, Windows Server 2012, and Windows Server 2008.