Technical Articles
Command line control for SAP Web Dispatcher
Web Dispatcher installations typically come in two variants: with and without SAP Start Service. The availability of command line control tools is slightly different between these two installation types. In this article, I want to explore some of the available tools and introduce a third-party (non-SAP) tool.
Standard tools
Controlling the sapwebdisp process with signals
USR1 Lowers the current trace level by oneUSR2 Raises the current trace level by oneINT Shutdown (If the sapwebdisp process is controlled by the SAP Start Service, a new process will likely be started immediately.)
sapntkill.exe -USR2 <pid>
Using the monitoring tool wdispmon
Usage: wdispmon<options> pf=<profile>with the following options:-version Display version info and exit-info Return status of ICM/WebDisp through shared memory-ping Return status of ICM/WebDisp with request/response-checkhealth Attach to ICM/WebDisp and return in case of error-a Maintain authentication file-function <function> call monitoring function (like sapcontrol)ICMGetThreadListICMGetConnectionListICMGetConnectionList2ICMGetProxyConnectionListICMGetCacheEntriesICMGetAllCacheEntries
SAP Start Service
SYNOPSISsapcontrol [-prot <protocol>][-trace <filename>][-debug][-user <user> <password>][-queryuser][-repeat <N> <D>][-format <format>][-host <hostname>]-nr <instance number>-function <webmethod> [parameter list]DESCRIPTIONControl and monitor SAP instances via WebService interface of SAP Start Service.OPTIONS-prot <protocol>Specify the protocol for the communication with the SAP instance.Available protocols are:NI_HTTP HTTP using SAP NI sockets (default, prefer Unix domain sockets)NI_HTTPS HTTPS using SAP NI sockets (prefer Unix domain sockets)GSOAP_HTTP HTTP using gsoap build in socketsWINHTTP HTTP using Windows winhttpWINHTTPS HTTPS using Windows winhttpPIPE Windows named pipes (on Unix same as NI_HTTP)-trace <filename>Trace SOAP request/response-debugWrite local trace to stderr-user <user> <password>OS user and password for Webservice authentication-queryuserQuery interactively for user and password-repeat <N> <D>Repeat webmethod call <N> times (-1=forever) with <D> sec delay-format <format>Specify the format for the output of the webmethod.Available formats are:list List output format (default)script Script output format-host <hostname>Host to connect to (default: localhost)
command | description |
StartService <SID>
|
Launches the start service. The Web Dispatcher instance must be started separately. |
StopService
|
Stops the start service, but not the Web Dispatcher instance. |
RestartService
|
|
StartSystem
|
A Web Dispatcher system usually consists of only one instance, so this command is equivalent to InstanceStart. |
StopSystem
|
Usually equivalent to InstanceStop. |
RestartSystem
|
|
GetSystemInstanceList [<timeout sec>]
|
Prints a list of instances known to this system. |
InstanceStart <hostname> <instance number>
|
Starts the instance with the given hostname and instance number. |
InstanceStop <hostname> <instance number> [<softtimeout sec>]
|
Stops the instance with the given hostname and instance number.
|
RestartInstance [<softtimeout sec>]
|
|
GetProcessList
|
Prints info about the sapwebdisp process, e.g. running status and pid. |
SendSignal <pid> <signal>
|
Sends an OS signal to the sapwebdisp process. The pid can be determined with GetProcessList. See previous section for a list of valid signals. |
GetVersionInfo
|
Determines release and patch level for Web Dispatcher and Start Service. |
GetEnvironment
|
Prints a list of the environment variables used by the Web Dispatcher system. |
GetStartProfile
|
Prints the start profile that is used by the start service. |
ParameterValue [<parameter>]
|
Prints a list of all profile parameters or one specific parameter. |
GetAccessPointList
|
Prints a list of access points (ports), including those of the start service. |
GetQueueStatistic
|
Prints request queue statistics (peak, max). |
ICMGetThreadList
|
Prints the status of all sapwebdisp threads, including the main thread, watchdog thread, and worker threads. |
ICMGetConnectionList
|
Prints a list of current front-end connections. (This does not include the connections to the back-end application servers.) |
ICMGetCacheEntries
|
Prints a list of cached entries (in case the Web Dispatcher has an active cache handler.) |
WebDispGetServerList
|
Prints a list of back-end application servers. |
ListDeveloperTraces
|
Prints a list of developer traces, including their file size and last modified time stamp. |
ReadDeveloperTrace <filename> <filesize>
|
Downloads and prints the specified developer trace. |
ABAPReadSyslog
|
Prints the content of the SYSLOG. |
ABAPReadRawSyslog
|
Prints the unformatted content of the SYSLOG. |
Third-party tools
wdcontrol
+ remote control over the network
+ one tool can attach to multiple Web Dispatcher installations
+ all commands available through the Admin Interface could be used
– the stability of the application depends on the stability of the Admin Interface; each time the interface changes, the application might require adaption or fail to work
– there is no official support by SAP
usage: wdcontrol.py [-h][–command {info,…}][–node NODE] [–stack {ABAP,J2EE,BOTH}] [–sid SID][–port PORT] [–admin ADMIN] [–proxy PROXY][–log {ERROR,WARN,INFO,DEBUG,OFF}] [–version][conf [conf …]]positional arguments:conf Configuration file(s) (default: wdcontrol.wdc)optional arguments:-h, –help show this help message and exit–command {info,…} Command (default: info)–node NODE Server node name (for ‘isNodeActive’ etc.)–stack {ABAP,J2EE,BOTH} Stack type (default: BOTH)–sid SID System ID (default: None)–port PORT Port number (for ‘isPortActive’ etc.)–admin ADMIN Web Admin Interface URL (format: http|https://user:pass@host[:port][/prefix])–proxy PROXY HTTP proxy used to connect to Web Admin Interface (format: host:port; default: None)–log {ERROR,WARN,INFO,DEBUG,OFF} log level (default: INFO)–version Print version information and exit
- All parameters for the connection to the Admin Interface go into the default configuration file wdcontrol.wdc:
{
“admin.host”: “my.wd.host.com”,
“admin.port”: 8000,
“admin.password”: “secret”
}
- All parameters to identify a specific instance go into one configuration file for each instance, e.g. DEV_J2EE3565100.wdc:
{
“node.name”: “J2EE3565100”,
“node.stack”: “J2EE”,
“system.id”: “DEV”
}
- Now it is easily possible to control instance related functions by using the configuration file and an appropriate command.
N.B.: The default configuration file wdcontrol.wdc does not have to be specified, as it is loaded automatically. Examples:wdcontrol.py DEV_J2EE3565100.wdc –command isNodeActive
All other commands that are not related to a specific instance can skip the configuration file. Examples:
wdcontrol.py –command refresh
wdcontrol.py –commmand isPortActive –port 8000
command | description |
info
|
Prints the status info for Web Dispatcher. |
enterMaintenance | Puts the Web Dispatcher into maintenance mode. |
leaveMaintenance | Puts the Web Dispatcher into normal mode. |
refresh | Triggers a refresh of the configuration (server info, …) |
shutdown | Sends a shutdown command to the Web Dispatcher. This will terminate the sapwebdisp process. If Web Dispatcher is controlled by SAP Start Service, it will likely be restarted immediately. |
downloadDefaultProfile | Downloads and prints the default profile. |
downloadInstanceProfile | Downloads and prints the instance profile. |
traceLevel0, traceLevel1, traceLevel2, traceLevel3 | Sets the trace level to 0, 1, 2, or 3, then prints the current level. |
downloadTrace | Downloads and prints the trace file dev_webdisp. |
listPorts | Prints a JSON formatted list of all known ports. |
isPortActive | Prints ‘True’/’False’ if the port is active/inactive. |
activatePort | Activates the port, then prints its status (see ‘isPortActive’.) |
deactivatePort | Deactivates the port, then prints its status (see ‘isPortActive’.) |
listNodes | Prints a JSON formatted list of all known application servers. |
isNodeActive | Prints ‘True’/’False’ if the application server is active/inactive. |
activateNode | Activates the application server, then prints its status (see ‘isNodeActive’.) |
deactivateNode | Deactivates the application server, then prints its status (see ‘isNodeActive’.) |
Hi Tobias,
that's an interesting blog.
We've written our own scripts for the simplest tasks of stopping and starting WebDispatchers but still use the Web Interface for removing Instances etc.
Thanks,
Andy.
Hello Tobias,
is the tool wdcontrol.py still available, I couldn't find it on GitHub?
Tks Hans-Martin
Hi Hans-Martin,
Did you ever find wdcontrol.py? Am looking for it myself as well.
Cheers,
Sander.