Skip to content

Commit

Permalink
fix sap_host_exporter to run on both HA nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
yeoldegrove committed Jul 5, 2021
1 parent 7b947df commit 68970c9
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions netweaver/monitoring.sls
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ prometheus_sap_host_exporter_pkg:
- name: prometheus-sap_host_exporter
# the sid, instance number pair of a node is unique, so we need to adapt configuration
{% for node in netweaver.nodes if host == node.host and node.sap_instance != "db" %}
# do not create configuration for "sap_instance: db"
{% for node in netweaver.nodes if node.sap_instance != "db" %}
# create ASCS|ERS|PAS|AAS configuration in non-HA use case
# OR create both ASCS and ERS configuration in HA use case
# AND deploy PAS exporter on ASCS/PAS host if no dedicated PAS host is used
{% if (not netweaver.ha_enabled and host == node.host) or (netweaver.ha_enabled and (node.sap_instance in ['ascs', 'ers'] or host == node.host)) %}
{% set sap_instance_nr = '{:0>2}'.format(node.instance) %}
{% set exporter_instance = '{}_{}{}'.format(node.sid, node.sap_instance.upper(), sap_instance_nr) %}
{% set instance_name = node.sid~'_'~sap_instance_nr %}
Expand All @@ -20,17 +25,22 @@ sap_host_exporter_configuration_{{ exporter_instance }}:
sap-control-uds: /tmp/.sapstream5{{ sap_instance_nr }}13
- require:
- pkg: prometheus_sap_host_exporter_pkg
- netweaver_install_{{ instance_name }}
# do not run ASCS and ERS exporter service in HA use case (handled by pacemaker)
# only run PAS exporter in HA use case (if no dedicated PAS host is used)
{% if not netweaver.ha_enabled or node.sap_instance == 'pas' %}
sap_host_exporter_service_{{ exporter_instance }}:
service.running:
- name: prometheus-sap_host_exporter@{{ exporter_instance }}
- enable: {{ not netweaver.ha_enabled }}
- enable: True
- restart: True
- require:
- netweaver_install_{{ instance_name }}
- pkg: prometheus_sap_host_exporter_pkg
- file: sap_host_exporter_configuration_{{ exporter_instance }}
- watch:
- file: sap_host_exporter_configuration_{{ exporter_instance }}
{% endif %}
{% endif %}
{% endfor %}

0 comments on commit 68970c9

Please sign in to comment.