saltext.sap_control._states.sap_control#
SaltStack extension for sapcontrol Copyright (C) 2022 SAP UCC Magdeburg
sapcontrol state module#
SaltStack module that implements states based on sapcontrol functionality.
- codeauthor
Benjamin Wegener, Alexander Wilke
- maturity
new
- depends
N/A
- platform
Linux
This module implements states that utilize sapcontrol functionality.
Note
This module can only run on linux platforms.
- saltext.sap_control._states.sap_control.running(name, instance, username, password, restart=False, **kwargs)[source]#
Ensure that sapcontrol is started for an SID / instance.
- name
The SID for which sapcontrol should be running.
- instance
The instance for which sapcontrol should be running.
- username
User with which to run all operations.
- password
Passwort for the user.
- restart
Boolean if sapcontrol should be restarted if it is already running, defualt is
False
.
Example:
sapcontrol for S4H / instance 00 is running: sap_control.running: - name: S4H - instance: '00' - username: sapadm - password: __slot__:salt:vault.read_secret(path="os", key="sapadm")
Note
This should not be used. Instead, a proper systemd service should be created that handles sapcontrol.
- saltext.sap_control._states.sap_control.dead(name, instance, username, password, **kwargs)[source]#
Ensure that sapcontrol is stopped for an SID / instance.
- name
The SID for which sapcontrol should be stopped.
- instance
The instance for which sapcontrol should be stopped.
- username
User with which to run all operations.
- password
Passwort for the user.
Example:
sapcontrol for S4h / instance 00 is stopped: sap_control.dead: - name: S4H - instance: '00' - username: sapadm - password: __slot__:salt:vault.read_secret(path="os", key="sapadm")
Note
This should not be used. Instead, a proper systemd service should be created that handles sapcontrol.
- saltext.sap_control._states.sap_control.sld_registered(name, sid, instance_number, username, password, sld_user, sld_password, sld_host, sld_port, log_files=None, remove_logs=True, overwrite=False, sld_check_timeout=60, **kwargs)[source]#
Ensure that a sapcontrol instance is registered at an SLD / LMDB. If log files are defined (see argument
log_files
), then each file will be checked for a correct HTTP return code.- name
Target slddest.cfg file.
- sid
SID of the system.
- instance_number
Instance number for which the SLD registration should take place.
- username
Username for the sapcontrol connection.
- password
Password for the sapcontrol connection.
- sld_user
SLD connection username.
- sld_password
SLD connection password.
- sld_host
SLD connection fqdn.
- sld_port
SLD connection port.
- log_files
List of log files to check for success (full path).
- remove_logs
Remove the logs before restarting the service. Default is
True
.- overwrite
Configuration will not be checked but overwritten. Default is
False
.- sld_check_timeout
How long the system will wait for a positive HTTP return code from the SLD in the defined logs. Default is
60
.
Warning
In order to trigger the data transfer, sapcontrol will be restarted!
Note
No password check will be performed if all other configuration parameters fit. To circumvent this, set overwrite=True.
Example:
SLD is configured and data is transfered for S4H / 00: sap_control.sld_registered: - name: /usr/sap/S4H/SYS/global/slddest.cfg - sid: S4H - instance_number: '00' - username: s4hadm - password: __slot__:salt:vault.read_secret(path="os", key="s4hadm") - sld_user: SLD_DS_USER - sld_password: __slot__:salt:vault.read_secret(path="sld", key="SLD_DS_USER") - sld_host: sol.my.domain - sld_port: 50000 - log_files: - /usr/sap/S4H/D00/work/dev_sldregs - /usr/sap/S4h/D00/work/dev_sldregk - /usr/sap/S4H/D00/work/dev_krnlreg
- saltext.sap_control._states.sap_control.system_health_ok(name, check_from, instance_number, username, password, **kwargs)[source]#
This state checks the system health by looking for Critical Syslog Entries and Work Process Errors. If errors are present in the system, the state will return
False
as result.- name
SID of the SAP system.
- check_from
Date from which on the system health should be checked (e.g. for log entries) in the format 31129999 or 01012000.
- instance_number
Instance number for which syslog errors should be retrieved.
- username
Username for the sapcontrol connection.
- password
Password for the sapcontrol connection.
Note
This state does not implement
__opts__["test"]
since no data is changed.Example:
System healh is OK for SAP NetWeaver AS ABAP system S4H (SM50 / SM21): sap_control.system_health_ok: - name: 'S4H' - check_from: {{ None | strftime("%d%m%Y") }} {# renders to current date, e.g. 31082002 #} - instance_number: '00' - username: s4hadm - password: __slot__:salt:vault.read_secret(path="os", key="s4hadm")