Pilih preferensi cookie Anda

Kami menggunakan cookie penting serta alat serupa yang diperlukan untuk menyediakan situs dan layanan. Kami menggunakan cookie performa untuk mengumpulkan statistik anonim sehingga kami dapat memahami cara pelanggan menggunakan situs dan melakukan perbaikan. Cookie penting tidak dapat dinonaktifkan, tetapi Anda dapat mengklik “Kustom” atau “Tolak” untuk menolak cookie performa.

Jika Anda setuju, AWS dan pihak ketiga yang disetujui juga akan menggunakan cookie untuk menyediakan fitur situs yang berguna, mengingat preferensi Anda, dan menampilkan konten yang relevan, termasuk iklan yang relevan. Untuk menerima atau menolak semua cookie yang tidak penting, klik “Terima” atau “Tolak”. Untuk membuat pilihan yang lebih detail, klik “Kustomisasi”.

Contoh Application Discovery Service menggunakan AWS CLI

Mode fokus
Contoh Application Discovery Service menggunakan AWS CLI - AWS Command Line Interface

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

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

Contoh kode berikut menunjukkan cara melakukan tindakan dan mengimplementasikan skenario umum dengan menggunakan Application Discovery Service AWS Command Line Interface with.

Tindakan adalah kutipan kode dari program yang lebih besar dan harus dijalankan dalam konteks. Sementara tindakan menunjukkan cara memanggil fungsi layanan individual, Anda dapat melihat tindakan dalam konteks dalam skenario terkait.

Setiap contoh menyertakan tautan ke kode sumber lengkap, di mana Anda dapat menemukan instruksi tentang cara mengatur dan menjalankan kode dalam konteks.

Tindakan

Contoh kode berikut menunjukkan cara menggunakandescribe-agents.

AWS CLI

Jelaskan agen dengan status CollectionStatus tertentu

Perintah contoh ini menjelaskan agen koleksi dengan status koleksi “STARTED” atau “STOPTED”.

Perintah:

aws discovery describe-agents --filters name="collectionStatus",values="STARTED","STOPPED",condition="EQUALS" --max-results 3

Output:

{ "Snapshots": [ { "version": "1.0.40.0", "agentType": "EC2", "hostName": "ip-172-31-40-234", "collectionStatus": "STOPPED", "agentNetworkInfoList": [ { "macAddress": "06:b5:97:14:fc:0d", "ipAddress": "172.31.40.234" } ], "health": "UNKNOWN", "agentId": "i-003305c02a776e883", "registeredTime": "2016-12-09T19:05:06Z", "lastHealthPingTime": "2016-12-09T19:05:10Z" }, { "version": "1.0.40.0", "agentType": "EC2", "hostName": "ip-172-31-39-64", "collectionStatus": "STARTED", "agentNetworkInfoList": [ { "macAddress": "06:a1:0e:c7:b2:73", "ipAddress": "172.31.39.64" } ], "health": "SHUTDOWN", "agentId": "i-003a5e5e2b36cf8bd", "registeredTime": "2016-11-16T16:36:25Z", "lastHealthPingTime": "2016-11-16T16:47:37Z" } ] }
  • Untuk detail API, lihat DescribeAgentsdi Referensi AWS CLI Perintah.

Contoh kode berikut menunjukkan cara menggunakandescribe-agents.

AWS CLI

Jelaskan agen dengan status CollectionStatus tertentu

Perintah contoh ini menjelaskan agen koleksi dengan status koleksi “STARTED” atau “STOPTED”.

Perintah:

aws discovery describe-agents --filters name="collectionStatus",values="STARTED","STOPPED",condition="EQUALS" --max-results 3

Output:

{ "Snapshots": [ { "version": "1.0.40.0", "agentType": "EC2", "hostName": "ip-172-31-40-234", "collectionStatus": "STOPPED", "agentNetworkInfoList": [ { "macAddress": "06:b5:97:14:fc:0d", "ipAddress": "172.31.40.234" } ], "health": "UNKNOWN", "agentId": "i-003305c02a776e883", "registeredTime": "2016-12-09T19:05:06Z", "lastHealthPingTime": "2016-12-09T19:05:10Z" }, { "version": "1.0.40.0", "agentType": "EC2", "hostName": "ip-172-31-39-64", "collectionStatus": "STARTED", "agentNetworkInfoList": [ { "macAddress": "06:a1:0e:c7:b2:73", "ipAddress": "172.31.39.64" } ], "health": "SHUTDOWN", "agentId": "i-003a5e5e2b36cf8bd", "registeredTime": "2016-11-16T16:36:25Z", "lastHealthPingTime": "2016-11-16T16:47:37Z" } ] }
  • Untuk detail API, lihat DescribeAgentsdi Referensi AWS CLI Perintah.

Contoh kode berikut menunjukkan cara menggunakandescribe-configurations.

AWS CLI

Jelaskan konfigurasi aset yang dipilih

Perintah contoh ini menjelaskan konfigurasi dari dua server tertentu. Tindakan mendeteksi jenis aset dari ID konfigurasi. Hanya satu jenis aset yang diizinkan per perintah.

Perintah:

aws discovery describe-configurations --configuration-ids "d-server-099385097ef9fbcfb" "d-server-0c4f2dd1fee22c6c1"

Output:

{ "configurations": [ { "server.performance.maxCpuUsagePct": "0.0", "server.performance.maxDiskReadIOPS": "0.0", "server.performance.avgCpuUsagePct": "0.0", "server.type": "EC2", "server.performance.maxNetworkReadsPerSecondInKB": "0.19140625", "server.hostName": "ip-172-31-35-152", "server.configurationId": "d-server-0c4f2dd1fee22c6c1", "server.tags.hasMoreValues": "false", "server.performance.minFreeRAMInKB": "1543496.0", "server.osVersion": "3.14.48-33.39.amzn1.x86_64", "server.performance.maxDiskReadsPerSecondInKB": "0.0", "server.applications": "[]", "server.performance.numDisks": "1", "server.performance.numCpus": "1", "server.performance.numCores": "1", "server.performance.maxDiskWriteIOPS": "0.0", "server.performance.maxNetworkWritesPerSecondInKB": "0.82421875", "server.performance.avgDiskWritesPerSecondInKB": "0.0", "server.networkInterfaceInfo": "[{\"name\":\"eth0\",\"macAddress\":\"06:A7:7D:3F:54:57\",\"ipAddress\":\"172.31.35.152\",\"netMask\":\"255.255.240.0\"},{\"name\":\"lo\",\"macAddress\":\"00:00:00:00:00:00\",\"ipAddress\":\"127.0.0.1\",\"netMask\":\"255.0.0.0\"},{\"name\":\"eth0\",\"macAddress\":\"06:A7:7D:3F:54:57\",\"ipAddress\":\"fe80::4a7:7dff:fe3f:5457\"},{\"name\":\"lo\",\"macAddress\":\"00:00:00:00:00:00\",\"ipAddress\":\"::1\"}]", "server.performance.avgNetworkReadsPerSecondInKB": "0.04915364583333333", "server.tags": "[]", "server.applications.hasMoreValues": "false", "server.timeOfCreation": "2016-10-28 23:44:00.0", "server.agentId": "i-4447bc1b", "server.performance.maxDiskWritesPerSecondInKB": "0.0", "server.performance.avgDiskReadIOPS": "0.0", "server.performance.avgFreeRAMInKB": "1547210.1333333333", "server.performance.avgDiskReadsPerSecondInKB": "0.0", "server.performance.avgDiskWriteIOPS": "0.0", "server.performance.numNetworkCards": "2", "server.hypervisor": "xen", "server.networkInterfaceInfo.hasMoreValues": "false", "server.performance.avgNetworkWritesPerSecondInKB": "0.1380859375", "server.osName": "Linux - Amazon Linux AMI release 2015.03", "server.performance.totalRAMInKB": "1694732.0", "server.cpuType": "x64" }, { "server.performance.maxCpuUsagePct": "100.0", "server.performance.maxDiskReadIOPS": "0.0", "server.performance.avgCpuUsagePct": "14.733333333333338", "server.type": "EC2", "server.performance.maxNetworkReadsPerSecondInKB": "13.400390625", "server.hostName": "ip-172-31-42-208", "server.configurationId": "d-server-099385097ef9fbcfb", "server.tags.hasMoreValues": "false", "server.performance.minFreeRAMInKB": "1531104.0", "server.osVersion": "3.14.48-33.39.amzn1.x86_64", "server.performance.maxDiskReadsPerSecondInKB": "0.0", "server.applications": "[]", "server.performance.numDisks": "1", "server.performance.numCpus": "1", "server.performance.numCores": "1", "server.performance.maxDiskWriteIOPS": "1.0", "server.performance.maxNetworkWritesPerSecondInKB": "12.271484375", "server.performance.avgDiskWritesPerSecondInKB": "0.5333333333333334", "server.networkInterfaceInfo": "[{\"name\":\"eth0\",\"macAddress\":\"06:4A:79:60:75:61\",\"ipAddress\":\"172.31.42.208\",\"netMask\":\"255.255.240.0\"},{\"name\":\"eth0\",\"macAddress\":\"06:4A:79:60:75:61\",\"ipAddress\":\"fe80::44a:79ff:fe60:7561\"},{\"name\":\"lo\",\"macAddress\":\"00:00:00:00:00:00\",\"ipAddress\":\"::1\"},{\"name\":\"lo\",\"macAddress\":\"00:00:00:00:00:00\",\"ipAddress\":\"127.0.0.1\",\"netMask\":\"255.0.0.0\"}]", "server.performance.avgNetworkReadsPerSecondInKB": "2.8720052083333334", "server.tags": "[]", "server.applications.hasMoreValues": "false", "server.timeOfCreation": "2016-10-28 23:44:30.0", "server.agentId": "i-c142b99e", "server.performance.maxDiskWritesPerSecondInKB": "4.0", "server.performance.avgDiskReadIOPS": "0.0", "server.performance.avgFreeRAMInKB": "1534946.4", "server.performance.avgDiskReadsPerSecondInKB": "0.0", "server.performance.avgDiskWriteIOPS": "0.13333333333333336", "server.performance.numNetworkCards": "2", "server.hypervisor": "xen", "server.networkInterfaceInfo.hasMoreValues": "false", "server.performance.avgNetworkWritesPerSecondInKB": "1.7977864583333332", "server.osName": "Linux - Amazon Linux AMI release 2015.03", "server.performance.totalRAMInKB": "1694732.0", "server.cpuType": "x64" } ] }

Jelaskan konfigurasi aset yang dipilih

Perintah contoh ini menjelaskan konfigurasi dari dua aplikasi tertentu. Tindakan mendeteksi jenis aset dari ID konfigurasi. Hanya satu jenis aset yang diizinkan per perintah.

Perintah:

aws discovery describe-configurations --configuration-ids "d-application-0ac39bc0e4fad0e42" "d-application-02444a45288013764q"

Output:

{ "configurations": [ { "application.serverCount": "0", "application.name": "Application-12345", "application.lastModifiedTime": "2016-12-13 23:53:27.0", "application.description": "", "application.timeOfCreation": "2016-12-13 23:53:27.0", "application.configurationId": "d-application-0ac39bc0e4fad0e42" }, { "application.serverCount": "0", "application.name": "Application-67890", "application.lastModifiedTime": "2016-12-13 23:53:33.0", "application.description": "", "application.timeOfCreation": "2016-12-13 23:53:33.0", "application.configurationId": "d-application-02444a45288013764" } ] }

Contoh kode berikut menunjukkan cara menggunakandescribe-configurations.

AWS CLI

Jelaskan konfigurasi aset yang dipilih

Perintah contoh ini menjelaskan konfigurasi dari dua server tertentu. Tindakan mendeteksi jenis aset dari ID konfigurasi. Hanya satu jenis aset yang diizinkan per perintah.

Perintah:

aws discovery describe-configurations --configuration-ids "d-server-099385097ef9fbcfb" "d-server-0c4f2dd1fee22c6c1"

Output:

{ "configurations": [ { "server.performance.maxCpuUsagePct": "0.0", "server.performance.maxDiskReadIOPS": "0.0", "server.performance.avgCpuUsagePct": "0.0", "server.type": "EC2", "server.performance.maxNetworkReadsPerSecondInKB": "0.19140625", "server.hostName": "ip-172-31-35-152", "server.configurationId": "d-server-0c4f2dd1fee22c6c1", "server.tags.hasMoreValues": "false", "server.performance.minFreeRAMInKB": "1543496.0", "server.osVersion": "3.14.48-33.39.amzn1.x86_64", "server.performance.maxDiskReadsPerSecondInKB": "0.0", "server.applications": "[]", "server.performance.numDisks": "1", "server.performance.numCpus": "1", "server.performance.numCores": "1", "server.performance.maxDiskWriteIOPS": "0.0", "server.performance.maxNetworkWritesPerSecondInKB": "0.82421875", "server.performance.avgDiskWritesPerSecondInKB": "0.0", "server.networkInterfaceInfo": "[{\"name\":\"eth0\",\"macAddress\":\"06:A7:7D:3F:54:57\",\"ipAddress\":\"172.31.35.152\",\"netMask\":\"255.255.240.0\"},{\"name\":\"lo\",\"macAddress\":\"00:00:00:00:00:00\",\"ipAddress\":\"127.0.0.1\",\"netMask\":\"255.0.0.0\"},{\"name\":\"eth0\",\"macAddress\":\"06:A7:7D:3F:54:57\",\"ipAddress\":\"fe80::4a7:7dff:fe3f:5457\"},{\"name\":\"lo\",\"macAddress\":\"00:00:00:00:00:00\",\"ipAddress\":\"::1\"}]", "server.performance.avgNetworkReadsPerSecondInKB": "0.04915364583333333", "server.tags": "[]", "server.applications.hasMoreValues": "false", "server.timeOfCreation": "2016-10-28 23:44:00.0", "server.agentId": "i-4447bc1b", "server.performance.maxDiskWritesPerSecondInKB": "0.0", "server.performance.avgDiskReadIOPS": "0.0", "server.performance.avgFreeRAMInKB": "1547210.1333333333", "server.performance.avgDiskReadsPerSecondInKB": "0.0", "server.performance.avgDiskWriteIOPS": "0.0", "server.performance.numNetworkCards": "2", "server.hypervisor": "xen", "server.networkInterfaceInfo.hasMoreValues": "false", "server.performance.avgNetworkWritesPerSecondInKB": "0.1380859375", "server.osName": "Linux - Amazon Linux AMI release 2015.03", "server.performance.totalRAMInKB": "1694732.0", "server.cpuType": "x64" }, { "server.performance.maxCpuUsagePct": "100.0", "server.performance.maxDiskReadIOPS": "0.0", "server.performance.avgCpuUsagePct": "14.733333333333338", "server.type": "EC2", "server.performance.maxNetworkReadsPerSecondInKB": "13.400390625", "server.hostName": "ip-172-31-42-208", "server.configurationId": "d-server-099385097ef9fbcfb", "server.tags.hasMoreValues": "false", "server.performance.minFreeRAMInKB": "1531104.0", "server.osVersion": "3.14.48-33.39.amzn1.x86_64", "server.performance.maxDiskReadsPerSecondInKB": "0.0", "server.applications": "[]", "server.performance.numDisks": "1", "server.performance.numCpus": "1", "server.performance.numCores": "1", "server.performance.maxDiskWriteIOPS": "1.0", "server.performance.maxNetworkWritesPerSecondInKB": "12.271484375", "server.performance.avgDiskWritesPerSecondInKB": "0.5333333333333334", "server.networkInterfaceInfo": "[{\"name\":\"eth0\",\"macAddress\":\"06:4A:79:60:75:61\",\"ipAddress\":\"172.31.42.208\",\"netMask\":\"255.255.240.0\"},{\"name\":\"eth0\",\"macAddress\":\"06:4A:79:60:75:61\",\"ipAddress\":\"fe80::44a:79ff:fe60:7561\"},{\"name\":\"lo\",\"macAddress\":\"00:00:00:00:00:00\",\"ipAddress\":\"::1\"},{\"name\":\"lo\",\"macAddress\":\"00:00:00:00:00:00\",\"ipAddress\":\"127.0.0.1\",\"netMask\":\"255.0.0.0\"}]", "server.performance.avgNetworkReadsPerSecondInKB": "2.8720052083333334", "server.tags": "[]", "server.applications.hasMoreValues": "false", "server.timeOfCreation": "2016-10-28 23:44:30.0", "server.agentId": "i-c142b99e", "server.performance.maxDiskWritesPerSecondInKB": "4.0", "server.performance.avgDiskReadIOPS": "0.0", "server.performance.avgFreeRAMInKB": "1534946.4", "server.performance.avgDiskReadsPerSecondInKB": "0.0", "server.performance.avgDiskWriteIOPS": "0.13333333333333336", "server.performance.numNetworkCards": "2", "server.hypervisor": "xen", "server.networkInterfaceInfo.hasMoreValues": "false", "server.performance.avgNetworkWritesPerSecondInKB": "1.7977864583333332", "server.osName": "Linux - Amazon Linux AMI release 2015.03", "server.performance.totalRAMInKB": "1694732.0", "server.cpuType": "x64" } ] }

Jelaskan konfigurasi aset yang dipilih

Perintah contoh ini menjelaskan konfigurasi dari dua aplikasi tertentu. Tindakan mendeteksi jenis aset dari ID konfigurasi. Hanya satu jenis aset yang diizinkan per perintah.

Perintah:

aws discovery describe-configurations --configuration-ids "d-application-0ac39bc0e4fad0e42" "d-application-02444a45288013764q"

Output:

{ "configurations": [ { "application.serverCount": "0", "application.name": "Application-12345", "application.lastModifiedTime": "2016-12-13 23:53:27.0", "application.description": "", "application.timeOfCreation": "2016-12-13 23:53:27.0", "application.configurationId": "d-application-0ac39bc0e4fad0e42" }, { "application.serverCount": "0", "application.name": "Application-67890", "application.lastModifiedTime": "2016-12-13 23:53:33.0", "application.description": "", "application.timeOfCreation": "2016-12-13 23:53:33.0", "application.configurationId": "d-application-02444a45288013764" } ] }

Contoh kode berikut menunjukkan cara menggunakanlist-configurations.

AWS CLI

Untuk membuat daftar semua server yang ditemukan yang memenuhi satu set kondisi filter

Contoh perintah ini mencantumkan server yang ditemukan yang cocok dengan salah satu dari dua pola nama host dan tidak menjalankan Ubuntu.

Perintah:

aws discovery list-configurations --configuration-type SERVER --filters name="server.hostName",values="172-31-35","172-31-42",condition="CONTAINS" name="server.osName",values="Ubuntu",condition="NOT_CONTAINS"

Output:

{ "configurations": [ { "server.osVersion": "3.14.48-33.39.amzn1.x86_64", "server.type": "EC2", "server.hostName": "ip-172-31-42-208", "server.timeOfCreation": "2016-10-28 23:44:30.0", "server.configurationId": "d-server-099385097ef9fbcfb", "server.osName": "Linux - Amazon Linux AMI release 2015.03", "server.agentId": "i-c142b99e" }, { "server.osVersion": "3.14.48-33.39.amzn1.x86_64", "server.type": "EC2", "server.hostName": "ip-172-31-35-152", "server.timeOfCreation": "2016-10-28 23:44:00.0", "server.configurationId": "d-server-0c4f2dd1fee22c6c1", "server.osName": "Linux - Amazon Linux AMI release 2015.03", "server.agentId": "i-4447bc1b" } ] }

Contoh kode berikut menunjukkan cara menggunakanlist-configurations.

AWS CLI

Untuk membuat daftar semua server yang ditemukan yang memenuhi satu set kondisi filter

Contoh perintah ini mencantumkan server yang ditemukan yang cocok dengan salah satu dari dua pola nama host dan tidak menjalankan Ubuntu.

Perintah:

aws discovery list-configurations --configuration-type SERVER --filters name="server.hostName",values="172-31-35","172-31-42",condition="CONTAINS" name="server.osName",values="Ubuntu",condition="NOT_CONTAINS"

Output:

{ "configurations": [ { "server.osVersion": "3.14.48-33.39.amzn1.x86_64", "server.type": "EC2", "server.hostName": "ip-172-31-42-208", "server.timeOfCreation": "2016-10-28 23:44:30.0", "server.configurationId": "d-server-099385097ef9fbcfb", "server.osName": "Linux - Amazon Linux AMI release 2015.03", "server.agentId": "i-c142b99e" }, { "server.osVersion": "3.14.48-33.39.amzn1.x86_64", "server.type": "EC2", "server.hostName": "ip-172-31-35-152", "server.timeOfCreation": "2016-10-28 23:44:00.0", "server.configurationId": "d-server-0c4f2dd1fee22c6c1", "server.osName": "Linux - Amazon Linux AMI release 2015.03", "server.agentId": "i-4447bc1b" } ] }

Di halaman ini

PrivasiSyarat situsPreferensi cookie
© 2025, Amazon Web Services, Inc. atau afiliasinya. Semua hak dilindungi undang-undang.