国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

Weblogic中間件DOMAIN域(Server,JDBC)配置信息一鍵獲取

IT那活兒 / 3192人閱讀
Weblogic中間件DOMAIN域(Server,JDBC)配置信息一鍵獲取

點擊上方“IT那活兒”,關注后了解更多精彩內容!!

Weblogic簡介

Oracle WebLogic Server 是一個統一的可擴展平臺,專用于開發、部署和運行 Java 應用等適用于本地環境和云環境的企業應用。它提供了一種強健、成熟和可擴展的 Java Enterprise Edition (EE) 和 Jakarta EE 實施方式。

背景說明

近期客戶要求對現有系統的Weblogic中間件DOMAIN域(Server,JDBC)配置信息進行采集分析。以便于對DOMAIN域(Server,JDBC)配置進行規范化、統一化配置管理,以及協助問題定位等。

采集指標

Server配置信息:

  • AdminServer名稱

  • 控制臺地址上下文

  • 域的版本

  • 域的路徑

  • Server名稱

  • 監聽地址

  • 監聽端口

  • SSL監聽端口

  • 是否啟用IIOP (1:啟用,0:未啟用)

  • 粘滯線程最長時間

  • ...

JDBC配置信息:

  • 數據源名稱

  • 數據源的目標服務器

  • 數據源的URL

  • 數據源屬性配置

  • 初始容量

  • 最大容量

  • 最小容量

  • 開啟保留時測試連接 (1:啟用,0:未啟用)

  • 測試頻率(秒數)

  • 收縮頻率(秒數)

  • 非活動連接超時秒數

  • ...

采集方案

WebLogic 腳本工具(WLST)是一個命令行腳本環境,您可以用它來創建、管理和監控 WebLogic 域。它基于Java腳本解釋器,Jython。除了支持標準的 Jython 功能(如本地變量、條件變量和流量控制語句)外,WLST 還提供一組特定于 WebLogic 服務器的腳本功能(命令)。您可以按照 Jython 語言語法擴展 WebLogic 腳本語言以滿足您的需求。

接下來,我們將用一組腳本來進行說明:

1. weblogic_getparams.sh(實現采集總體框架)

2. weblogic_getparams.py(實現Weblogic指標數據采集)

3. auth_info.cfg(配置Weblogic控制臺登錄授權信息)

4. 采集結果文件:

result_wls_params.txt

result_jdbc_params.txt

實現腳本

1. weblogic_getparams.sh

#!/bin/bash

##. $HOME/.bash_profile

## Check parameters

if [ $# -eq 2 ]

then

## The Weblogic Product install directory

WLS_HOME=$1

## The Weblogic Console authorization info

AUTH_FILE=$2

else

echo "###########################################################################################################"

echo "usage: sh $0 WLS_HOME AUTH_FILE"

echo "eg1: sh $0 /weblogic/Oracle/Middleware/wlserver_10.3 auth_info.cfg"

echo

echo "function description:"

echo "Get weblogic server config parameters"

echo "The "WLS_HOME" : The Weblogic Product install directory (grep "WL_HOME=" setDomainEnv.sh)."

echo "The "AUTH_FILE" : The Weblogic Console authorization file (eg: /weblogic/shell/maintain/auth_info.cfg)."

echo

echo "Platform :All Linux Based Platform and HP-UX"

echo "version: 1.0"

echo "author: sunchangcheng@shsnc.com"

echo "create: 2021-12-20."

echo "###########################################################################################################"

exit

fi

## Define variable

WORK_HOME=$(dirname $(readlink -f "$0"))

PYTHON_SCRIPT="${WORK_HOME}/weblogic_getparams.py"

WLS_PARAMS_FILE="${WORK_HOME}/result_wls_params.txt"

JDBC_PARAMS_FILE="${WORK_HOME}/result_jdbc_params.txt"

if [ -f "${WLS_HOME}" ]

then

echo [`date +%Y-%m-%d %H:%M:%S`]" The WLS_HOME [${WLS_HOME}] is non-exist, exit !"

exit

fi

echo [`date +%Y-%m-%d %H:%M:%S`]" ======================[BEGIN]====================================================="

# Use wlst.sh to execute pyhton shell

${WLS_HOME}/common/bin/wlst.sh ${PYTHON_SCRIPT} ${AUTH_FILE} ${WLS_PARAMS_FILE} ${JDBC_PARAMS_FILE}

echo [`date +%Y-%m-%d %H:%M:%S`]" ======================[END]======================================================="

2. weblogic_getparams.py

## Get weblogic server config parameters

# encoding:utf-8


AUTH_FILE = sys.argv[1]

WLS_PARAMS_FILE = sys.argv[2]

JDBC_PARAMS_FILE = sys.argv[3]


focfg = open(AUTH_FILE, "rb")

fowlstxt = open(WLS_PARAMS_FILE, "wb")

fojdbctxt = open(JDBC_PARAMS_FILE, "wb")


########################################################

##獲取WLS相關配置信息

def getWLSparams():

print >>fowlstxt, "%-s" % ("========================================================================================================================")

##監聽地址

AdminServerName = cmo.getAdminServerName()


##AdminServer名稱

print >>fowlstxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,AdminServerName,"AdminServerName",cmo.getAdminServerName())


##AdminServer協議

print >>fowlstxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,AdminServerName,"AdministrationProtocol",cmo.getAdministrationProtocol())


##控制臺地址上下文

print >>fowlstxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,AdminServerName,"ConsoleContextPath",cmo.getConsoleContextPath())


##域的版本

print >>fowlstxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,AdminServerName,"DomainVersion",cmo.getDomainVersion())


##域的名稱

print >>fowlstxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,AdminServerName,"DomainName",cmo.getName())


##域的路徑

print >>fowlstxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,AdminServerName,"DomainHome",cmo.getRootDirectory())


servers=cmo.getServers()

for server in servers:

print >>fowlstxt, "%-s" % ("----------------------------------------------------------------------------------------------------")


##Server名稱

serverName=server.getName()

print >>fowlstxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,serverName,"ServerName",server.getName())


##監聽地址

print >>fowlstxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,serverName,"ListenAddress",server.getListenAddress())


##啟用監聽端口

print >>fowlstxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,serverName,"ListenPortEnabled",server.isListenPortEnabled())


##監聽端口

print >>fowlstxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,serverName,"ListenPort",server.getListenPort())


##啟用SSL監聽端口

print >>fowlstxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,serverName,"SSLListenPortEnabled",server.getSSL().isEnabled())


##SSL監聽端口

print >>fowlstxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,serverName,"SSLListenPort",server.getSSL().getListenPort())


##啟用IIOP

print >>fowlstxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,serverName,"IIOPEnabled",server.isIIOPEnabled())


##啟用本地IO

print >>fowlstxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,serverName,"NativeIOEnabled",server.isNativeIOEnabled())


##默認隊列中可以用作套接字讀取器的執行線程的百分比

print >>fowlstxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,serverName,"ThreadPoolPercentSocketReaders",server.getThreadPoolPercentSocketReaders())


##最大打開套接字數

print >>fowlstxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,serverName,"MaxOpenSockCount",server.getMaxOpenSockCount())


##粘滯線程最長時間

print >>fowlstxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,serverName,"StuckThreadMaxTime",server.getStuckThreadMaxTime())


##粘滯線程計時器間隔

print >>fowlstxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,serverName,"StuckThreadTimerInterval",server.getStuckThreadTimerInterval())


##應該允許的積壓的新TCP連接請求的數量

print >>fowlstxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,serverName,"AcceptBacklog",server.getAcceptBacklog())


##獲取JDBC相關配置信息

def getJDBCparams():

dataSources=cmo.getJDBCSystemResources()



for dataSource in dataSources:

print >>fojdbctxt, "%-s" % ("----------------------------------------------------------------------------------------------------")


##數據源名稱

jdbcName=dataSource.getName()

print >>fojdbctxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,jdbcName,"JdbcName",jdbcName)


##數據源配置文件路徑

print >>fojdbctxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,jdbcName,"SourcePath",dataSource.getSourcePath())


##數據源的目標服務器

targets=dataSource.getTargets()

for target in targets:

print >>fojdbctxt, "%-25s- %-20s- %-40s: %s" % (adminurl,jdbcName,"Targets",target.getName())


cd("/JDBCSystemResources/"+jdbcName+"/JDBCResource/"+jdbcName+"/JDBCDriverParams/"+jdbcName)

##數據庫的URL

print >>fojdbctxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,jdbcName,"Url",cmo.getUrl())

##驅動程序類名稱

print >>fojdbctxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,jdbcName,"DriverName",cmo.getDriverName())


###數據源屬性配置

cd("/JDBCSystemResources/"+jdbcName+"/JDBCResource/"+jdbcName+"/JDBCDriverParams/"+jdbcName+"/Properties/"+jdbcName)

properties=cmo.getProperties()

for proper in properties:

print >>fojdbctxt, "%-25s- %-20s- %-40s: %s=%-s" % (adminurl,jdbcName,"Properties",proper.getName(),proper.getValue())



cd("/JDBCSystemResources/"+jdbcName+"/JDBCResource/"+jdbcName+"/JDBCConnectionPoolParams/"+jdbcName)

##初始容量

print >>fojdbctxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,jdbcName,"InitialCapacity",cmo.getInitialCapacity())

##最大容量

print >>fojdbctxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,jdbcName,"MaxCapacity",cmo.getMaxCapacity())

##最小容量

print >>fojdbctxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,jdbcName,"MinCapacity",cmo.getMinCapacity())


##語句高速緩存類型

print >>fojdbctxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,jdbcName,"StatementCacheType",cmo.getStatementCacheType())

##語句高速緩存大小

print >>fojdbctxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,jdbcName,"StatementCacheSize",cmo.getStatementCacheSize())


##保留時測試連接

print >>fojdbctxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,jdbcName,"TestConnectionsOnReserve",cmo.isTestConnectionsOnReserve())

##測試頻率(秒數)

print >>fojdbctxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,jdbcName,"TestFrequencySeconds",cmo.getTestFrequencySeconds())

##測試表表名

print >>fojdbctxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,jdbcName,"TestTableName",cmo.getTestTableName())



##信任空閑池連接的(秒數)

print >>fojdbctxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,jdbcName,"SecondsToTrustAnIdlePoolConnection",cmo.getSecondsToTrustAnIdlePoolConnection())

##收縮頻率(秒數)

print >>fojdbctxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,jdbcName,"ShrinkFrequencySeconds",cmo.getShrinkFrequencySeconds())

##重試創建連接的頻率(秒數)

print >>fojdbctxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,jdbcName,"ConnectionCreationRetryFrequencySeconds",cmo.getConnectionCreationRetryFrequencySeconds())

##登錄延遲

print >>fojdbctxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,jdbcName,"LoginDelaySeconds",cmo.getLoginDelaySeconds())

##非活動連接超時秒數

print >>fojdbctxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,jdbcName,"InactiveConnectionTimeoutSeconds",cmo.getInactiveConnectionTimeoutSeconds())

##最大等待連接數

print >>fojdbctxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,jdbcName,"HighestNumWaiters",cmo.getHighestNumWaiters())

##連接保留超時(秒數)

print >>fojdbctxt, "%-25s- %-20s- %-40s: %-s" % (adminurl,jdbcName,"ConnectionReserveTimeoutSeconds",cmo.getConnectionReserveTimeoutSeconds())



############################################################

for authinfo in focfg:

autharray = authinfo.split(",")

if len(autharray) < 3:

continue


###cfgfile = autharray[0].strip()

###keyfile = autharray[1].strip()

###adminurl = autharray[2].strip()


###connect(userConfigFile=cfgfile,userKeyFile=keyfile,url=adminurl)

UserName = autharray[0].strip()

PassWord = autharray[1].strip()

AdminUrl = autharray[2].strip()



connect(UserName,PassWord,AdminUrl)


##獲取WLS相關配置信息

getWLSparams()

##獲取JDBC相關配置信息

getJDBCparams()


disconnect()


focfg.close()

fowlstxt.close()

fojdbctxt.close()


exit()

3. auth_info.cfg

weblogic,password,t3://10.243.*.*:7011

weblogic,password,t3://10.243.*.*:7012

weblogic,password,t3://10.243.*.*:7013

注:控制臺登錄授權信息也可以通過wlst自帶的storeUserConfig()方法進行加密處理,具體使用方法可百度搜索查看。

4. 采集結果樣例

4.1 result_wls_params.txt

格式說明:以冒號”:”分割

URL:ServerName:屬性名稱:屬性值

4.2 result_jdbc_params.txt

格式說明:以冒號”:”分割

URL:JDBC名稱:屬性名稱:屬性值


本 文 原 創 來 源:IT那活兒微信公眾號(上海新炬王翦團隊)


文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。

轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/129676.html

相關文章

發表評論

0條評論

IT那活兒

|高級講師

TA的文章

閱讀更多
最新活動
閱讀需要支付1元查看
<