本指南說明如何在 Compute Engine 執行個體上安裝及設定 Google Cloud的 Agent for SAP 3.8 版 (最新版),包括以 X4 或 C3 系列為基礎的執行個體。
如要在 Bare Metal 解決方案伺服器上安裝及設定代理程式,請參閱「在 Bare Metal 解決方案伺服器上安裝 Google Cloud的 Agent for SAP」。
Google Cloud的 SAP 代理程式是 SAP 支援在 Google Cloud上執行的 SAP 系統所需的工具,包括 SAP NetWeaver、SAP HANA、SAP ASE、SAP MaxDB 等。
在 Compute Engine 執行個體上安裝 Google Cloud的 SAP 代理程式時,代理程式會針對 SAP Host Agent 指標,結合 Cloud Monitoring 和 Compute Engine API 的監控資料,並將這些資料提供給 SAP Host Agent。
如果您使用 Google Cloud提供的下列 RHEL 或 SLES「for SAP」OS 映像檔, Google Cloud的 SAP 代理程式會與 OS 映像檔一併封裝:
- RHEL:所有「SAP 專用」映像檔
- SLES:SLES 15 SP4 for SAP 以上版本
如要瞭解 Google Cloud的 Agent for SAP 支援的作業系統,請參閱「支援的作業系統」。
安裝總覽
在 Linux 上,您可以使用標準作業系統套件管理指令安裝 Google Cloud的 SAP 代理程式:在 RHEL 上使用 yum
指令,在 SLES 上使用 zypper
指令。套件管理指令會完成下列工作:
- 下載 Google Cloud的 Agent for SAP 最新版本。
- 將代理程式設為 Linux
systemd
服務,並命名為google-cloud-sap-agent
。 - 啟用並啟動服務
google-cloud-sap-agent
。
在 Windows 上,您可以使用 GooGet 套件管理指令 googet
安裝 Google Cloud的 SAP 代理程式。套件管理指令會完成下列工作:
- 下載 Google Cloud的 Agent for SAP 最新版本。
建立名為
google-cloud-sap-agent
的 Windows 服務,以及每分鐘執行一次的排程工作,以便檢查服務是否仍在執行,並視需要重新啟動服務。
代理程式的先決條件
安裝 Google Cloud的 SAP 代理程式前,請務必確認已符合下列先決條件。
設定必要的 IAM 角色
Google Cloud的 SAP 代理程式所使用的服務帳戶至少必須具備Compute 檢視者 (roles/compute.viewer
)、監控檢視者 (roles/monitoring.viewer
) 和 Workload Manager 深入分析寫入者 (roles/workloadmanager.insightWriter
) 角色。
如要為服務帳戶新增必要角色,請按照下列步驟操作:
前往 Google Cloud 控制台的「IAM」頁面。
選取 Google Cloud 專案。
找出您想新增角色的服務帳戶。
- 如果服務帳戶不在主體清單中,表示尚未獲派任何角色。按一下「Add」,然後輸入服務帳戶的電子郵件地址。
- 如果服務帳戶已在使用者清單中,表示已獲指派角色。找到要編輯的服務帳戶,然後按一下「編輯」按鈕。
從可用角色清單中選取必要角色:
- Compute Engine > Compute 檢視器
- Monitoring > Monitoring 檢視器
- Workload Manager > Workload Manager 深入分析資訊寫入者
按一下 [Add] (新增) 或 [Save] (儲存),即可將角色套用到服務帳戶。
啟用 Google Cloud API 存取權
Compute Engine 建議您設定運算執行個體,允許所有 Cloud API 的所有存取權範圍,並僅使用執行個體服務帳戶的 IAM 權限來控管資源存取權。 Google Cloud 詳情請參閱「建立使用使用者管理服務帳戶的 VM」。
如果您限制 Cloud API 存取權, Google Cloud的 SAP 代理程式就需要在主機 Compute Engine 執行個體上設定下列最低 Cloud API 存取範圍:
- Cloud Platform:已啟用
- Compute Engine:唯讀
- Stackdriver Monitoring API:唯讀
如果您要在沒有外部 IP 位址的運算執行個體上執行 SAP 應用程式,就必須在運算執行個體的子網路上啟用私人 Google 存取權 ,讓 Google Cloud的 SAP 代理程式可以存取 Google API 和服務。如要在子網路中啟用私人 Google 存取權,請參閱「設定私人 Google 存取權」。
安裝代理程式
如要在 Compute Engine 執行個體上安裝 Google Cloud的 Agent for SAP,請選取作業系統,然後完成下列步驟。
Linux
如要在 Compute Engine 執行個體上安裝代理程式,請按照下列步驟操作:
- 建立與運算執行個體之間的 SSH 連線。
- 在終端機中,執行適用於您作業系統的指令來安裝代理程式:
- (建議) 如要安裝代理程式的 3.8 版 (最新版),請按照下列步驟操作:
RHEL
sudo tee /etc/yum.repos.d/google-cloud-sap-agent.repo << EOM [google-cloud-sap-agent] name=Google Cloud Agent for SAP baseurl=https://packages.cloud.google.com/yum/repos/google-cloud-sap-agent-el$(cat /etc/redhat-release | cut -d . -f 1 | tr -d -c 0-9)-x86_64 enabled=1 gpgcheck=1 repo_gpgcheck=0 gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg EOM sudo yum install google-cloud-sap-agent
SLES15
sudo zypper addrepo --refresh https://packages.cloud.google.com/yum/repos/google-cloud-sap-agent-sles15-x86_64 google-cloud-sap-agent sudo zypper install google-cloud-sap-agent
SLES 12
sudo zypper addrepo --refresh https://packages.cloud.google.com/yum/repos/google-cloud-sap-agent-sles12-x86_64 google-cloud-sap-agent sudo zypper install google-cloud-sap-agent
- 如要安裝特定版本的代理程式,請按照下列步驟操作:
RHEL
sudo tee /etc/yum.repos.d/google-cloud-sap-agent.repo << EOM [google-cloud-sap-agent] name=Google Cloud Agent for SAP baseurl=https://packages.cloud.google.com/yum/repos/google-cloud-sap-agent-el$(cat /etc/redhat-release | cut -d . -f 1 | tr -d -c 0-9)-x86_64 enabled=1 gpgcheck=1 repo_gpgcheck=0 gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg EOM sudo yum install google-cloud-sap-agent-VERSION_NUMBER.x86_64
SLES15
sudo zypper addrepo --refresh https://packages.cloud.google.com/yum/repos/google-cloud-sap-agent-sles15-x86_64 google-cloud-sap-agent sudo zypper install google-cloud-sap-agent-VERSION_NUMBER.x86_64
SLES 12
sudo zypper addrepo --refresh https://packages.cloud.google.com/yum/repos/google-cloud-sap-agent-sles12-x86_64 google-cloud-sap-agent sudo zypper install google-cloud-sap-agent-VERSION_NUMBER.x86_64
將
VERSION_NUMBER
替換為要安裝的代理程式版本號碼,例如3.1-606637668
。如要瞭解可安裝的代理程式版本,請參閱「列出所有可用的代理程式版本」。如要瞭解如何將代理程式降級至特定版本,請參閱「 為 SAP 降級 Google Cloud代理程式」。
- (建議) 如要安裝代理程式的 3.8 版 (最新版),請按照下列步驟操作:
Windows
如要在 Compute Engine 執行個體上安裝代理程式,請按照下列步驟操作:
- 使用遠端桌面協定連線至運算執行個體。
- 以管理員身分在 PowerShell 中執行下列指令:
googet addrepo google-cloud-sap-agent https://packages.cloud.google.com/yuck/repos/google-cloud-sap-agent-windows googet install google-cloud-sap-agent
安裝 Google Cloud的 Agent for SAP 和 SAP Host Agent 後,請按照「驗證代理程式安裝狀態」一節所述,驗證 Google Cloud的 Agent for SAP 安裝作業。
驗證代理程式安裝狀態
如要確認代理程式是否正在執行,請選取您的作業系統,然後按照步驟操作:
Linux
與 Compute Engine 執行個體建立 SSH 連線。
執行下列指令:
systemctl status google-cloud-sap-agent
如果代理程式運作正常,輸出內容就會包含
active (running)
。例如:google-cloud-sap-agent.service - Google Cloud Agent for SAP Loaded: loaded (/usr/lib/systemd/system/google-cloud-sap-agent.service; enabled; vendor preset: disabled) Active: active (running) since Fri 2022-12-02 07:21:42 UTC; 4 days ago Main PID: 1337673 (google-cloud-sa) Tasks: 9 (limit: 100427) Memory: 22.4 M (max: 1.0G limit: 1.0G) CGroup: /system.slice/google-cloud-sap-agent.service └─1337673 /usr/bin/google-cloud-sap-agent
在 SLES 映像檔上,如要確保您使用的是 Google Cloud的最新版 SAP 代理程式,請執行下列指令。
sudo zypper remove google-cloud-sap-agent sudo zypper addrepo -p 98 --refresh https://packages.cloud.google.com/yum/repos/google-cloud-sap-agent-sles15-\$basearch google-cloud-sap-agent sudo zypper install google-cloud-sap-agent
Windows
使用遠端桌面協定連線至 Compute Engine 執行個體。
以管理員身分在 PowerShell 中執行下列指令:
如果代理程式正在執行,狀態會顯示$(Get-Service -Name 'google-cloud-sap-agent' -ErrorAction Ignore).Status
Running
。
如果代理程式未執行,請重新啟動代理程式。
確認 SAP Host Agent 正在接收指標
如要確認Google Cloud的 Agent for SAP 是否收集基礎架構指標,並正確傳送至 SAP Host Agent,請按照下列步驟操作:
- 在 SAP 系統中輸入交易
ST06
。 在「Overview」(總覽) 窗格中,查看以下欄位的可用性和內容,確認 SAP 和 Google 監控基礎架構已做好正確的端對端設定:
- 雲端服務供應商:
Google Cloud Platform
- Enhanced Monitoring Access (強化版監控功能存取權):
TRUE
- Enhanced Monitoring Details (強化版監控功能詳細資料):
ACTIVE
- 雲端服務供應商:
在 Linux 上設定 Google Cloud的 Agent for SAP
安裝 Google Cloud的 SAP 代理程式後,您可以視需要執行下列設定,啟用代理程式的其他功能。根據預設,系統會啟用 SAP 主機代理程式指標和 Workload Manager 評估指標的收集功能。
下列功能僅支援 Linux。Windows 不支援這類功能。
- 設定程序監控指標收集
- 設定 Workload Manager 評估指標收集作業
- 設定 SAP HANA 監控指標收集作業。
- 為 SAP HANA 設定 Backint 備份和復原功能。
- 使用磁碟快照備份及復原 SAP HANA。
預設設定檔
以下程式碼片段是 Google Cloud的 Agent for SAP 3.8 版 (最新版) 的預設設定範例:
{ "provide_sap_host_agent_metrics": true, "bare_metal": false, "log_level": "INFO", "log_to_cloud": true, "collection_configuration": { "collect_workload_validation_metrics": true, "collect_process_metrics": false }, "discovery_configuration": { "enable_discovery": true, "enable_workload_discovery": true }, "hana_monitoring_configuration": { "enabled": false } }
如要查看功能專屬的設定檔範例,請參閱該功能的設定指南。
設定參數
下表說明在 Compute Engine 執行個體上執行的Google Cloud用於 SAP 的代理程式設定參數,包括與指標收集相關的參數。如要瞭解與代理程式 Backint 功能相關的設定參數,請參閱「設定參數」。
參數 | |
---|---|
provide_sap_host_agent_metrics |
如要啟用 SAP Host Agent 所需的指標收集功能,請指定 |
bare_metal |
將代理程式安裝在 Bare Metal 解決方案伺服器上時,請指定 |
log_level |
如要設定代理程式的記錄等級,請設定必要值。可用的記錄層級如下:
預設為 |
log_to_cloud |
如要將代理程式記錄重新導向至 Cloud Logging,請指定 |
cloud_properties.project_id |
如果您的 SAP 系統在 Bare Metal 解決方案伺服器上執行,請指定您在 Bare Metal 解決方案中使用的 Google Cloud 專案 ID。 |
cloud_properties.instance_name
|
指定 Compute Engine 執行個體的名稱。代理程式會在安裝時自動偵測這項資訊。 |
cloud_properties.region |
如果 SAP 系統是在 Bare Metal 解決方案伺服器上執行,請指定 Bare Metal 解決方案伺服器的區域。 |
cloud_properties.zone |
代理程式在運算執行個體上執行時,預設會使用運算執行個體部署所在的區域。 |
cloud_properties.image |
指定執行個體的 OS 映像檔名稱。 |
cloud_properties.numeric_project_id |
指定執行 SAP 系統的 Google Cloud 專案的數字 ID。 |
discovery_configuration.enable_workload_discovery |
如要讓代理程式收集主機上執行的 SAP 產品名稱和版本,請指定 詳情請參閱 |
discovery_configuration.enable_discovery |
如要將代理程式收集到的關於主機上執行的 SAP 產品資訊傳送至 Cloud Logging,請指定 如果您指定 |
collection_configuration.collect_process_metrics |
如要啟用 Process Monitoring 指標收集功能,請指定 |
collection_configuration.process_metrics_frequency |
自 2.6 版起,這個參數會以秒為單位,決定變化快速的程序監控指標的收集頻率。變化快速的 Process Monitoring 指標為: 這個參數的預設值為 所有其他 (變動緩慢) 的 Process Monitoring 指標,會以 30 秒的預設頻率收集。如要變更變化緩慢的 Process Monitoring 指標的收集頻率,請使用 |
collection_configuration.slow_process_metrics_frequency |
指定變動緩慢的程序監控指標的收集頻率 (以秒為單位)。 這個參數的預設值為 |
collection_configuration.process_metrics_to_skip |
指定不想讓代理程式收集的Process Monitoring 指標。這個參數接受以逗號分隔的 Process Monitoring 指標名稱值。例如: |
collection_configuration.hana_metrics_config.hana_db_user |
指定代理程式用來查詢 SAP HANA 的資料庫使用者帳戶。預設值為 |
collection_configuration.hana_metrics_config.hana_db_password |
為資料庫使用者帳戶指定純文字密碼,代理程式會使用這組密碼查詢 SAP HANA。 建議您改用下列任一選項,而非指定純文字密碼:
針對 SAP HANA 驗證,代理程式會使用下列優先順序:如果已指定, |
collection_configuration.hana_metrics_config.hana_db_password_secret_name |
如要安全地提供資料庫使用者帳戶的密碼,以便代理程式用於查詢 SAP HANA,請指定包含資料庫使用者帳戶安全性憑證的機密資料名稱。 只有在您指定 針對 SAP HANA 驗證,代理程式會使用下列優先順序:如果已指定, |
collection_configuration.hana_metrics_config.hdbuserstore_key
|
如要安全地連線至 SAP HANA 系統,請指定您為該系統建立的 安全使用者儲存庫 ( 如要使用
這個設定參數自 3.3 版開始支援。 針對 SAP HANA 驗證,代理程式會使用下列優先順序:如果已指定, |
collection_configuration.hana_metrics_config.sid |
指定 SAP HANA 執行個體的 SID。
如果您使用 |
collection_configuration.collect_workload_validation_metrics |
如要啟用 Workload Manager 評估指標收集功能,請指定 |
collection_configuration.workload_validation_metrics_frequency |
Workload Manager 評估指標的收集頻率 (以秒為單位)。預設值為 如果您需要修改工作負載管理工具指標的收集頻率,請在 |
collection_configuration.workload_validation_collection_definition.fetch_latest_config |
(選用步驟) 預設值為 |
collection_configuration.workload_validation_db_metrics_config.hana_db_user |
指定用於查詢 SAP HANA 執行個體的使用者帳戶。 使用者帳戶必須具備 SAP HANA 資料庫的讀取權限。 |
collection_configuration.workload_validation_db_metrics_config.hana_db_password |
指定用來查詢 SAP HANA 執行個體的使用者帳戶密碼。 針對 SAP HANA 驗證,代理程式會使用下列優先順序:如果已指定, |
collection_configuration.workload_validation_db_metrics_config.hana_db_password_secret_name |
在 Secret Manager 中指定儲存使用者帳戶密碼的機密。 或者,您也可以指定 針對 SAP HANA 驗證,代理程式會使用下列優先順序:如果已指定, |
collection_configuration.workload_validation_db_metrics_config.hdbuserstore_key
|
如要安全地連線至 SAP HANA 系統,請指定您為該系統建立的 安全使用者儲存庫 ( 如要使用
這個設定參數自 3.3 版開始支援。 如果您指定 針對 SAP HANA 驗證,代理程式會使用下列優先順序:如果已指定, |
collection_configuration.workload_validation_db_metrics_config.sid |
指定 SAP HANA 例項的 SID。 |
collection_configuration.workload_validation_db_metrics_config.hostname |
指定主機的 ID,該主機可用於代管 SAP HANA 例項,可為本機或遠端。支援的值如下:
|
collection_configuration.workload_validation_db_metrics_config.port |
指定 SAP HANA 執行個體接受查詢的通訊埠。第一個或唯一租用戶資料庫執行個體的通訊埠為 |
collection_configuration.workload_validation_db_metrics_frequency |
收集 SAP HANA 資料庫指標的頻率 (以秒為單位),用於 Workload Manager 評估。預設值為 |
hana_monitoring_configuration.enabled |
(選用步驟) 如要讓 Google Cloud的 SAP 代理程式收集 SAP HANA 監控指標,請指定 hana_monitoring_configuration.enabled: true 的情況。 |
hana_monitoring_configuration.sample_interval_sec |
(選用步驟) 指定取樣間隔 (以秒為單位),這會決定 Google Cloud的 SAP 代理程式查詢 SAP HANA 執行個體的頻率,以便收集 SAP HANA 監控指標。預設值為 300 秒。 針對 Google Cloud的 SAP 代理程式在設定檔中定義的每個查詢,您可以指定參數 |
hana_monitoring_configuration.query_timeout_sec |
(選用步驟) 指定對 SAP HANA 執行個體執行的每個查詢的逾時時間。預設值為 300 秒。 |
hana_monitoring_configuration.execution_threads |
(選用步驟) 指定用於將查詢傳送至 SAP HANA 執行個體的執行緒數量。每個查詢都會在自己的執行緒中執行。預設值為 10。 |
hana_monitoring_configuration.send_query_response_time |
(選用步驟) 指定 |
hana_monitoring_configuration.hana_instances.name |
指定 SAP HANA 執行個體的名稱 ID。 |
hana_monitoring_configuration.hana_instances.sid |
指定 SAP HANA 例項的 SID。這個字串會新增為標籤,並套用至查詢 SAP HANA 執行個體所產生的所有指標。 |
hana_monitoring_configuration.hana_instances.host |
指定主機的 ID,該主機可用於代管 SAP HANA 例項,可為本機或遠端。支援的值如下:
|
hana_monitoring_configuration.hana_instances.port |
指定 SAP HANA 執行個體接受查詢的通訊埠。第一個或唯一租用戶資料庫執行個體的通訊埠為 |
hana_monitoring_configuration.hana_instances.user |
指定用於查詢 SAP HANA 執行個體的使用者帳戶。 請確認此使用者具有讀取 SAP HANA 資料庫中監控檢視畫面的權限。如果未授予此權限,則與監控檢視畫面相關的 SAP HANA 監控指標就不會包含任何資料。 |
hana_monitoring_configuration.hana_instances.password |
(選用步驟) 以純文字形式指定密碼,以便驗證用於查詢 SAP HANA 執行個體的使用者帳戶。 如要進行驗證,您必須指定下列其中一項:
針對 SAP HANA 驗證,代理程式會使用下列優先順序:如果已指定, |
hana_monitoring_configuration.hana_instances.secret_name |
(選用步驟) 在 Secret Manager 中指定儲存使用者帳戶密碼的機密。 針對 SAP HANA 驗證,代理程式會使用下列優先順序:如果已指定, |
hana_monitoring_configuration.hana_instances.hdbuserstore_key
|
如要安全地連線至 SAP HANA 系統,請指定您為該系統建立的 安全使用者儲存庫 ( 如要使用
這個設定參數自 3.3 版開始支援。 如果您指定 |
hana_monitoring_configuration.hana_instances.is_local
|
如要監控 HA 系統,請指定 這個參數的預設值為 這個參數適用於 3.7 以上版本的代理程式。 |
hana_monitoring_configuration.hana_instances.instance_num
|
指定您為 SAP HANA 例項設定的例項編號。 代理程式需要這項資訊才能偵測您的 SAP HANA 執行個體。 這個參數適用於 3.7 以上版本的代理程式。 |
hana_monitoring_configuration.hana_instances.queries_to_run.run_all
|
(選用步驟) 指定 |
hana_monitoring_configuration.hana_instances.queries_to_run.query_name
|
(選用步驟) 指定要在指定 SAP HANA 執行個體上執行的查詢。 如果您執行的是多租戶 SAP HANA 資料庫,可以使用這個設定參數來設定租戶專屬監控。在以下設定範例中,系統會在 "hana_instances": [ { "name": "HANA_TENANT_1, "queries_to_run": { "query_name": ["QUERY_NAME_1", "QUERY_NAME_2"] } }, { "name": "HANA_TENANT_2, "queries_to_run": { "run_all": true } } ... ] |
hana_monitoring_configuration.hana_instances.enable_ssl |
(選用步驟) 指定是否在 SAP HANA 例項中啟用 SSL。預設值為 |
hana_monitoring_configuration.hana_instances.host_name_in_certificate |
如果您為 SAP HANA 執行個體指定 |
hana_monitoring_configuration.hana_instances.tls_root_ca_file |
如果您為 SAP HANA 執行個體指定 |
hana_monitoring_configuration.queries.enabled |
(選用步驟) 如要為所有 SAP HANA 執行個體啟用 SQL 查詢,請為該 SQL 查詢的參數 |
hana_monitoring_configuration.queries.name |
如果您在設定檔中定義了自訂查詢,則必須為每個自訂查詢指定不重複的名稱。 查詢名稱不得重複,因為這會用於在監控中建立指標的預設網址。 |
hana_monitoring_configuration.queries.run_on |
(選用步驟) 如果您要監控 SAP HANA HA 系統,並想在主要或次要節點上執行 SAP HANA 監控查詢,請指定這個參數。支援的值: 這個參數適用於 3.7 以上版本的代理程式。此外,如要在次要節點上執行查詢,請確認 HA 系統是採用 主動/主動 (啟用讀取) 設定部署。 |
hana_monitoring_configuration.queries.sql |
指定代理程式向 SAP HANA 執行個體發出的 SQL 陳述式。 SQL 陳述式必須符合 SAP 在 SAP HANA SQL 和系統檢視表參考資料中定義的 SQL 語法。 |
hana_monitoring_configuration.queries.sample_interval_sec |
(選用步驟) 指定 SQL 查詢的取樣間隔。這會覆寫全域取樣間隔。這個值必須等於或大於 5 秒。 |
hana_monitoring_configuration.queries.columns.name |
指定可用於識別每個資料欄的名稱。 資料欄名稱不得重複,因為這會用於在監控中建立指標的預設網址。 |
hana_monitoring_configuration.queries.columns.metric_type |
如要由 Monitoring 處理,請指定下列任一指標類型: 系統會將 |
hana_monitoring_configuration.queries.columns.value_type |
如要由監控處理,請指定指標類型支援的資料類型。 支援的資料類型如下: |
hana_monitoring_configuration.queries.columns.name_override |
(選用步驟) 如要由 Monitoring 處理,請指定要顯示在評估指標網址中的路徑,而非查詢和資料欄名稱。例如:
|
疑難排解
如要進一步瞭解如何診斷及解決安裝及設定 Google Cloud的 Agent for SAP 時可能遇到的問題,請參閱 Google Cloud的 Agent for SAP 疑難排解指南。
取得支援
如果您需要協助解決Google Cloud的 Agent for SAP 相關問題,請收集所有可用的診斷資訊,然後與 Cloud Customer Care 團隊聯絡。如要瞭解如何與 Customer Care 聯絡,請參閱「取得 SAP 支援」 Google Cloud。