監視香港 API Gateway
安裝 Instana 主機代理程式之後,會自動安裝香港 API Gateway 感應器。 在配置感應器之後,您可以在 Instana 使用者介面中檢視與香港 API Gateway 相關的度量值,如本主題的 配置 小節所述。
支援的資訊
支援的作業系統
「香港 API Gateway 」感應器支援符合主機代理程式需求的作業系統。 您可以在每一個主機代理程式的 支援的作業系統 區段中檢查這些需求。 例如,請參閱 Unix 支援的作業系統。
支援的版本
Instana 代理程式支援下列香港 API Gateway 版本:
- Kong Gateway (OSS) 2.6 或更新版本
- Kong Gateway 2.6 或更新版本 (免費或企業模式)
必要條件
在配置「香港 API Gateway 」感應器之前,請先檢閱必要條件。
獨立式模式
請確定可從代理程式安裝所在的主機存取香港管理 API。 在 kong.conf 檔案中,更新 admin_listen 參數,如下列範例所示:
admin_listen = 0.0.0.0:8001 reuseport backlog=16384, 0.0.0.0:8444 http2 ssl reuseport backlog=16384
在介面連結中, IP 位址 127.0.0.1 表示伺服器只接聽迴圈介面。 將伺服器連結至 IP 位址 0.0.0.0 可讓伺服器接受來自所有可用介面的資料流量。
混合式模式
若要以混合式模式存取管理 API ,請建立 Kubernetes 服務並公開下列其中一個埠:
- 8001 for HTTP
- 8444 for HTTPS
若要建立 Kubernetes 服務以公開 "/metrics" 及 "/" 端點,請執行下列指令:
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Service
metadata:
name: kong-cp-monitoring
namespace: kong
labels:
app: kong-cp-monitoring
spec:
selector:
app.kubernetes.io/name: kong
type: ClusterIP
ports:
- name: root
protocol: TCP
port: 8001
targetPort: 8001
EOF
若要轉遞 HTTP 的埠 8001 ,請執行下列指令:
kubectl port-forward service/kong-cp-monitoring -n kong 8001 –address 0.0.0.0
下列範例顯示 kubectl port-forward 指令的輸出:
Forwarding from 127.0.0.1:8100 -> 8100
基本鑑別
香港 Instana 感應器支援基本鑑別。 若要配置香港基本鑑別,請參閱 指示。 如果香港管理 API 不需要基本鑑別,則您可以跳過此步驟。
只有在啟用基本鑑別時,下列配置才適用。 否則,請不要更新配置並保持註解狀態。
username: '' # Optional. Only for basic authentication otherwise keep it commented.
password: '' # Optional. Only for basic authentication otherwise keep it commented.
admin_api_route_path: '' # Optional.Only for basic authentication otherwise keep it commented.
Kong-Admin-Token 型鑑別
Kong-Admin-Token 型鑑別假設香港受到「角色型存取控制 (RBAC)」的保護,且您建立了您的「Hong Kong-Admin-Token」。 在發出管理 API 呼叫之前,您必須先建立 Kong-Admin-Token。 若要在香港 Enterprise Edition Web 主控台中建立及更新記號,請按一下 設定檔 > 重設記號。 記號 abc123 在下列範例中建立: 如果香港管理 API 不需要以香港管理記號為基礎的鑑別,則您可以跳過此步驟。
只有在啟用以 Kong-Admin-Token 為基礎的鑑別時,下列配置才適用。 否則,請不要更新配置,並保持註解狀態。
admin_token: 'abc123' # Optional. Only for Kong-Admin-Token based authentication otherwise keep it commented.
配置
香港 API Gateway 感應器同時支援本端及遠端監視。
本端監視
香港 API Gateway 的本端監視是透過自動探索香港處理程序來達成。 configuration.yaml 檔中不需要任何項目。 此外,請確定「香港 API Gateway 」正在執行中。 如需孔 API 閘道的混合式模式設定,請建立 Kubernetes 服務,以讓埠 8001 上的孔管理 API 可透過埠轉遞進行存取。 如需如何以混合式模式存取管理 API 的相關資訊,請參閱 混合式模式。
遠端監視
若要連接至香港 API Gateway,請在代理程式配置檔 <agent_install_dir>/etc/instana/configuration.yaml中配置下列欄位:
#Kong API Gateway
com.instana.plugin.kong:
remote: # Multiple configurations can be specified
- host: '' # Kong Server Host or IP address.
port: '8444' # Admin api port(default is 8444). In case of basic authentication, it is a proxy port.
availabilityZone: 'KongAZ' # default is 'KongAZ'
poll_rate: 30 # Poll rate in seconds. It can not be less than 30 seconds.
protocol: 'https' # ['https' or 'http']. Default is 'https'. Protocol to access Kong Admin API.
username: '' # Optional. Only for basic authentication otherwise keep it commented.
password: '' # Optional. Only for basic authentication otherwise keep it commented.
admin_api_route_path: '' # Optional.Only for basic authentication otherwise keep it commented.
下列範例顯示 沒有基本鑑別的配置:
#Kong API Gateway
com.instana.plugin.kong:
remote: # Multiple configurations can be specified
- host: 'host-1' # Kong Server Host or IP address.
port: '8444' # Admin api port(default is 8444). In case of basic authentication, it is a proxy port.
availabilityZone: 'KongAZ-DC1' # default is 'KongAZ'
poll_rate: 30 # Poll rate in seconds. It can not be less than 30 seconds.
protocol: 'https' # ['https' or 'http']. Default is 'https'. Protocol to access Kong Admin API.
- host: 'host-2' # Kong Server Host or IP address.
port: '8444' # Admin api port(default is 8444). In case of basic authentication, it is a proxy port.
availabilityZone: 'KongAZ-DC2' # default is 'KongAZ'
poll_rate: 30 # Poll rate in seconds. It can not be less than 30 seconds.
protocol: 'https' # ['https' or 'http']. Default is 'https'. Protocol to access Kong Admin API.
下列範例顯示已啟用基本鑑別的 配置:
#Kong API Gateway
com.instana.plugin.kong:
remote: # Multiple configurations can be specified
- host: 'host-1' # Kong Server Host or IP address.
port: '8444' # Admin api port(default is 8444). In case of basic authentication, it is a proxy port.
availabilityZone: 'KongAZ-DC1' # default is 'KongAZ'
poll_rate: 30 # Poll rate in seconds. It can not be less than 30 seconds.
protocol: 'https' # ['https' or 'http']. Default is 'https'. Protocol to access Kong Admin API.
username: 'user-1' # Optional. Only for basic authentication otherwise keep it commented.
password: 'password-1' # Optional. Only for basic authentication otherwise keep it commented.
admin_api_route_path: 'admin-api-1' # Optional.Only for basic authentication otherwise keep it commented.
- host: 'host-2' # Kong Server Host or IP address.
port: '8444' # Admin api port(default is 8444). In case of basic authentication, it is a proxy port.
availabilityZone: 'KongAZ-DC2' # default is 'KongAZ'
poll_rate: 30 # Poll rate in seconds. It can not be less than 30 seconds.
protocol: 'https' # ['https' or 'http']. Default is 'https'. Protocol to access Kong Admin API.
username: 'user-2' # Optional. Only for basic authentication otherwise keep it commented.
password: 'password-2' # Optional. Only for basic authentication otherwise keep it commented.
admin_api_route_path: 'admin-api-2' # Optional.Only for basic authentication otherwise keep it commented.
檢視度量值
若要檢視度量值,請完成下列步驟:
- 在 Instana 使用者介面的資訊看板中,選取 基礎架構。
- 按一下特定的受監視主機。
您可以查看包含所有已收集度量及受監視處理程序的主機儀表板。
下列度量值適用於每一個香港 API Gateway 伺服器:
| 度量 | 說明 | 精度 |
|---|---|---|
| 可聯絡 Kong 資料儲存庫 | 顯示香港資料儲存庫連線狀態。 如果香港無法連接至資料儲存庫,則傳回「否」,否則傳回「是」。 | 30 秒 |
| 資料庫實體總數 | 顯示香港資料庫中的實體總數。 | 30 秒 |
| Kong DB 實體計數錯誤 | 測量在測量香港資料庫中實體總數期間發現的錯誤數。 | 30 秒 |
| 授權資訊收集中的錯誤 | 顯示在收集授權資訊期間發現的錯誤總數。 | 30 秒 |
| 香港 Nginx 度量錯誤 | 增加使用 nginx-lua-prometheus 程式庫時所發現的度量錯誤。 此 Lua 程式庫與 Nginx 搭配使用,以追蹤度量值並將它們顯示在 Prometheus要取回的個別網頁上。 |
30 秒 |
| 工作者一致性 | 定義此節點必須同步或非同步重建其狀態。 接受的值是嚴格且最終。 | 30 秒 |
| 工作者狀態更新頻率 | 定義使用背景工作檢查工作者狀態變更的頻率。 預設值為 5 秒。 | 30 秒 |
| 香港 Nginx 計時器 | 呈現處於執行中及擱置狀態的 NGINX 計時器總數。 | 30 秒 |
| 資料流量總計 | 顯示依狀態碼類別分組的所有狀態碼計數 (例如, 2xx、 3xx、 4xx和 5xx) | 30 秒 |
| 共用字典已配置 Slab | 在共用記憶體字典中呈現已配置的 slab (以位元組為單位) ,以儲存大量資料。 | 30 秒 |
| 工作者 Lua VM 中已配置的位元組數 | 顯示「工作者 Lua 虛擬機器」中已配置的記憶體 (以位元組為單位)。 | 30 秒 |
| Kong NGINX 要求總數 | 顯示子系統 (例如 HTTP 或串流) 的要求總數。 | 30 秒 |
| 頻寬 (位元組) | 顯示流經香港的頻寬 (輸出或輸入) 總計 (以位元組為單位)。 此度量適用於每個服務,並作為所有服務的總和。 | 30 秒 |
| HTTP 要求數總計 | 顯示每個服務每個路徑及每個 HTTP 狀態碼的 HTTP 要求總數。 | 30 秒 |
| 依服務列出的 Kong 延遲 | 顯示每一個服務的香港及已啟用外掛程式所新增的延遲。 | 30 秒 |
| 依路由列出的 Kong 延遲 | 顯示每一個路徑的香港及已啟用外掛程式所新增的延遲。 | 30 秒 |