Skip to content
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

Add CLI Examples for Application Insights #9006

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions awscli/examples/application-insights/add-workload.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
**To add a workload to a component**

This example uses the ``add-workload`` command to add a workload to a component. ::

aws application-insights add-workload \
--resource-group-name "sqlserver" \
--component-name "arn:aws:ec2:us-east-1:123456789012:instance/i-012abcd34efghi56" \
--workload-configuration file://workload.json

Contents of ``workload.json``::

{
"WorkloadName": "SQL",
"Tier": "SQL_SERVER",
"Configuration": "{\"logs\":[{\"logGroupName\":\"SQL_SERVER-sqlserver\",\"logPath\":\"/var/log/mysql\",\"logType\":\"MYSQL\",\"monitor\":true,\"encoding\":\"utf-16\"}]}"
}

Output::

{
"WorkloadId": "w-0123fb74-fb3b-4dc8-b6cc-aab404a1234",
"WorkloadConfiguration": {
"WorkloadName": "SQL",
"Tier": "SQL_SERVER",
"Configuration": "{\"logs\":[{\"logGroupName\":\"SQL_SERVER-sqlserver\",\"logPath\":\"/var/log/mysql\",\"logType\":\"MYSQL\",\"monitor\":true,\"encoding\":\"utf-16\"}]}"
}
}
22 changes: 22 additions & 0 deletions awscli/examples/application-insights/create-application.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
**To create an application from a resource group**

This example uses the ``create-application command`` to create an application from a resource group. ::

aws application-insights create-application \
--resource-group-name myapp

Output::

{
"ApplicationInfo": {
"AccountId": "123456789012",
"ResourceGroupName": "myapp",
"LifeCycle": "CREATING",
"OpsCenterEnabled": false,
"CWEMonitorEnabled": false,
"Remarks": "",
"AutoConfigEnabled": false,
"DiscoveryType": "RESOURCE_GROUP_BASED",
"AttachMissingPermission": false
}
}
10 changes: 10 additions & 0 deletions awscli/examples/application-insights/create-component.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
**To create a component for an application**

This example uses the ``create-component command`` to create a component by grouping similar standalone instances to monitor.

aws application-insights create-component \
--resource-group-name MYEC2 \
--component-name mycustomcomp \
--resource-list arn:aws:ec2:eu-west-1:123456789012:instance/i-0f6bcd63ce2f03f

This command returns to the prompt if successful
22 changes: 22 additions & 0 deletions awscli/examples/application-insights/create-log-pattern.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
**To create a log pattern and add it to a log pattern set**

This example uses the ``create-log-pattern`` command to add an log pattern to a log pattern set. ::

aws application-insights create-log-pattern \
--resource-group-name MYEC2 \
--pattern-set-name SAMPLE \
--pattern-name new
--pattern error
--rank 750000

Output::

{
"LogPattern": {
"PatternSetName": "SAMPLE",
"PatternName": "new",
"Pattern": "error",
"Rank": 750000
},
"ResourceGroupName": "MYEC2"
}
8 changes: 8 additions & 0 deletions awscli/examples/application-insights/delete-application.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**To delete an application**

This example uses the ``delete-application`` command to remove the specified application from monitoring. ::

aws application-insights delete-application \
--resource-group-name sqlnew

This command returns to the prompt if successful.
9 changes: 9 additions & 0 deletions awscli/examples/application-insights/delete-component.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
**To delete a component from an application**

This example uses the ``delete-component`` command to ungroup a component from an application. ::

aws application-insights delete-component \
--resource-group-name MYEC2 \
--component-name custom_new

This command returns to the prompt if successful.
10 changes: 10 additions & 0 deletions awscli/examples/application-insights/delete-log-pattern.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
**To delete a log pattern from a log pattern set**

This example uses the ``delete-log-pattern`` command to remove a log pattern from a log pattern set. ::

aws application-insights delete-log-pattern \
--resource-group-name MYEC2 \
--pattern-set-name MYTEST \
--pattern-name MYPATTERN

This command returns to the prompt if successful.
22 changes: 22 additions & 0 deletions awscli/examples/application-insights/describe-application.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
**To describe an application**

This example uses the ``describe-application`` command to describe an application. ::

aws application-insights describe-application \
--resource-group-name MYEC2

Output::

{
"ApplicationInfo": {
"AccountId": "123456789012",
"ResourceGroupName": "MYEC2",
"LifeCycle": "ACTIVE",
"OpsCenterEnabled": false,
"CWEMonitorEnabled": true,
"Remarks": "Monitoring application, detected 1 unconfigured component",
"AutoConfigEnabled": true,
"DiscoveryType": "RESOURCE_GROUP_BASED",
"AttachMissingPermission": true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
**To describe a recommendation for a component configuration**

The following example uses the ``describe-component-configuration-recommendation`` command to describe the recommended configuration for a component. ::

aws application-insights describe-component-configuration-recommendation \
--resource-group-name MYEC2 \
--component-name arn:aws:ec2:us-east-1:123456789012:instance/i-012abcd34efghi56 \
--tier DEFAULT

Output::

{
"ComponentConfiguration": "{\n \"alarmMetrics\" : [ {\n \"alarmMetricName\" : \"CPUUtilization\",\n \"monitor\" : true\n }, {\n \"alarmMetricName\" : \"StatusCheckFailed\",\n \"monitor\" : true\n }, {\n \"alarmMetricName\" : \"Processor % Processor Time\",\n \"monitor\" : true\n }, {\n \"alarmMetricName\" : \"Memory % Committed Bytes In Use\",\n \"monitor\" : true\n }, {\n \"alarmMetricName\" : \"LogicalDisk % Free Space\",\n \"monitor\" : true\n }, {\n \"alarmMetricName\" : \"Memory Available Mbytes\",\n \"monitor\" : true\n } ],\n \"logs\" : [ {\n \"logGroupName\" : \"APPLICATION-MYEC2\",\n \"logPath\" : \"\",\n \"logType\" : \"APPLICATION\",\n \"monitor\" : true,\n \"encoding\" : \"utf-8\"\n } ],\n \"windowsEvents\" : [ {\n \"logGroupName\" : \"WINDOWS_EVENTS-Application-MYEC2\",\n \"eventName\" : \"Application\",\n \"eventLevels\" : [ \"WARNING\", \"ERROR\", \"CRITICAL\" ],\n \"monitor\" : true\n }, {\n \"logGroupName\" : \"WINDOWS_EVENTS-System-MYEC2\",\n \"eventName\" : \"System\",\n \"eventLevels\" : [ \"WARNING\", \"ERROR\", \"CRITICAL\" ],\n \"monitor\" : true\n }, {\n \"logGroupName\" : \"WINDOWS_EVENTS-Security-MYEC2\",\n \"eventName\" : \"Security\",\n \"eventLevels\" : [ \"WARNING\", \"ERROR\", \"CRITICAL\" ],\n \"monitor\" : true\n } ],\n \"subComponents\" : [ {\n \"subComponentType\" : \"AWS::EC2::Volume\",\n \"alarmMetrics\" : [ {\n \"alarmMetricName\" : \"BurstBalance\",\n \"monitor\" : true\n } ]\n } ]\n}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
**To describe the configuration for a component**

This example uses the ``describe-component-configuration`` command to describe the configuration of the component. Note: The component name is the ARN of the component and not the resource's name. ::

aws application-insights describe-component-configuration \
--resource-group-name MYEC2 \
--component-name arn:aws:ec2:us-east-1:123456789012:instance/i-012abcd34efghi56

Output::

{
"Monitor": true,
"Tier": "DEFAULT",
"ComponentConfiguration": "{\n \"alarmMetrics\" : [ {\n \"alarmMetricName\" : \"CPUUtilization\",\n \"monitor\" : true\n } ],\n \"logs\" : [ ]\n}"
}
25 changes: 25 additions & 0 deletions awscli/examples/application-insights/describe-component.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**To describe a component and its resources in an application**

This example uses the ``describe-component`` command to describe a component and lists the resources that are grouped together in a component. Note: The component name is the ARN of the component and not the resource's name. ::

aws application-insights describe-component \
--resource-group-name MYEC2 \
--component-name arn:aws:autoscaling:eu-west-1:123456789012:autoScalingGroup:abcd123e-853e-4b67-132a-bcd63ce2f03f:autoScalingGroupName/MyEC2ASG

Output::

{
"ApplicationComponent": {
"ComponentName": "arn:aws:autoscaling:eu-west-1:123456789012:autoScalingGroup:abcd123e-853e-4b67-132a-bcd63ce2f03f:autoScalingGroupName/MyEC2ASG",
"ResourceType": "AWS::AutoScaling::AutoScalingGroup",
"OsType": "LINUX",
"Tier": "DEFAULT",
"Monitor": true,
"DetectedWorkload": {
"DEFAULT": {
"Priority": "1"
}
}
},
"ResourceList": []
}
21 changes: 21 additions & 0 deletions awscli/examples/application-insights/describe-log-pattern.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
**To describe a log pattern from a log pattern set**

This example uses the ``describe-log-pattern`` command to describe a log pattern from a log pattern set. ::

aws application-insights describe-log-pattern \
--resource-group-name MYEC2 \
--pattern-set-name SAMPLE \
--pattern-name new2

Output::

{
"ResourceGroupName": "MYEC2",
"AccountId": "123456789012",
"LogPattern": {
"PatternSetName": "SAMPLE",
"PatternName": "new2",
"Pattern": "error",
"Rank": 750000
}
}
21 changes: 21 additions & 0 deletions awscli/examples/application-insights/describe-observation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
**To describe an observation from an application**

This example uses the ``describe-observation`` command to describe an observation such as an anomaly or error in the application. ::

aws application-insights describe-observation \
--observation-id o-1aaaf123-abc4-5678-a12e-d01234e56d7e

Output::

{
"Observation": {
"Id": "o-1aaaf123-abc4-5678-a12e-d01234e56d7e",
"StartTime": "2024-01-01T02:05:55.432000+00:00",
"EndTime": "2024-01-01T02:12:55.435000+00:00",
"SourceType": "ALARM",
"SourceARN": "arn:aws:ec2:us-east-1:123456789012:instance/i-012abcd34efghi56",
"MetricNamespace": "AWS/EC2",
"MetricName": "CPUUtilization",
"Value": 99.0208333333334
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**To describe obervations reported for a problem in an application**

This example uses the ``describe-problem-observations`` command to describe the observations found such as anomalies or errors associated with a problem within an application. ::

aws application-insights describe-problem-observations \
--problem-id p-1aaaf123-abc4-5678-a12e-d01234e56d7e

Output::

{
"RelatedObservations": {
"ObservationList": [{
"Id": "o-1aaaf123-abc4-5678-a12e-d01234e56d7e",
"StartTime": "2024-01-01T02:05:55.432000+00:00",
"EndTime": "2024-01-01T02:12:55.435000+00:00",
"SourceType": "ALARM",
"SourceARN": "arn:aws:ec2:us-east-1:123456789012:instance/i-012abcd34efghi56",
"MetricNamespace": "AWS/EC2",
"MetricName": "CPUUtilization",
"Value": 99.0208333333334
}]
}
}
29 changes: 29 additions & 0 deletions awscli/examples/application-insights/describe-problem.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
**To describe a problem in an application**

This example uses the ``describe-problem`` command to describe a problem reported in an application. ::

aws application-insights describe-problem \
--problem-id p-1aaaf123-abc4-5678-a12e-d01234e56d7e

Output::

{
"Problem": {
"Id": "p-1aaaf123-abc4-5678-a12e-d01234e56d7e",
"Title": "EC2: High CPU",
"Insights": "High CPU on the .NET application layer. This can result in application performance degradation due to high load on web servers, or application errors. If you experience high load conditions for long periods of time, use AWS Auto Scaling to add additional resources to process the load. To troubleshoot, collect a full user dump with task manager on the high CPU process and collect PerfMon logs with the thread counter to identify the thread ID causing high CPU.",
"Status": "PENDING",
"AffectedResource": "arn:aws:ec2:us-east-1:123456789012:instance/i-012abcd34efghi56",
"StartTime": "2024-01-01T02:05:55.432000+00:00",
"EndTime": "1970-01-01T00:00:00+00:00",
"SeverityLevel": "Medium",
"AccountId": "123456789012",
"ResourceGroupName": "MYEC2",
"Feedback": {
"INSIGHTS_FEEDBACK": "NOT_SPECIFIED"
},
"RecurringCount": 0,
"Visibility": "VISIBLE",
"ResolutionMethod": "UNRESOLVED"
}
}
19 changes: 19 additions & 0 deletions awscli/examples/application-insights/describe-workload.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
**To describe a workload in an application**

This example uses the ``describe-workload`` command to describe a workload and its configuration from an application. ::

aws application-insights describe-workload \
--resource-group-name MYEC2 \
--component-name arn:aws:ec2:us-east-1:123456789012:instance/i-012abcd34efghi56 \
--workload-id w-2aaaf123-abc4-5678-a12e-d01234e56d7e

Output::

{
"WorkloadId": "w-2aaaf123-abc4-5678-a12e-d01234e56d7e",
"WorkloadConfiguration": {
"WorkloadName": "MYSQL",
"Tier": "MYSQL",
"Configuration": "{\"logs\":[],\"windowsEvents\":[{\"logGroupName\":\"WINDOWS_EVENTS-Application-MYEC2\",\"eventName\":\"Application\",\"eventLevels\":[\"WARNING\",\"ERROR\",\"CRITICAL\"],\"monitor\":true},{\"logGroupName\":\"WINDOWS_EVENTS-System-MYEC2\",\"eventName\":\"System\",\"eventLevels\":[\"WARNING\",\"ERROR\",\"CRITICAL\"],\"monitor\":true},{\"logGroupName\":\"WINDOWS_EVENTS-Security-MYEC2\",\"eventName\":\"Security\",\"eventLevels\":[\"WARNING\",\"ERROR\",\"CRITICAL\"],\"monitor\":true}]}"
}
}
21 changes: 21 additions & 0 deletions awscli/examples/application-insights/list-applications.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
**To list all applications**

This example uses the ``list-applications`` command to lists the applications that you are monitoring. ::

aws application-insights list-applications

Output::

{
"ApplicationInfoList": [{
"AccountId": "123456789012",
"ResourceGroupName": "MYEC2",
"LifeCycle": "ACTIVE",
"OpsCenterEnabled": false,
"CWEMonitorEnabled": true,
"Remarks": "",
"AutoConfigEnabled": true,
"DiscoveryType": "RESOURCE_GROUP_BASED",
"AttachMissingPermission": true
}]
}
24 changes: 24 additions & 0 deletions awscli/examples/application-insights/list-components.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
**To list all components in an application**

This example uses the ``list-components`` command to list all the components in an application. ::

aws application-insights list-components \
--resource-group-name MYEC2

Output::

{
"ApplicationComponentList": [{
"ComponentName": "arn:aws:ec2:us-east-1:123456789012:autoScalingGroup:bosy123f-853e-2b43-876c-bad63ce2f03f:autoScalingGroupName/MyEC2ASG",
"ResourceType": "AWS::AutoScaling::AutoScalingGroup",
"OsType": "LINUX",
"Tier": "DEFAULT",
"Monitor": true
}, {
"ComponentName": "arn:aws:ec2:us-east-1:123456789012:instance/i-012abcd34efghi56",
"ResourceType": "AWS::EC2::Instance",
"OsType": "WINDOWS",
"Tier": "DEFAULT",
"Monitor": true
}]
}
Loading