| Author |
Message |
Alan Tang
Guest
|
Posted:
Mon Nov 07, 2005 9:51 am Post subject:
PU/LU Status |
|
|
Hello:
Does any tools that can monitoring the PU/LU status? Does any command that
get the PU/LU status from CLI?
Thanks a lot! |
|
| Back to top |
|
 |
Neil Pike
Guest
|
Posted:
Mon Nov 07, 2005 5:51 pm Post subject:
Re: PU/LU Status |
|
|
Alan - assuming you're on HIS2000 or above (i.e. not SNA 4), then you can use
WMI/VBScript to enquire on this.
You can kick off VBScript from the CLI using CSCRIPT so that should do you
| Quote: | Does any tools that can monitoring the PU/LU status? Does any command that
get the PU/LU status from CLI?
Thanks a lot!
|
Neil Pike. Protech Computing Ltd
Microsoft SNA/HIS MVP |
|
| Back to top |
|
 |
Alan Tang
Guest
|
Posted:
Tue Nov 08, 2005 9:51 am Post subject:
Re: PU/LU Status |
|
|
Would you mind to kindly let me know does any sample I can have reference?
Thanks a lot!
"Neil Pike" wrote:
| Quote: | Alan - assuming you're on HIS2000 or above (i.e. not SNA 4), then you can use
WMI/VBScript to enquire on this.
You can kick off VBScript from the CLI using CSCRIPT so that should do you
Does any tools that can monitoring the PU/LU status? Does any command that
get the PU/LU status from CLI?
|
|
|
| Back to top |
|
 |
Charles Ezzell (MSFT)
Guest
|
Posted:
Tue Nov 08, 2005 1:51 pm Post subject:
Re: PU/LU Status |
|
|
Alan,
Here are a few. All tested on HIS 2004.
all are VBScript (use cscript.exe to launch) except the last 2 (VB.NET and
C# samples).
**** BEGIN CUT ****
' connection status
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\MicrosoftHIS")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM MsSnaStatus_Connection",,48)
For Each objItem in colItems
Wscript.Echo "-----------------------------------"
Wscript.Echo "MsSnaStatus_Connection instance"
Wscript.Echo "-----------------------------------"
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "ServiceName: " & objItem.ServiceName
Wscript.Echo "StatusText: " & objItem.StatusText
Next
**** END CUT ****
**** BEGIN CUT ****
' Lu status
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\MicrosoftHIS")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM MsSnaStatus_Lu3270",,48)
For Each objItem in colItems
Wscript.Echo "-----------------------------------"
Wscript.Echo "MsSnaStatus_Lu3270 instance"
Wscript.Echo "-----------------------------------"
Wscript.Echo "ConnectionName: " & objItem.ConnectionName
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "StatusText: " & objItem.StatusText
Next
**** END CUT ****
**** BEGIN CUT ****
' display pool assigned to user
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\MicrosoftHIS")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM MsSna_PoolDisplayAssignedToUser",,48)
For Each objItem in colItems
Wscript.Echo "-----------------------------------"
Wscript.Echo "MsSna_PoolDisplayAssignedToUser instance"
Wscript.Echo "-----------------------------------"
Wscript.Echo "PathToPoolDisplay: " & objItem.PathToPoolDisplay
Wscript.Echo "PathToUser: " & objItem.PathToUser
Next
**** END CUT ****
**** BEGIN CUT ****
' returns client application name, user name/domain, machine name connected
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\MicrosoftHIS")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM MsSnaStatus_ClientConnection",,48)
For Each objItem in colItems
Wscript.Echo "-----------------------------------"
Wscript.Echo "MsSnaStatus_ClientConnection instance"
Wscript.Echo "-----------------------------------"
Wscript.Echo "ClientAppl: " & objItem.ClientAppl
Wscript.Echo "ClientMachine: " & objItem.ClientMachine
Wscript.Echo "Domain: " & objItem.Domain
Wscript.Echo "User: " & objItem.User
Next
**** END CUT ****
**** BEGIN CUT ****
'VB.NET sample to return connection status
Imports System
Imports System.Management
Imports System.Windows.Forms
Namespace WMISample
Public Class MyWMIQuery
Public Overloads Shared Function Main() As Integer
Try
Dim searcher As New ManagementObjectSearcher( _
"root\MicrosoftHIS", _
"SELECT * FROM MsSnaStatus_Connection")
For Each queryObj As ManagementObject in searcher.Get()
Console.WriteLine("-----------------------------------")
Console.WriteLine("MsSnaStatus_Connection instance")
Console.WriteLine("-----------------------------------")
Console.WriteLine("Name: {0}", queryObj("Name"))
Console.WriteLine("ServiceName: {0}",
queryObj("ServiceName"))
Console.WriteLine("StatusText: {0}",
queryObj("StatusText"))
Next
Catch err As ManagementException
MessageBox.Show("An error occurred while querying for WMI
data: " & err.Message)
End Try
End Function
End Class
End Namespace
**** END CUT ****
**** BEGIN CUT ****
' C# sample to return connection status
using System;
using System.Management;
using System.Windows.Forms;
namespace WMISample
{
public class MyWMIQuery
{
public static void Main()
{
try
{
ManagementObjectSearcher searcher =
new ManagementObjectSearcher("root\\MicrosoftHIS",
"SELECT * FROM MsSnaStatus_Connection");
foreach (ManagementObject queryObj in searcher.Get())
{
Console.WriteLine("-----------------------------------");
Console.WriteLine("MsSnaStatus_Connection instance");
Console.WriteLine("-----------------------------------");
Console.WriteLine("Name: {0}", queryObj["Name"]);
Console.WriteLine("ServiceName: {0}",
queryObj["ServiceName"]);
Console.WriteLine("StatusText: {0}",
queryObj["StatusText"]);
}
}
catch (ManagementException e)
{
MessageBox.Show("An error occurred while querying for WMI
data: " + e.Message);
}
}
}
}
**** END CUT ****
--
HTH,
Charles Ezzell
Microsoft
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Alan Tang" <AlanTang@discussions.microsoft.com> wrote in message
news:E7FC87C8-8EBB-4796-A4D1-D96BA0A3B254@microsoft.com...
| Quote: | Would you mind to kindly let me know does any sample I can have reference?
Thanks a lot!
"Neil Pike" wrote:
Alan - assuming you're on HIS2000 or above (i.e. not SNA 4), then you
can use
WMI/VBScript to enquire on this.
You can kick off VBScript from the CLI using CSCRIPT so that should do
you
Does any tools that can monitoring the PU/LU status? Does any command
that
get the PU/LU status from CLI?
|
|
|
| Back to top |
|
 |
Neil Pike
Guest
|
Posted:
Tue Nov 08, 2005 1:51 pm Post subject:
Re: PU/LU Status |
|
|
Alan,
I'm off-line at the mo, so can't test any of the samples I have stored. I'll do a
quick test later today once I'm connected up at a client site so I make sure I send
you a working one with no typoes!
| Quote: | Would you mind to kindly let me know does any sample I can have reference?
Thanks a lot!
|
Neil Pike. Protech Computing Ltd
Microsoft SNA/HIS MVP |
|
| Back to top |
|
 |
Alan Tang
Guest
|
Posted:
Thu Nov 10, 2005 1:52 am Post subject:
Re: PU/LU Status |
|
|
Hello:
Very thanks for your kindly help. If I would like to learn more, would you
mind to give me some url link that I can have more reference on HIS Object in
VB script?
Thanks a lot!
"Charles Ezzell (MSFT)" wrote:
| Quote: | Alan,
Here are a few. All tested on HIS 2004.
all are VBScript (use cscript.exe to launch) except the last 2 (VB.NET and
C# samples). |
|
|
| Back to top |
|
 |
Charles Ezzell (MSFT)
Guest
|
Posted:
Thu Nov 10, 2005 5:51 pm Post subject:
Re: PU/LU Status |
|
|
Alan,
There is not "much" documented, other than what is in the online
documentation. The link in the documentation is below (open up the docs, and
paste this in the link)
ms-help://HIS_2004/HIS_2004Main/htm/his_dg_wmi_scripting_guide_ngvf.htm
For WMI in general, MSDN, is the best source, and there are some good
samples for VBScript given.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/anch_wmi.asp
Scripting is also covered in Technet:
http://www.microsoft.com/technet/scriptcenter/default.mspx
I favor the "Scripting Guys" columns....
http://www.microsoft.com/technet/scriptcenter/resources/qanda/default.mspx
Personally, I use a few tools for testing (wbemtest.exe) and these:
Scriptomatic 2.0
http://www.microsoft.com/technet/scriptcenter/tools/scripto2.mspx
WMI Code Creator
http://www.microsoft.com/downloads/details.aspx?FamilyID=2cc30a64-ea15-4661-8da4-55bbc145c30e&DisplayLang=en
The 2 tools above are nice for simple tests, but don't help much when you
need to get "deep". IE (this is a work still in progress, and there are
better ways to do it if the pools are pretty much static. You could create
an XML file that contains the pool names and LU Names in each, and read this
in instead of doing a query)
**** Begin CUT ****
' monitor pool usage on local and remote servers
'OPTION EXPLICIT
Dim StartTime, EndTime, PoolStartTime, PoolEndTime
Dim strDomainComputer, strPoolTargeted
Dim WmiLocator, WmiNameSpace
Dim objDictActive, objServersInThisPool, objLuInThisPool
Dim xServer, xLuActive, ActiveLUs
Dim objPool, xPool
WScript.echo "Start time " & Now
StartTime = Now
Set WmiLocator = CreateObject("WbemScripting.SWbemLocator")
' running local on his subdomain primary computer reduces risks of
"problems"
' should not run this script simultaneously on multiple boxes - possible
timing issues
strDomainComputer = "."
Set WmiNameSpace =
WmiLocator.ConnectServer(strDomainComputer,"root\MicrosoftHIS")
arrComputers = Array("HIS1","HIS2","HIS3")
ActiveLUs = 0 ' set to 0 to indicate there are no active LUs
' using dictionary much faster than array lookup. Note: This could get VERY
huge
' 30,000 LUs per pool max
' 15,000 LUs per node (4 nodes per server = 60,000 LUs) OUCH!
' 10,000 Pools absolute limit
' never put all your eggs in one basket
Set objDictActive = CreateObject("Scripting.Dictionary")
' status information is "local" per HIS Server, so need to query each server
for LU status
' query each computer in array for active/sscp LUs
' note: Pools can contain LUs from more than one HIS Server, so do this
first
' otherwise it becomes even more complicated
For Each strComputer in arrComputers
WScript.Echo strComputer & " " & Now
Set WmiNameSpaceStatusBox =
WmiLocator.ConnectServer(strComputer,"root\MicrosoftHIS")
' note: if you only want "Active", check for this. However, doing so skips
those in SSCP state, which are "not available" for use.
Set objLUActives = WmiNameSpaceStatusBox.ExecQuery("Select Name from
MsSnaStatus_Lu3270 where StatusText!= 'Inactive' And StatusText
!='Available'" )
if objLUActives.Count > 0 then
WScript.Echo objLUActives.Count & " Active LUs"
ActiveLUs = 1 ' set to 1 to indicate we have active LUs
' store active LU names in dictionary object
For Each xLuActive in objLUActives
objDictActive.Add xLuActive.Name, xLuActive.Name
Next
end if
Next ' array
' get the number of pools configured
' only need to query the local (primary) box for this
Set objPool = WmiNameSpace.ExecQuery("Select Name from MsSna_PoolDisplay")
' now, need to see if active lus are in a pool
For Each xPool In objPool
PoolStartTime = Now
Wscript.Echo VBCR & VBLF & "POOL " & xPool.Name & " at " & PoolStartTime
' set strPoolTargeted to Pool name we are testing against
strPoolTargeted = xPool.Name
GrandTotalOfActiveLU = 0
GrandTotalofLUs = 0
' next line may not be neccessary any longer
Set objServersInThisPool = WmiNameSpace.ExecQuery("ASSOCIATORS OF
{MsSna_Pool.Name='" & strPoolTargeted & "'} where ResultClass=MsSna_Server")
' get the LU names contained in the targeted pool
Set objLuInThisPool = WmiNameSpace.ExecQuery("Select Name from
MSSna_LuDisplay where PoolName='" & strPoolTargeted & "'")
GrandTotalofLUs = objLuInThisPool.Count
' do we have active LUs?
if ActiveLUs > 0 then
' if so, then for each LU in the pool
for each xLuInPool in objLuInThisPool
' see if it is active/sscp status and increment counter
if objDictActive.Exists(xLuInPool.Name) Then GrandTotalOfActiveLU =
GrandTotalOfActiveLU + 1
next
end if
PoolEndTime = Now
Wscript.Echo strPoolTargeted & VBCR & VBLF & "Total active LU " &
GrandTotalOfActiveLU & VBCR & VBLF & "Total LUs " & GrandTotalofLUs
PoolElapsedTime = DateDiff("s", PoolStartTime, PoolEndTime )
Wscript.Echo "Done at " & PoolElapsedTime & VBCR & VBLF
next
EndTime = Now
ElapsedTime = DateDiff("s", StartTime, EndTime)
WScript.echo "End time " & date & " " & EndTime
Wscript.echo "Total Elapsed time " & ElapsedTime
**** End CUT ****
--
HTH,
Charles Ezzell
Microsoft
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Alan Tang" <AlanTang@discussions.microsoft.com> wrote in message
news:DB10A8F9-B0C6-4EC2-A407-28EF05B2534D@microsoft.com...
| Quote: | Hello:
Very thanks for your kindly help. If I would like to learn more, would you
mind to give me some url link that I can have more reference on HIS Object
in
VB script?
Thanks a lot!
"Charles Ezzell (MSFT)" wrote:
Alan,
Here are a few. All tested on HIS 2004.
all are VBScript (use cscript.exe to launch) except the last 2 (VB.NET
and
C# samples).
|
|
|
| Back to top |
|
 |
Neil Pike
Guest
|
Posted:
Thu Nov 10, 2005 5:51 pm Post subject:
Re: PU/LU Status |
|
|
Alan,
Within the HIS help the link is
ms-help://HIS_2004/HIS_2004Main/htm/his_dg_sna_provider_programmers_reference_fh
kp.htm
(watch for the wrap)
| Quote: | Hello:
Very thanks for your kindly help. If I would like to learn more, would you
mind to give me some url link that I can have more reference on HIS Object in
VB script?
Thanks a lot!
"Charles Ezzell (MSFT)" wrote:
Alan,
Here are a few. All tested on HIS 2004.
all are VBScript (use cscript.exe to launch) except the last 2 (VB.NET and
C# samples).
|
Neil Pike. Protech Computing Ltd
Microsoft SNA/HIS MVP |
|
| Back to top |
|
 |
|
|
|
|