存取 Azure IoT Edge 中的內建計量
適用於: IoT Edge 1.4
重要
支援的版本是 IoT Edge 1.4。 如果您是舊版,請參閱更新 IoT Edge。
IoT Edge 運行時間元件、IoT Edge 中樞和 IoT Edge 代理程式會以 Prometheus 說明格式產生內建計量。 從遠端存取這些計量,即可監視及了解 IoT Edge 裝置的健康情況。
您可以使用自己的解決方案來存取這些計量。 或者,您可以使用 metrics-collector 模組,其會處理收集內建計量,並將其傳送至 Azure 監視器或 Azure IoT 中樞。 如需詳細資訊,請參閱 收集及傳輸計量。
計量預設會在edgeHub和edgeAgent模組的埠 9600 上自動公開 。http://edgeHub:9600/metrics
http://edgeAgent:9600/metrics
它們預設不會對應至主機。
透過從模組 的 createOptions
公開和對應計量埠,從主機存取計量。 下列範例會將預設計量埠對應至主機上的埠 9601:
{
"ExposedPorts": {
"9600/tcp": {}
},
"HostConfig": {
"PortBindings": {
"9600/tcp": [
{
"HostPort": "9601"
}
]
}
}
}
如果您要對應edgeHub和edgeAgent的計量端點,請選擇不同的和唯一主機埠號碼。
可用的計量
計量包含標籤,可協助識別所收集計量的性質。 所有計量都包含下列標記:
標記 | 描述 |
---|---|
iothub | 裝置正在交談的中樞 |
edge_device | 目前裝置的標識碼 |
instance_number | 代表目前運行時間的 GUID。 重新啟動時,所有計量都會重設。 此 GUID 可讓您更輕鬆地協調重新啟動。 |
在 Prometheus 說明格式中,有四種核心計量類型:計數器、量測計、直方圖和摘要。 如需不同計量類型的詳細資訊,請參閱 Prometheus 計量類型檔。
針對內建直方圖和摘要計量提供的分位數為 0.1、0.5、0.9 和 0.99。
edgeHub 模組會產生下列計量:
名稱 | 維度 | 描述 |
---|---|---|
edgehub_gettwin_total |
source (作業來源)id (模組識別碼) |
類型:計數器 GetTwin 呼叫總數 |
edgehub_messages_received_total |
route_output (傳送訊息的輸出)id |
類型:計數器 從用戶端接收的訊息總數 |
edgehub_messages_sent_total |
from (消息來源)to (訊息目的地)from_route_output to_route_input (訊息目的地輸入)priority (訊息優先順序至目的地) |
類型:計數器 傳送至用戶端或上游的訊息總數 to_route_input 當 為 $upstream 時 to 為空白 |
edgehub_reported_properties_total |
target (更新目標)id |
類型:計數器 報告的屬性更新呼叫總數 |
edgehub_message_size_bytes |
id |
類型:摘要 來自客戶端的訊息大小 值可能會回報為 NaN 一段特定時間(目前為10分鐘):針對 summary 類型,會發出對應的 _count 和 _sum 計數器。 |
edgehub_gettwin_duration_seconds |
source id |
類型:摘要 取得對應項作業所花費的時間 |
edgehub_message_send_duration_seconds |
from to from_route_output to_route_input |
類型:摘要 傳送訊息所花費的時間 |
edgehub_message_process_duration_seconds |
from to priority |
類型:摘要 處理佇列訊息所花費的時間 |
edgehub_reported_properties_update_duration_seconds |
target id |
類型:摘要 更新報告屬性所花費的時間 |
edgehub_direct_method_duration_seconds |
from (來電者)to (接收者) |
類型:摘要 解析直接訊息所花費的時間 |
edgehub_direct_methods_total |
from to |
類型:計數器 已傳送的直接訊息總數 |
edgehub_queue_length |
endpoint (消息來源)priority (佇列優先權) |
類型:量測計 edgeHub 佇列的目前長度,用於指定優先順序 |
edgehub_messages_dropped_total |
reason (no_route,ttl_expiry)from from_route_output |
類型:計數器 因為原因而移除的訊息總數 |
edgehub_messages_unack_total |
reason (storage_failure)from from_route_output |
類型:計數器 因記憶體失敗而未確認的訊息總數 |
edgehub_offline_count_total |
id |
類型:計數器 edgeHub 離線的總次數 |
edgehub_offline_duration_seconds |
id |
類型:摘要 時間邊緣中樞已離線 |
edgehub_operation_retry_total |
id operation (工作名稱) |
類型:計數器 重試edgeHub作業的總次數 |
edgehub_client_connect_failed_total |
id reason ( 未通過驗證 ) |
類型:計數器 客戶端無法連線到edgeHub的總次數 |
edgeAgent 模組會產生下列計量:
名稱 | 維度 | 描述 |
---|---|---|
edgeAgent_total_time_running_correctly_seconds |
module_name |
類型:量測計 模組在部署中指定的時間量,且處於執行中狀態 |
edgeAgent_total_time_expected_running_seconds |
module_name |
類型:量測計 部署中指定模組的時間量 |
edgeAgent_module_start_total |
module_name , module_version |
類型:計數器 edgeAgent 要求 docker 啟動模組的次數 |
edgeAgent_module_stop_total |
module_name , module_version |
類型:計數器 edgeAgent 要求 docker 停止模組的次數 |
edgeAgent_command_latency_seconds |
command |
類型:量測計 Docker 執行指定命令所花費的時間長度。 可能的命令包括:建立、更新、移除、啟動、停止和重新啟動 |
edgeAgent_iothub_syncs_total |
類型:計數器 edgeAgent 嘗試將其對應項與 iotHub 同步的次數,無論是成功還是失敗。 此號碼同時包含要求對應項和中樞通知對應項更新的代理程式 |
|
edgeAgent_unsuccessful_iothub_syncs_total |
類型:計數器 edgeAgent 無法將其對應項與 iotHub 同步的次數。 |
|
edgeAgent_deployment_time_seconds |
類型:計數器 收到變更之後完成新部署所花費的時間量。 |
|
edgeagent_direct_method_invocations_count |
method_name |
類型:計數器 呼叫內建 edgeAgent 直接方法的次數,例如 Ping 或 Restart。 |
edgeAgent_host_uptime_seconds |
類型:量測計 主機已開啟多久 |
|
edgeAgent_iotedged_uptime_seconds |
類型:量測計 Iotedged 已執行多久 |
|
edgeAgent_available_disk_space_bytes |
disk_name 、 、 disk_filesystem disk_filetype |
類型:量測計 磁碟上剩餘的空間量 |
edgeAgent_total_disk_space_bytes |
disk_name 、 、 disk_filesystem disk_filetype |
類型:量測計 磁碟大小 |
edgeAgent_used_memory_bytes |
module_name |
類型:量測計 所有進程所使用的 RAM 數量 |
edgeAgent_total_memory_bytes |
module_name |
類型:量測計 可用的 RAM |
edgeAgent_used_cpu_percent |
module_name |
類型:直方圖 所有進程所使用的CPU百分比 |
edgeAgent_created_pids_total |
module_name |
類型:量測計 容器已建立的進程或線程數目 |
edgeAgent_total_network_in_bytes |
module_name |
類型:量測計 從網路接收的位元組數目 |
edgeAgent_total_network_out_bytes |
module_name |
類型:量測計 傳送至網路的位元組數目 |
edgeAgent_total_disk_read_bytes |
module_name |
類型:量測計 從磁碟讀取的位元組數目 |
edgeAgent_total_disk_write_bytes |
module_name |
類型:量測計 寫入磁碟的位元組數目 |
edgeAgent_metadata |
edge_agent_version 、 、 experimental_features host_information |
類型:量測計 裝置的相關一般元數據。 值一律為 0,資訊會在標記中編碼。 請注意 experimental_features 和 host_information 是 json 物件。 host_information 看起來像 {"OperatingSystemType": "linux", "Architecture": "x86_64", "Version": "1.2.7", "Provisioning": {"Type": "dps.tpm", "DynamicReprovisioning": false, "AlwaysReprovisionOnStartup": false}, "ServerVersion": "20.10.11+azure-3", "KernelVersion": "5.11.0-1027-azure", "OperatingSystem": "Ubuntu 20.04.4 LTS", "NumCpus": 2, "Virtualized": "yes"} 。 注意 ServerVersion 是 Docker 版本,而 Version 是 IoT Edge 安全性精靈版本。 |