IBM WebSphere Application Server wsadmin 在脚本中仅返回 6 个结果中的第一个结果
IBM WebSphere Application Server wsadmin returning only first result out of 6 in script
当尝试获取 WebSphere Application Server 中应用程序的状态时,我希望返回多个 mbean。但是,WAS 似乎只返回第一个结果并丢弃其余结果。
[wasadmin@servername01 ~]$ Run_wsadmin.sh -f wsadmin_Check_App_Status.py
WASX7209I: Connected to process "dmgr" on node PRDDMGR using SOAP connector; The type of process is: DeploymentManager
WASX7026W: String "type=Application,name=AMTApp,*" corresponds to 6 different MBeans; returning first one.
我 运行 的脚本如下所示:
app_name = AppName
app_status = AdminControl.completeObjectName('type=Application,name=' + app_name + ',*').split('\n')
for status in app_status :
print( status )
# end of For status in app_status
WebSphere 中是否有一些设置,或者我是否需要将一些特殊的库导入到我的脚本中?
根据 AdminControl.completeObjectName()
的文档
Use the completeObjectName command to create a string representation of a complete ObjectName value that is based on a fragment. This command does not communicate with the server to find a matching ObjectName value. If the system finds several MBeans that match the fragment, the command returns the first one.
因此该函数的行为符合预期。
改为:
在这种情况下,听起来您想使用 AdminControl.queryNames()
,它是为返回与您的查询匹配的结果列表而构建的。
例如:
app_name = AppName
app_status = AdminControl.queryNames('type=Application,name=' + app_name + ',*').split('\n')
for status in app_status :
print( status )
来源:Commands for the AdminControl object using wsadmin scripting
当尝试获取 WebSphere Application Server 中应用程序的状态时,我希望返回多个 mbean。但是,WAS 似乎只返回第一个结果并丢弃其余结果。
[wasadmin@servername01 ~]$ Run_wsadmin.sh -f wsadmin_Check_App_Status.py
WASX7209I: Connected to process "dmgr" on node PRDDMGR using SOAP connector; The type of process is: DeploymentManager
WASX7026W: String "type=Application,name=AMTApp,*" corresponds to 6 different MBeans; returning first one.
我 运行 的脚本如下所示:
app_name = AppName
app_status = AdminControl.completeObjectName('type=Application,name=' + app_name + ',*').split('\n')
for status in app_status :
print( status )
# end of For status in app_status
WebSphere 中是否有一些设置,或者我是否需要将一些特殊的库导入到我的脚本中?
根据 AdminControl.completeObjectName()
Use the completeObjectName command to create a string representation of a complete ObjectName value that is based on a fragment. This command does not communicate with the server to find a matching ObjectName value. If the system finds several MBeans that match the fragment, the command returns the first one.
因此该函数的行为符合预期。
改为:
在这种情况下,听起来您想使用 AdminControl.queryNames()
,它是为返回与您的查询匹配的结果列表而构建的。
例如:
app_name = AppName
app_status = AdminControl.queryNames('type=Application,name=' + app_name + ',*').split('\n')
for status in app_status :
print( status )
来源:Commands for the AdminControl object using wsadmin scripting