SCG:如何從 API 收集 SCG 執行狀況
Summary: 如何從應用程式發展介面 (API) 查詢收集安全連線閘道 (SCG) 健全狀況狀態。此方法可用於分析所有 SCG 元件的狀態(連接狀態、保持連接狀態、所有服務的狀態、連接的設備系統資訊)。
This article applies to
This article does not apply to
This article is not tied to any specific product.
Not all product versions are identified in this article.
Instructions
這已在安全連線閘道版本 5.10.00.10 上測試。
以下是對 SCG 執行 API 查詢以收集所有健全狀況資訊所需的步驟:
- 在安全連線閘道中啟用 REST API 介面。
您必須在 SCG 中啟用 REST API 介面,才能與資料中心工具和應用程式整合。
若要啟用 API 介面,請在網頁瀏覽器 (https://<IP_SCG>:5700),轉到 “設置 > API 設置”,選中“為此網關 啟用 API 介面 ”複選框,然後按兩下 “應用”:
- 使用根使用者開啟至 SCG 閘道的 SSH 工作階段,並執行下列命令:
使用 SCG 閘道產生 Auth Token - 若要執行所有 API 查詢,必須先對 SCG 閘道查詢,才能取得授權權杖。在這種情況下,我們將獲取授權令牌並將其存儲在系統變數上,以方便接下來的 API 查詢:AUTH_TOKEN=`curl -k -s -L -i -X --header "Content-Type: application/json" --request POST --data '{"username":"admin","password":"admin_password"}' 'https://10.108.0.40:5700/SupportAssist/api/v2/auth/token?accessToken' | grep "accessToken" | awk -F ":" {'print $2'} | sed 's/,$//' | sed 's/^..//' | sed 's/.$//'`其中:- admin = SCG 的管理員使用者
- admin_password = SCG 的管理員密碼
- 10.108.0.40 = SCG 的 IP 位址
scg:~ # AUTH_TOKEN=`curl -k -s -L -i -X --header "Content-Type: application/json" --request POST --data '{"username":"admin","password":"admin_password"}' 'https://10.108.0.40:5700/SupportAssist/api/v2/auth/token?accessToken' | grep "accessToken" | awk -F ":" {'print $2'} | sed 's/,$//' | sed 's/^..//' | sed 's/.$//'` scg:~ # echo $AUTH_TOKEN eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwicm9sZSI6IlNDR0FkbWlucyIsInJlcXVlc3RpbmdJUCI6IjEwLjEwNy4wLjM5IiwiYXBwTW9kZSI6IkFQUExJQU5DRVMiLCJhcGlVc2FnZU1vZGUiOiJSZXN0IiwiaW5zdGFuY2VJRCI6ImJGMFhhdUk2MVI2REtZM3A5a0NKTHdVWlMwTGhPUjRNaVJydEhPTkgxamFxa2Zrb0xONDlGeXNraXB5ZVFjUmxsSlFyTFJQQkJtNlRZeGNTWGxleEJBPT0iLCJ0b2tlblR5cGUiOiJBQ0NFU1MiLCJ1dWlkIjoiZGFkYjYxY2EtNjNmZi00ODRlLWEwOGUtOTA0OGY0NzczYzJmIiwiaWF0IjoxNjQ4NzQzODk2LCJleHAiOjE2NDg3NDU2OTZ9.D2ziJJhc8dAyqiFIwXucluWLwsdKVSv1TqQAnt1b8KA - 執行 API 查詢以取得 SCG 執行狀況:
使用此 API 查詢,可以看到許多關於 SCG 的資訊:
- 連線
狀態 - 保持連線
狀態 - 每個 SCG 服務 (esrshttpd、esrshttpdR、esrsconnectemc、networkconnectivity 等)
的狀態 - 受監控裝置
的狀態 以下是用於收集執行狀況資訊狀態的 API 查詢:curl -k -X GET --header "Accept: application/json" --header "Authorization: Bearer $AUTH_TOKEN" https://10.108.0.40:5700/SupportAssist/api/v2/service/healthstatus?
範例:scg:~ # curl -k -X GET --header "Accept: application/json" --header "Authorization: Bearer $AUTH_TOKEN" https://10.108.0.40:5700/SupportAssist/api/v2/service/healthstatus? { "data" : { "runDate" : "Mar 31, 2022 12:03:57 -EDT", "gatewayInfo" : { "serialNumber" : "XXXXXXXXXX", "productModel" : "SECURECONNECTGATEWAY-APPLIANCE", "ipAddress" : "10.108.0.40", "gatewayVersion" : "5.00.07.10" }, "connectivity" : { "mqttStatus" : { "state" : "CONNECTED", "updatedAt" : "2022-03-28T20:58:38.244+00:00", "recommendation" : "" }, "keepaliveStatus" : { "state" : "CONNECTED", "updatedAt" : "2021-11-22T04:27:05.198+0000", "recommendation" : "" } }, "services" : [ { "serviceName" : "esrshttpd", "criticality" : "Critical", "serviceType" : "Core service status", "description" : "Service to securely transfer files between your devices and secure connect gateway", "status" : "Running", "recommendation" : "" }, { "serviceName" : "esrshttpdR", "criticality" : "Critical", "serviceType" : "Core service status", "description" : "A service that manages file transfers from your gateway to Dell Technologies, or to your devices", "status" : "Running", "recommendation" : "" }, { "serviceName" : "esrsconnectemc", "criticality" : "Critical", "serviceType" : "Core service status", "description" : "A service at Dell Technologies that receives alert data from your devices", "status" : "Running", "recommendation" : "" }, { "serviceName" : "esrsclientproxy", "criticality" : "Warning", "serviceType" : "Core service status", "description" : "A service for connectivity between devices and Dell Technologies", "status" : "Running", "recommendation" : "" }, { "serviceName" : "esrswatchdogservice", "criticality" : "Warning", "serviceType" : "Core service status", "description" : "A service that monitors whether or not other services are running or down. When services go down unexpectedly, the watchdog service will attempt to restart them so they start functioning normally again", "status" : "Running", "recommendation" : "" }, { "serviceName" : "esrshttpdftp", "criticality" : "Critical", "serviceType" : "Core service status", "description" : "A service at Dell Technologies that receives alert data from your devices", "status" : "Running", "recommendation" : "" }, { "serviceName" : "esrshttpdlistener", "criticality" : "Critical", "serviceType" : "Core service status", "description" : "A service at Dell Technologies that receives alert data from your devices", "status" : "Running", "recommendation" : "" }, { "serviceName" : "shibd", "criticality" : "Critical", "serviceType" : "Core service status", "description" : "A Service for remote secure credentials", "status" : "Running", "recommendation" : "" }, { "serviceName" : "apache2", "criticality" : "Critical", "serviceType" : "Core service status", "description" : "A Service for remote secure credentials", "status" : "Running", "recommendation" : "" }, { "serviceName" : "esrsjcemc", "criticality" : "Critical", "serviceType" : "Restful service status", "description" : "A service at Dell Technologies that receives alert data from your devices", "status" : "Running", "recommendation" : "" }, { "serviceName" : "esrskeepalive", "criticality" : "Critical", "serviceType" : "Restful service status", "description" : "Device service that sends heartbeat status from devices to Dell Technologies", "status" : "Running", "recommendation" : "" }, { "serviceName" : "esrsmftauth", "criticality" : "Critical", "serviceType" : "Restful service status", "description" : "A service that transfers files between Dell, your gateway, and your devices", "status" : "Running", "recommendation" : "" }, { "serviceName" : "esrsupdate", "criticality" : "Critical", "serviceType" : "Restful service status", "description" : "A service to retreives update information from Dell Technologies", "status" : "Running", "recommendation" : "" }, { "serviceName" : "esrsdigitaltwinservice", "criticality" : "Critical", "serviceType" : "Restful service status", "description" : "A service for connectivity between devices and Dell Technologies", "status" : "Running", "recommendation" : "" }, { "serviceName" : "esrsmqttclient", "criticality" : "Critical", "serviceType" : "Restful service status", "description" : "A service that monitors connectivity between the gateway and Dell", "status" : "Running", "recommendation" : "" }, { "serviceName" : "esrsmosquitto", "criticality" : "Critical", "serviceType" : "Core service status", "description" : "A service that transfers files between your gateway local system to Dell", "status" : "Running", "recommendation" : "" }, { "serviceName" : "esrsmqttauth", "criticality" : "Critical", "serviceType" : "Restful service status", "description" : "A service that validates credentials for remote support activities", "status" : "Running", "recommendation" : "" }, { "serviceName" : "srsadapter", "description" : "A service that manages the communications between containers", "status" : "running" }, { "serviceName" : "secureconnectgateway", "description" : "A service that allows access to secure connect gateway's user interface.", "status" : "running" }, { "serviceName" : "cases", "description" : "A service that manages alerts, events, and support cases generated by your gateway.", "status" : "running" }, { "serviceName" : "auditlog", "description" : "A service that displays your gateway's activity history.", "status" : "running" }, { "serviceName" : "connectivity", "description" : "A service that manages connectivity with the Dell Technologies backend.", "status" : "running" }, { "serviceName" : "appsettings", "description" : "A service to save changes for configuration settings.", "status" : "running" }, { "serviceName" : "consoleadapter", "description" : "A service that manages connectivity with systems management consoles.", "status" : "running" }, { "serviceName" : "registration", "description" : "A service that registers your secure connect gateway.", "status" : "running" }, { "serviceName" : "collection", "description" : "A service that initiates collection of telemetry from devices, then retreives that telemetry and displays it in your gateway. ", "status" : "running" }, { "serviceName" : "inventory", "description" : "A service that retreives inventory information from devices.", "status" : "running" }, { "serviceName" : "secureconnectgatewaydb", "description" : "A service that allows access to secure connect gateway's database.", "status" : "running" }, { "serviceName" : "email", "description" : "A service that manages and sends emails from secure connect gateway.", "status" : "running" } ], "networkConnectivity" : [ { "hostName" : "esrs3-core.emc.com", "port443" : { "status" : "CONNECTED", "recommendation" : "" }, "port8443" : { "status" : "CONNECTED", "recommendation" : "" } }, { "hostName" : "esrs3-coredr.emc.com", "port443" : { "status" : "CONNECTED", "recommendation" : "" }, "port8443" : { "status" : "CONNECTED", "recommendation" : "" } } ], "systemInfo" : { "systemInfo" : "VMware, Inc.", "noOfProcessors" : 4, "memory" : { "memoryUsage" : "12.21 / 15.66 GB (78%)", "status" : "HEALTHY", "message" : "" }, "cpu" : { "cpuLoad" : "2.65%", "status" : "HEALTHY" }, "diskSpaceDetails" : [ { "partitionName" : "/dev/sda1", "availableDiskSpace" : "0.21 GB", "used" : "28%" }, { "partitionName" : "/dev/mapper/scgVG-LVRoot", "availableDiskSpace" : "13.31 GB", "used" : "13%" }, { "partitionName" : "/dev/mapper/scgVG-LVvar_lib_docker", "availableDiskSpace" : "86.77 GB", "used" : "8%" }, { "partitionName" : "/dev/mapper/scgVG-LVvar_log", "availableDiskSpace" : "7.35 GB", "used" : "6%" }, { "partitionName" : "/dev/mapper/scgVG-LVvar_lib_scgve", "availableDiskSpace" : "7.36 GB", "used" : "6%" }, { "partitionName" : "/dev/mapper/scgVG-LVopt_esrsve", "availableDiskSpace" : "7.35 GB", "used" : "6%" } ] }, "smtp" : { "status" : "Connected" } }, "email" : "Timed out after waiting 30000(ms) for a reply. address: __vertx.reply.1bd9b6f0-73e1-4f27-8f57-207c3c5577bb, repliedAddress: emailApplianceService.queue" }scg:~ #
要將報告儲存到檔案:
curl -k -X GET --header "Accept: application/json" -o report_scg.txt --header "Authorization: Bearer $AUTH_TOKEN" https://10.108.0.40:5700/SupportAssist/api/v2/service/healthstatus?
其中:-o report_scg.txt = 這個選項用於將輸出儲存在 "report_scg.txt" 檔案。
重要 - 身份驗證機制:
當客戶端通過提供其憑據從伺服器請求令牌時,身份驗證過程將啟動。作為回應,安全連線閘道會傳回存取權杖和重新整理權杖。刷新令牌的有效期為 24 小時,而 訪問令牌的有效期為 30 分鐘。訪問令牌過期后,可以使用刷新令牌生成新的訪問令牌。
Additional Information
安全連線閘道 REST API 指南:
Affected Products
VxRail, Secure Connect Gateway, Secure Connect Gateway - Virtual Edition, VxRail Appliance Family, VxRail Appliance SeriesArticle Properties
Article Number: 000197829
Article Type: How To
Last Modified: 18 Nov 2025
Version: 3
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.