Package containing functions which interact or are related to sapcontrol
execution.
sapcontrol(instance_id=>'00',
webmethod=>'GetProcessList',
sidadm=>'pooadm',
[additional_args=>'someargument',
remote_execution=>$remote_execution]);
Executes sapcontrol webmethod for instance specified in arguments and returns exit code received from command. Allows remote execution of webmethods between instances, however not all webmethods are possible to execute in that manner. Function expects to be executed from an authorized user (sidadm or root).
Sapcontrol return codes:
RC 0 = webmethod call was successful
RC 1 = webmethod call failed
RC 2 = last webmethod call in progress (processes are starting/stopping)
RC 3 = all processes GREEN
RC 4 = all processes GREY (stopped)
instance_id 2 digit instance number
webmethod webmethod name to be executed (Ex: Stop, GetProcessList, ...)
additional_args additional arguments to be appended at the end of command
return_output returns output instead of RC
remote_hostname hostname of the target instance for remote execution. Local execution does not need this.
sidadm_password Password for sidadm user. Only required for remote execution.
sidadm sidadm user. Only required for remote execution.
sap_show_status_info(cluster=>1, netweaver=>1);
Prints output for standard set of commands to show info about system in various stages of the test for troubleshooting. It is possible to activate or deactivate various output sections by named args:
cluster - Shows cluster related outputs
netweaver - Shows netweaver related outputs
sapcontrol_process_check(expected_state=>expected_state,
[instance_id=>$instance_id,
loop_sleep=>$loop_sleep,
timeout=>$timeout,
wait_for_state=>$wait_for_state]);
Runs "sapcontrol -nr <INST_NO> -function GetProcessList" via SIDadm and compares RC against expected state. Croaks if state is not correct.
Expected return codes are:
RC 0 = webmethod call was successfull
RC 1 = webmethod call failed (This includes NIECONN_REFUSED status)
RC 2 = last webmethod call in progress (processes are starting/stopping)
RC 3 = all processes GREEN
RC 4 = all processes GREY (stopped)
expected_state State that is expected (failed, started, stopped)
instance_id Instance number - two digit number
loop_sleep sleep time between checks - only used if 'wait_for_state' is true
timeout timeout for waiting for target state, after which function croaks
wait_for_state If set to true, function will wait for expected state until success or timeout
get_instance_number(instance_type=>$instance_type);
Finds instance number from remote instance using sapcontrol "GetSystemInstanceList" webmethod. Local system instance number is required to execute sapcontrol though.
instance_type Instance type (ASCS, ERS) - this can be expanded to other instances