Kueri sampel Metrics Insights - Amazon CloudWatch

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Kueri sampel Metrics Insights

Bagian ini berisi contoh kueri Wawasan CloudWatch Metrik yang berguna yang dapat Anda salin dan gunakan secara langsung atau salin dan modifikasi di editor kueri. Beberapa contoh ini sudah tersedia di konsol, dan Anda dapat mengaksesnya dengan memilih Tambahkan kueri di tampilan Metrik.

Contoh Penyeimbang Beban Aplikasi

Total permintaan di semua penyeimbang beban

SELECT SUM(RequestCount) FROM SCHEMA("AWS/ApplicationELB", LoadBalancer)

10 teratas penyeimbang beban paling aktif

SELECT MAX(ActiveConnectionCount) FROM SCHEMA("AWS/ApplicationELB", LoadBalancer) GROUP BY LoadBalancer ORDER BY SUM() DESC LIMIT 10

AWS APIcontoh penggunaan

Top 20 AWS APIs dengan jumlah panggilan di akun Anda

SELECT COUNT(CallCount) FROM SCHEMA("AWS/Usage", Class, Resource, Service, Type) WHERE Type = 'API' GROUP BY Service, Resource ORDER BY COUNT() DESC LIMIT 20

CloudWatch APIsdiurutkan berdasarkan panggilan

SELECT COUNT(CallCount) FROM SCHEMA("AWS/Usage", Class, Resource, Service, Type) WHERE Type = 'API' AND Service = 'CloudWatch' GROUP BY Resource ORDER BY COUNT() DESC

Contoh DynamoDB

10 teratas tabel dengan bacaan yang dikonsumsi

SELECT SUM(ProvisionedWriteCapacityUnits) FROM SCHEMA("AWS/DynamoDB", TableName) GROUP BY TableName ORDER BY MAX() DESC LIMIT 10

10 teratas tabel dengan byte yang dikembalikan

SELECT SUM(ReturnedBytes) FROM SCHEMA("AWS/DynamoDB", TableName) GROUP BY TableName ORDER BY MAX() DESC LIMIT 10

10 teratas tabel berdasarkan kesalahan pengguna

SELECT SUM(UserErrors) FROM SCHEMA("AWS/DynamoDB", TableName) GROUP BY TableName ORDER BY MAX() DESC LIMIT 10

Contoh Amazon Elastic Block Store

10 EBS volume Amazon teratas berdasarkan byte yang ditulis

SELECT SUM(VolumeWriteBytes) FROM SCHEMA("AWS/EBS", VolumeId) GROUP BY VolumeId ORDER BY SUM() DESC LIMIT 10

Rata-rata waktu tulis EBS volume Amazon

SELECT AVG(VolumeTotalWriteTime) FROM SCHEMA("AWS/EBS", VolumeId)

EC2Contoh Amazon

CPUpemanfaatan EC2 instance yang diurutkan berdasarkan tertinggi

SELECT AVG(CPUUtilization) FROM SCHEMA("AWS/EC2", InstanceId) GROUP BY InstanceId ORDER BY AVG() DESC

CPUPemanfaatan rata-rata di seluruh armada

SELECT AVG(CPUUtilization) FROM SCHEMA("AWS/EC2", InstanceId)

10 contoh teratas dengan pemanfaatan tertinggi CPU

SELECT MAX(CPUUtilization) FROM SCHEMA("AWS/EC2", InstanceId) GROUP BY InstanceId ORDER BY MAX() DESC LIMIT 10

Dalam hal ini, CloudWatch agen mengumpulkan CPUUtilization metrik per aplikasi. Kueri ini menyaring rata-rata metrik ini untuk nama aplikasi tertentu.

SELECT AVG(CPUUtilization) FROM "AWS/CWAgent" WHERE ApplicationName = 'eCommerce'

Contoh Layanan Amazon Elastic Container

CPUPemanfaatan rata-rata di semua cluster ECS

SELECT AVG(CPUUtilization) FROM SCHEMA("AWS/ECS", ClusterName)

10 teratas klaster berdasarkan penggunaan memori

SELECT AVG(MemoryUtilization) FROM SCHEMA("AWS/ECS", ClusterName) GROUP BY ClusterName ORDER BY AVG() DESC LIMIT 10

10 layanan teratas dengan CPU pemanfaatan

SELECT AVG(CPUUtilization) FROM SCHEMA("AWS/ECS", ClusterName, ServiceName) GROUP BY ClusterName, ServiceName ORDER BY AVG() DESC LIMIT 10

10 teratas layanan dengan menjalankan tugas (Wawasan Kontainer)

SELECT AVG(RunningTaskCount) FROM SCHEMA("ECS/ContainerInsights", ClusterName, ServiceName) GROUP BY ClusterName, ServiceName ORDER BY AVG() DESC LIMIT 10

Contoh Amazon Elastic Kubernetes Service Container Insights

CPUPemanfaatan rata-rata di semua cluster EKS

SELECT AVG(pod_cpu_utilization) FROM SCHEMA("ContainerInsights", ClusterName)

10 cluster teratas berdasarkan pemanfaatan node CPU

SELECT AVG(node_cpu_utilization) FROM SCHEMA("ContainerInsights", ClusterName) GROUP BY ClusterName ORDER BY AVG() DESC LIMIT 10

10 teratas klaster berdasarkan penggunaan memori pod

SELECT AVG(pop_memory_utilization) FROM SCHEMA("ContainerInsights", ClusterName) GROUP BY ClusterName ORDER BY AVG() DESC LIMIT 10

10 node teratas dengan CPU pemanfaatan

SELECT AVG(node_cpu_utilization) FROM SCHEMA("ContainerInsights", ClusterName, NodeName) GROUP BY ClusterName, NodeName ORDER BY AVG() DESC LIMIT 10

10 teratas pod berdasarkan penggunaan memori

SELECT AVG(pod_memory_utilization) FROM SCHEMA("ContainerInsights", ClusterName, PodName) GROUP BY ClusterName, PodName ORDER BY AVG() DESC LIMIT 10

EventBridge contoh

10 teratas aturan berdasarkan invokasi

SELECT SUM(Invocations) FROM SCHEMA("AWS/Events", RuleName) GROUP BY RuleName ORDER BY MAX() DESC LIMIT 10

10 teratas aturan berdasarkan invokasi yang gagal

SELECT SUM(FailedInvocations) FROM SCHEMA("AWS/Events", RuleName) GROUP BY RuleName ORDER BY MAX() DESC LIMIT 10

10 teratas aturan berdasarkan aturan yang cocok

SELECT SUM(MatchedEvents) FROM SCHEMA("AWS/Events", RuleName) GROUP BY RuleName ORDER BY MAX() DESC LIMIT 10

Contoh Kinesis

10 teratas aliran berdasarkan byte yang ditulis

SELECT SUM("PutRecords.Bytes") FROM SCHEMA("AWS/Kinesis", StreamName) GROUP BY StreamName ORDER BY SUM() DESC LIMIT 10

10 teratas aliran berdasarkan item paling awal dalam aliran

SELECT MAX("GetRecords.IteratorAgeMilliseconds") FROM SCHEMA("AWS/Kinesis", StreamName) GROUP BY StreamName ORDER BY MAX() DESC LIMIT 10

Contoh Lambda

Fungsi Lambda yang diurutkan berdasarkan jumlah invokasi

SELECT SUM(Invocations) FROM SCHEMA("AWS/Lambda", FunctionName) GROUP BY FunctionName ORDER BY SUM() DESC

10 teratas Fungsi Lambda berdasarkan runtime terpanjang

SELECT AVG(Duration) FROM SCHEMA("AWS/Lambda", FunctionName) GROUP BY FunctionName ORDER BY MAX() DESC LIMIT 10

10 teratas Fungsi Lambda berdasarkan jumlah kesalahan

SELECT SUM(Errors) FROM SCHEMA("AWS/Lambda", FunctionName) GROUP BY FunctionName ORDER BY SUM() DESC LIMIT 10

CloudWatch Contoh log

10 teratas grup log berdasarkan peristiwa yang masuk

SELECT SUM(IncomingLogEvents) FROM SCHEMA("AWS/Logs", LogGroupName) GROUP BY LogGroupName ORDER BY SUM() DESC LIMIT 10

10 teratas grup log berdasarkan byte tertulis

SELECT SUM(IncomingBytes) FROM SCHEMA("AWS/Logs", LogGroupName) GROUP BY LogGroupName ORDER BY SUM() DESC LIMIT 10

RDSContoh Amazon

10 RDS instans Amazon teratas dengan pemanfaatan tertinggi CPU

SELECT MAX(CPUUtilization) FROM SCHEMA("AWS/RDS", DBInstanceIdentifier) GROUP BY DBInstanceIdentifier ORDER BY MAX() DESC LIMIT 10

10 RDS kluster Amazon teratas dengan menulis

SELECT SUM(WriteIOPS) FROM SCHEMA("AWS/RDS", DBClusterIdentifier) GROUP BY DBClusterIdentifier ORDER BY MAX() DESC LIMIT 10

Contoh Amazon Simple Storage Service

Latensi rata-rata berdasarkan bucket

SELECT AVG(TotalRequestLatency) FROM SCHEMA("AWS/S3", BucketName, FilterId) WHERE FilterId = 'EntireBucket' GROUP BY BucketName ORDER BY AVG() DESC

10 teratas bucket berdasarkan byte yang diunduh

SELECT SUM(BytesDownloaded) FROM SCHEMA("AWS/S3", BucketName, FilterId) WHERE FilterId = 'EntireBucket' GROUP BY BucketName ORDER BY SUM() DESC LIMIT 10

Contoh Amazon Simple Notification Service

Total pesan yang diterbitkan berdasarkan SNS topik

SELECT SUM(NumberOfMessagesPublished) FROM SCHEMA("AWS/SNS", TopicName)

10 teratas topik berdasarkan pesan yang diterbitkan

SELECT SUM(NumberOfMessagesPublished) FROM SCHEMA("AWS/SNS", TopicName) GROUP BY TopicName ORDER BY SUM() DESC LIMIT 10

10 teratas topik berdasarkan kegagalan pengiriman pesan

SELECT SUM(NumberOfNotificationsFailed) FROM SCHEMA("AWS/SNS", TopicName) GROUP BY TopicName ORDER BY SUM() DESC LIMIT 10

SQSContoh Amazon

10 antrian teratas berdasarkan jumlah pesan yang terlihat

SELECT AVG(ApproximateNumberOfMessagesVisible) FROM SCHEMA("AWS/SQS", QueueName) GROUP BY QueueName ORDER BY AVG() DESC LIMIT 10

10 teratas kueri paling aktif

SELECT SUM(NumberOfMessagesSent) FROM SCHEMA("AWS/SQS", QueueName) GROUP BY QueueName ORDER BY SUM() DESC LIMIT 10

10 teratas antrian berdasarkan umur pesan paling awal

SELECT AVG(ApproximateAgeOfOldestMessage) FROM SCHEMA("AWS/SQS", QueueName) GROUP BY QueueName ORDER BY AVG() DESC LIMIT 10