Regular access to scripts that WebLogic server returns status

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.