saltext.sap_control._modules.sap_control#
SaltStack extension for sapcontrol Copyright (C) 2022 SAP UCC Magdeburg
sapcontrol execution module#
SaltStack execution module that wraps sapcontrol functions.
- codeauthor
Benjamin Wegener, Alexander Wilke
- maturity
new
- depends
zeep, requests
- platform
Linux
This module wraps different functions of the sapcontrol by calling the corresponding SOAP services. For controlling the state of the sapcontrol, you should create a custom systemd service and use the service module.
By default, the functions will try to connect to the SAP Host Agent over HTTPS on port 5##14 and can optionally fall back to HTTP communication on port 5##13.
Note
Because functions are called over SOAP, only authenticated requests are accepted.
Currently, only basic authentication (username/password) is implemented.
Note
This module was only tested on linux platforms.
- saltext.sap_control._modules.sap_control.__virtual__()[source]#
Only load this module if all libraries are available. Only work on POSIX-like systems.
- saltext.sap_control._modules.sap_control.status(instance_number, username, password, fallback=True, fqdn=None, **kwargs)[source]#
Retrieve the current status of sapcontrol.
- instance_number
Instance number for the sapcontrol instance.
- username
Username to use for connecting to sapcontrol.
- password
Password to use for connecting to sapcontrol.
- fallback
If set to
True
, a HTTP connection will be opened in case of HTTPS connection failures. Default isTrue
.- fqdn
The fully qualified domain name on which the sapcontrol instance is running. If none is given, the FQDN of the current host is used. Default is
None
.
CLI Example:
salt "*" sap_control.status instance_number="00" username="sapadm" password="Abcd1234"
- saltext.sap_control._modules.sap_control.start(sid, instance_number, username, password, timeout=60, **kwargs)[source]#
Starts sapcontrol for a given SID and instance number.
- sid
SID of the SAP system for which sapcontrol should be started.
- instance_number
Instance number for the sapcontrol instance.
- username
Username to use for connecting to sapcontrol.
- password
Password to use for connecting to sapcontrol.
- timeout
Timeout for sapcontrol to start. Default is
60
.
CLI Example:
salt "*" sap_control.start sid="S4H" instance_number="00" username="sapadm" password="Abcd1234"
- saltext.sap_control._modules.sap_control.stop(instance_number, username, timeout=60, **kwargs)[source]#
Stops sapcontrol for a given instance number.
- instance_number
Instance number for the sapcontrol instance.
- username
Username to use for connecting to sapcontrol.
- timeout
Timeout for sapcontrol to stop. Default is
60
.
CLI Example:
salt "*" sap_control.stop sid="S4H" instance_number="00" username="sapadm"
- saltext.sap_control._modules.sap_control.restart(sid, instance_number, username, password, fallback=True, fqdn=None, **kwargs)[source]#
Restarts sapcontrol for a given SID and instance number.
- sid
SID of the SAP system for which sapcontrol should be stopped.
- instance_number
Instance number for the sapcontrol instance.
- username
Username to use for connecting to sapcontrol.
- password
Password to use for connecting to sapcontrol.
- fallback
If set to
True
, a HTTP connection will be opened in case of HTTPS connection failures. Default isTrue
.- fqdn
The fully qualified domain name on which the sapcontrol instance is running. If none is given, the FQDN of the current host is used. Default is
None
.
CLI Example:
salt "*" sap_control.restart sid="S4H" instance_number="00" username="sapadm" password="Abcd1234"
- saltext.sap_control._modules.sap_control.instance_status(instance_number, username, password, fallback=True, fqdn=None, **kwargs)[source]#
Retrieves the status of an SAP instance based on the instance number.
- Returns one of the following status:
SAPCONTROL_GRAY = 1 => instance stopped SAPCONTROL_GREEN = 2 => instance running SAPCONTROL_YELLOW = 3 => instance starting / stopping SAPCONTROL_RED = 4 => instance error
- instance_number
Instance number for the sapcontrol instance.
- username
Username to use for connecting to sapcontrol.
- password
Password to use for connecting to sapcontrol.
- fallback
If set to
True
, a HTTP connection will be opened in case of HTTPS connection failures. Default isTrue
.- fqdn
The fully qualified domain name on which the sapcontrol instance is running. If none is given, the FQDN of the current host is used. Default is
None
.
CLI Example:
salt "*" sap_control.instance_status instance_number="00" username="sapadm" password="Abcd1234"
- saltext.sap_control._modules.sap_control.instance_start(instance_number, username, password, fallback=True, fqdn=None, timeout=300, **kwargs)[source]#
Starts an SAP instance based on the instance number.
- instance_number
Instance number for the sapcontrol instance.
- username
Username to use for connecting to sapcontrol.
- password
Password to use for connecting to sapcontrol.
- fallback
If set to
True
, a HTTP connection will be opened in case of HTTPS connection failures. Default isTrue
.- fqdn
The fully qualified domain name on which the sapcontrol instance is running. If none is given, the FQDN of the current host is used. Default is
None
.- timeout
Timeout for the instance to start. Default is
300
.
CLI Example:
salt "*" sap_control.instance_start instance_number="00" username="sapadm" password="Abcd1234"
- saltext.sap_control._modules.sap_control.instance_stop(instance_number, username, password, fallback=True, fqdn=None, timeout=300, **kwargs)[source]#
Stops an SAP instance based on the instance number.
- instance_number
Instance number for the sapcontrol instance.
- username
Username to use for connecting to sapcontrol.
- password
Password to use for connecting to sapcontrol.
- fallback
If set to
True
, a HTTP connection will be opened in case of HTTPS connection failures. Default isTrue
.- fqdn
The fully qualified domain name on which the sapcontrol instance is running. If none is given, the FQDN of the current host is used. Default is
None
.- timeout
Timeout for the instance to stop. Default is
300
.
CLI Example:
salt "*" sap_control.instance_stop instance_number="00" username="sapadm" password="Abcd1234"
- saltext.sap_control._modules.sap_control.system_start(instance_number, username, password, level='ALL', fallback=True, fqdn=None, timeout=300, **kwargs)[source]#
Starts an SAP system with a certain level.
- instance_number
Instance number for the sapcontrol instance.
- username
Username to use for connecting to sapcontrol.
- password
Password to use for connecting to sapcontrol.
- level
Configuration of the system to start, can be on of:
ALL|SCS|DIALOG|ABAP|J2EE|TREX|ENQREP|HDB|ALLNOHDB
. Default isALL
.- fallback
If set to
True
, a HTTP connection will be opened in case of HTTPS connection failures. Default isTrue
.- fqdn
The fully qualified domain name on which the sapcontrol instance is running. If none is given, the FQDN of the current host is used. Default is
None
.- timeout
Timeout for the system to start. Default is
300
.
Note
There is no implementation of WaitForStarted as a sapcontrol webservice.
CLI Example:
salt "*" sap_control.system_start instance_number="00" username="sapadm" password="Abcd1234"
- saltext.sap_control._modules.sap_control.system_stop(instance_number, username, password, level='ALL', fallback=True, fqdn=None, timeout=300, **kwargs)[source]#
Stops an SAP system with a certain level.
- instance_number
Instance number for the sapcontrol instance.
- username
Username to use for connecting to sapcontrol.
- password
Password to use for connecting to sapcontrol.
- level
Configuration of the system to stop, can be on of:
ALL|SCS|DIALOG|ABAP|J2EE|TREX|ENQREP|HDB|ALLNOHDB
. Default isALL
.- fallback
If set to
True
, a HTTP connection will be opened in case of HTTPS connection failures. Default isTrue
.- fqdn
The fully qualified domain name on which the sapcontrol instance is running. If none is given, the FQDN of the current host is used. Default is
None
.- timeout
Timeout for the system to stop. Default is
300
.
Note
There is no implementation of WaitForStarted as a sapcontrol webservice.
CLI Example:
salt "*" sap_control.system_stop instance_number="00" username="sapadm" password="Abcd1234"
- saltext.sap_control._modules.sap_control.get_system_instance_list(instance_number, username, password, fallback=True, fqdn=None, timeout=300, **kwargs)[source]#
Retrieve a list of system instances on the host.
- instance_number
Instance number for the sapcontrol instance.
- username
Username to use for connecting to sapcontrol.
- password
Password to use for connecting to sapcontrol.
- fallback
If set to
True
, a HTTP connection will be opened in case of HTTPS connection failures. Default isTrue
.- fqdn
The fully qualified domain name on which the sapcontrol instance is running. If none is given, the FQDN of the current host is used. Default is
None
.- timeout
Timeout to retrieve the list of system instances. Default is
300
.
CLI Example:
salt "*" sap_control.get_system_instance_list instance_number="00" username="sapadm" password="Abcd1234"
- saltext.sap_control._modules.sap_control.get_instance_properties(instance_number, username, password, fallback=True, fqdn=None, **kwargs)[source]#
Retrieve the properties for an SAP instance.
- instance_number
Instance number for the sapcontrol instance.
- username
Username to use for connecting to sapcontrol.
- password
Password to use for connecting to sapcontrol.
- fallback
If set to
True
, a HTTP connection will be opened in case of HTTPS connection failures. Default isTrue
.- fqdn
The fully qualified domain name on which the sapcontrol instance is running. If none is given, the FQDN of the current host is used. Default is
None
.
CLI Example:
salt "*" sap_control.get_instance_properties instance_number="00" username="sapadm" password="Abcd1234"
- saltext.sap_control._modules.sap_control.parameter_value(instance_number, parameter, username, password, fallback=True, fqdn=None, **kwargs)[source]#
Retrieve a parameter value from an SAP instance. Will return
(Success, Data)
, e.g.(<True|False>, <some_value>)
.- instance_number
Instance number for the sapcontrol instance.
- parameter
Parameter name to retrieve.
- username
Username to use for connecting to sapcontrol.
- password
Password to use for connecting to sapcontrol.
- fallback
If set to
True
, a HTTP connection will be opened in case of HTTPS connection failures. Default isTrue
.- fqdn
The fully qualified domain name on which the sapcontrol instance is running. If none is given, the FQDN of the current host is used. Default is
None
.
CLI Example:
salt "*" sap_control.parameter_value instance_number="00" parameter="icm/host_name_full" username="sapadm" password="Abcd1234"
- saltext.sap_control._modules.sap_control.get_abap_component_list(instance_number, username, password, fallback=True, fqdn=None, **kwargs)[source]#
Retrieve a list of ABAP components of a system.
Note
This of only works for SAP NetWeaver AS ABAP instances.
- instance_number
Instance number for the sapcontrol instance.
- username
Username to use for connecting to sapcontrol.
- password
Password to use for connecting to sapcontrol.
- fallback
If set to
True
, a HTTP connection will be opened in case of HTTPS connection failures. Default isTrue
.- fqdn
The fully qualified domain name on which the sapcontrol instance is running. If none is given, the FQDN of the current host is used. Default is
None
.
CLI Example:
salt "*" sap_control.get_abap_component_list instance_number="00" username="sapadm" password="Abcd1234"
- saltext.sap_control._modules.sap_control.process_status(instance_number, process_name, username, password, fallback=True, fqdn=None, **kwargs)[source]#
Retrieves the status of a process of an SAP instance.
- Returns one of the following status:
SAPCONTROL_GRAY = 1 => process stopped SAPCONTROL_GREEN = 2 => process running SAPCONTROL_YELLOW = 3 => process starting / stopping SAPCONTROL_RED = 4 => process error
- instance_number
Instance number for the sapcontrol instance.
- process_name
Name of the process for which the status should be retrieved.
- username
Username to use for connecting to sapcontrol.
- password
Password to use for connecting to sapcontrol.
- fallback
If set to
True
, a HTTP connection will be opened in case of HTTPS connection failures. Default isTrue
.- fqdn
The fully qualified domain name on which the sapcontrol instance is running. If none is given, the FQDN of the current host is used. Default is
None
.
CLI Example:
salt "*" sap_control.process_status instance_number="00" process_name="webdisp" username="sapadm" password="Abcd1234"
- saltext.sap_control._modules.sap_control.get_pid(instance_number, process_name, username, password, fallback=True, fqdn=None, timeout=300, **kwargs)[source]#
Retrieves the PID of an Process of an SAP instance.
- instance_number
Instance number for the sapcontrol instance.
- process_name
Name of the process for which the pid should be retrieved.
- username
Username to use for connecting to sapcontrol.
- password
Password to use for connecting to sapcontrol.
- fallback
If set to
True
, a HTTP connection will be opened in case of HTTPS connection failures. Default isTrue
.- fqdn
The fully qualified domain name on which the sapcontrol instance is running. If none is given, the FQDN of the current host is used. Default is
None
.
CLI Example:
salt "*" sap_control.get_pid instance_number="00" process_name="webdisp" username="sapadm" password="Abcd1234"
- saltext.sap_control._modules.sap_control.get_syslog_errors(timestamp_from, instance_number, username, password, severities=['SAPControl-RED'], fallback=True, fqdn=None, **kwargs)[source]#
Retrieves syslog entries for the system.
Note
This of only works for SAP NetWeaver AS ABAP instances.
- timestamp_from
Timestamp from which entries should be retrieved. Must be a datetime object or a string in the format
%Y-%m-%d %H:%M:%S
.- instance_number
Instance number for the sapcontrol instance.
- username
Username to use for connecting to sapcontrol.
- password
Password to use for connecting to sapcontrol.
- severities
List of severities for which entries should be retrieved. By default, this list only contains
SAPControl-RED
- fallback
If set to
True
, a HTTP connection will be opened in case of HTTPS connection failures. Default isTrue
.- fqdn
The fully qualified domain name on which the sapcontrol instance is running. If none is given, the FQDN of the current host is used. Default is
None
.
CLI Example:
salt "*" sap_control.get_syslog_errors timestamp_from="2022-12-31 14:59:38" instance_number="00" username="sapadm" password="Abcd1234"
- saltext.sap_control._modules.sap_control.get_workprocess_table(instance_number, username, password, fallback=True, fqdn=None, **kwargs)[source]#
Retrieves the current workprocess table for a given instance.
Note
This of only works for SAP NetWeaver AS ABAP instances.
- instance_number
Instance number for the sapcontrol instance.
- username
Username to use for connecting to sapcontrol.
- password
Password to use for connecting to sapcontrol.
- fallback
If set to
True
, a HTTP connection will be opened in case of HTTPS connection failures. Default isTrue
.- fqdn
The fully qualified domain name on which the sapcontrol instance is running. If none is given, the FQDN of the current host is used. Default is
None
.
CLI Example:
salt "*" sap_control.get_workprocess_table instance_number="00" username="sapadm" password="Abcd1234"