generated from terraform-ibm-modules/terraform-ibm-module-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support SAP monitoring on IBM Cloud Monitoring using prometheus…
… hana db exporter (#752) --------- Co-authored-by: stafaniasaju <[email protected]> Co-authored-by: surajsbharadwaj <[email protected]> Co-authored-by: surajsbharadwaj <[email protected]> Co-authored-by: Terraform IBM Modules Operations <[email protected]>
- Loading branch information
1 parent
6b08994
commit 9f37727
Showing
19 changed files
with
312 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
.../ansible/templates-ansible/configure-monitoring-sap/ansible_configure_monitoring.sh.tftpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
### Using input variables from terraform | ||
ansible_playbook=${ansible_playbook_file} | ||
ansible_log_path=${ansible_log_path} | ||
ansible_inventory=${ansible_inventory} | ||
ansible_private_key_file=${ansible_private_key_file} | ||
|
||
# shell to get the ibmcloud api token | ||
ibmcloud_auth_response=$(curl -X POST 'https://iam.cloud.ibm.com/identity/token' -H 'Content-Type: application/x-www-form-urlencoded' -d "apikey=$IBMCLOUD_API_KEY&grant_type=urn:ibm:params:oauth:grant-type:apikey") | ||
ibmcloud_iam_token=$(echo "$ibmcloud_auth_response" | jq -r '.access_token') | ||
|
||
# Create ansible.cfg file | ||
ansible_playbook_name=$(basename $${ansible_playbook}) | ||
echo -e "[defaults]\nhost_key_checking=False" >ansible.cfg | ||
export ANSIBLE_LOG_PATH=$${ansible_log_path}/$${ansible_playbook_name}.$(date "+%Y.%m.%d-%H.%M.%S").log | ||
export ANSIBLE_PRIVATE_KEY_FILE=$${ansible_private_key_file} | ||
|
||
#Execute ansible playbook | ||
unbuffer ansible-playbook -i $${ansible_inventory} $${ansible_playbook} --extra-vars ibmcloud_iam_token=$${ibmcloud_iam_token} --vault-password-file password_file | ||
if [ $? -ne 0 ]; then | ||
rm -rf $${ansible_private_key_file} | ||
exit 1 | ||
fi | ||
echo \"Playbook command successful\" | ||
rm -rf $${ansible_private_key_file} |
57 changes: 57 additions & 0 deletions
57
...le/templates-ansible/configure-monitoring-sap/playbook-configure-monitoring-sap.yml.tftpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# ------------------------------------------------------------------------ | ||
# This playbook uses the ibm.power_linux_sap collection. This collection is | ||
# available on ansible galaxy | ||
# https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/ and can | ||
# be installed using 'ansible-galaxy collection install ibm.power_linux_sap' | ||
# ------------------------------------------------------------------------ | ||
|
||
--- | ||
- name: SAP monitoring configuration | ||
hosts: all | ||
become: true | ||
vars: | ||
|
||
## variable group: monitoring meta parameters | ||
sap_monitoring_action: '${sap_monitoring_action}' | ||
config_override: '${config_override}' | ||
sap_monitoring_nr: '${sap_monitoring_nr}' | ||
sap_monitoring_solution_name: '${sap_monitoring_solution_name}' | ||
sap_tools_directory: '${sap_tools_directory}' | ||
|
||
## variable group: hana parameters | ||
sap_hana_ip: '${sap_hana_ip}' | ||
sap_hana_http_port: '${sap_hana_http_port}' | ||
sap_hana_sql_systemdb_port: '${sap_hana_sql_systemdb_port}' | ||
sap_hana_sql_systemdb_user: '${sap_hana_sql_systemdb_user}' | ||
sap_hana_sql_systemdb_password: '${sap_hana_sql_systemdb_password}' | ||
|
||
## variable group: application server parameters | ||
sap_ascs_ip: '${sap_ascs_ip}' | ||
sap_ascs_http_port: '${sap_ascs_http_port}' | ||
sap_app_server: ${sap_app_server} | ||
|
||
## variable group: IBM cloud parameters | ||
ibmcloud_monitoring_instance_url: '${ibmcloud_monitoring_instance_url}' | ||
ibmcloud_monitoring_request_credential_url: '${ibmcloud_monitoring_request_credential_url}' | ||
ibmcloud_monitoring_instance_guid: '${ibmcloud_monitoring_instance_guid}' | ||
|
||
tasks: | ||
# use token to get the monitoring auth cred | ||
- name: Obtain IBM Cloud IAM token | ||
ansible.builtin.uri: | ||
url: "{{ ibmcloud_monitoring_request_credential_url }}" | ||
method: GET | ||
headers: | ||
Content-Type: application/json | ||
IBMInstanceID: "{{ ibmcloud_monitoring_instance_guid }}" | ||
Authorization: "Bearer {{ ibmcloud_iam_token }}" | ||
return_content: yes | ||
register: response | ||
|
||
- name: Set fact for IBM Cloud Monitoring authorization credentials | ||
ansible.builtin.set_fact: | ||
ibmcloud_monitoring_authorization_credentials: "{{ response.json.token.key }}" | ||
|
||
- name: Execute monitoring role for SAP | ||
ansible.builtin.include_role: | ||
name: ibm.power_linux_sap.monitoring_sap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
${monitoring_host_ip} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nce-architectures/sap-s4hana-bw4hana/deploy-arch-ibm-pvs-sap-s4hana-bw4hana.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.