In the operation of the process, often to learn the status of WebLogic server to facilitate proactive maintenance, this article through the WebLogic Wlst script preliminary design
The script is about 2, one is Wlst's py script, getstates.py
Connect (' WebLogic ', ' weblogic12 ', ' localhost:7001 ') Serverruntime () State (' AdminServer ') |
The other is the SH script for Linux
#!/bin/bash . /home/weblogic/oracle/middleware/user_projects/domains/base_domain/bin/setdomainenv.sh cd/home/weblogic/wlst while [ True]; Do /bin/sleep java WebLogic. wlst/home/weblogic/wlst/getstates.py >/home/weblogic/wlst/result.log result=$ (grep "RUNNING"/home/weblogic/wlst/result.log | wc-l) echo "*************** $result" If ["$result" = "1"]; Then echo "Connecting successfully" Else echo "======= Connecting fail ========" Fi Done |
The script takes 1 minutes to access the WebLogic server's adminserver, obtains status information, and enters the results into Result.log
In the actual production environment, the basic can be set to 5 minutes or 10 minutes of regular access to
It is also important to note that in the network is not too stable state, it is recommended to modify the script, 5-minute access if the failure, and then 5 minutes to visit again, if the failure, and then wait 5 minutes to access again, if three times access
Failure, triggering subsequent operations.
Subsequent actions can be echo, or send an email, or call the API to send text messages to the phone's mode.
Test a bit, run not long to WebLogic server directly to stop, the output is as follows:
[Email protected] wlst]$ sh getstates.sh
1
Connecting successfully
1
Connecting successfully
1
Connecting successfully
1
Connecting successfully
Problem invoking Wlst-traceback (innermost last):
File "/home/weblogic/wlst/getstates.py", line 1, in?
File "<iostream>", line A, in Connect
File "<iostream>", line 552, in Raisewlstexception
Wlstexception:error occurred while performing connect:error getting the initial context. There is no server running at T3://localhost:7001:t3://localhost:7001:destination 0:0:0:0:0:0:0:1, 7001 unreachable; Nested exception is:
Java.net.ConnectException:Connection refused; No available Router to destination
Use DumpStack () to view the full stacktrace:
0
======= Connecting Fail ========
Regular access to scripts that WebLogic server returns status