YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

How many client is connected to the PI server? Options · View
Shem
#1 Posted : Tuesday, May 10, 2011 12:10:32 PM
Rank: Member
Groups: Member

Joined: 5/5/2011
Posts: 22
Location: Moscow
How I can learn how many users is connected to the PI server and what it is clients? The problem in counting up quantity of simultaneously connected apps (for example SMT)
Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
WalkeR
#2 Posted : Friday, May 13, 2011 10:49:19 AM
Rank: Newbie
Groups: Member

Joined: 4/6/2011
Posts: 2
Location: Russia
PI SMT -> Operation -> Nework Manager Statistics.
Or not enough?
Shem
#3 Posted : Friday, May 13, 2011 12:20:43 PM
Rank: Member
Groups: Member

Joined: 5/5/2011
Posts: 22
Location: Moscow
I should see this information in Visual Bsic. I don't know as to obtain this data from PI-SDK
RJK Solutions
#4 Posted : Tuesday, May 17, 2011 5:04:37 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
You can't get at this information from PI SDK.
The nearest you will get is to parse the message logs of the PI server/collective via PI SDK, but you need to form the correct search criteria to ensure you efficiently search the logs. I doubt you would get a usable tool in this way, especially with a busy system.

If you are running your application/interface on the PI server itself (typically not recommended) you could run a PIConfig script to output connections to a file and parse the file.
Principal Consultant
Real-Time Data Management @ Wipro Technologies
Shem
#5 Posted : Wednesday, May 18, 2011 6:11:09 AM
Rank: Member
Groups: Member

Joined: 5/5/2011
Posts: 22
Location: Moscow
When using the log you can lose some data. WalkeК said about the PI SMT -> Operation -> Nework Manager Statistiks. From ЫMT knows this information?
RJK Solutions
#6 Posted : Wednesday, May 18, 2011 8:27:44 AM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
PI SMT can make some additional RPCs not exposed to PI SDK.
Principal Consultant
Real-Time Data Management @ Wipro Technologies
Shem
#7 Posted : Wednesday, May 18, 2011 8:58:47 AM
Rank: Member
Groups: Member

Joined: 5/5/2011
Posts: 22
Location: Moscow
Can I use the RPC? how can I use it?
RJK Solutions
#8 Posted : Wednesday, May 18, 2011 2:19:35 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
No. If OSIsoft wanted us to make use of such RPCs then it would be exposed to us via PI SDK or some other assembly - or at least be planned for a future PI SDK release. You are best to log the feature request with OSIsoft TechSupport.
Principal Consultant
Real-Time Data Management @ Wipro Technologies
Shem
#9 Posted : Wednesday, May 18, 2011 2:50:26 PM
Rank: Member
Groups: Member

Joined: 5/5/2011
Posts: 22
Location: Moscow
Thank you. I'll think how to solve this problem the available methods ))))
Shem
#10 Posted : Thursday, May 19, 2011 9:55:57 AM
Rank: Member
Groups: Member

Joined: 5/5/2011
Posts: 22
Location: Moscow
OSIsoft TechSupport

Quote:

Background
Archiving the number of connections a client application makes to the PI Server can be useful when you want to record whether the application in question is respecting the concurrent licensing count.
It can also be useful when you want to monitor an application's connection/disconnection activities, or when you want to record whether the application is behaving as expected or if it is disconnecting gracefully or not.

Note: The following workaround will work for thick clients such as ProcessBook and DataLink but not with thin clients such as RtWebParts, PI WebParts, and iViews. PI Data Services (or RtBaseline Services for RtWebParts) makes a single connection to the PI Network Manager on behalf of all thin client users.
Solution
Since there is no existing performance counter that archives the number of connections made from one application to the PI Server, the following workaround was created.
Workaround
1. Create a batch file called "connect_count.bat" with the following commands, and save it in your ..\PI\adm\ directory:

echo off
Set computer=%1
Set app=%2
Set pi_path=%PISERVER%adm

if "%computer%"==[] (
echo No remote host set, quitting...
goto theEnd
)
if "%app%"==[] (
echo No Applicaiton set, quitting...
goto theEnd
)


if NOT Exist .\Monitor mkdir .\Monitor

%pi_path%\piconfig table pinetmgrstats ostr * sele id=* ends exit > %pi_path%\Monitor\pinetstats.txt

type %pi_path%\Monitor\pinetstats.txt | find /i /n "%app%" | find /i /c "%computer%" > %pi_path%\Monitor\output_%computer%_%app%.txt
:theEnd


This batch file will first generate the file pinetstats.txt containing the output of the PI Network Manager Statistics.
Then from this pinetstats.txt file a second text file is created using a 'find' command to search and count the number of rows with the 'application' name specified.
You can also specify that you want the total connections from a specific client PC.
2. Run the batch file using the following arguments:

connect_count.bat <computer> <application>

Examples:

Ex1: connect_count.bat MyClientPC procbook
Ex2: connect_count.bat 0 procbook
Ex3: connect_count.bat "Local connection" procbook

Using 0 (zero) will default to connections from all sources.
Use "Local connection" to monitor connection count locally on the PI Server (pinetstats.txt does not expose the local PI Server Name).
3. Use various tools to move this data into PI.
Here is an example using VB6 and ACE 1.x:

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''' IMPORTANT: DO NOT CHANGE THE SUBROUTINE NAME ''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' Tag Name/VB Variable Name Correspondence Table
' Tag Name VB Variable Name
'------------------------------------------------------------
' Number_ProcBook_Connection Number_ProcBook_Connection
'
' Add as a reference the "Microsoft Scripting Runtime" to enable file i/o

Public Sub ActualPerformanceEquations()

On Error GoTo Errh_FileReader

Dim fso As New FileSystemObject
Dim CurrentFile As File 'Current file being process
Dim ts As TextStream
Dim Line As String 'Single line from the file

Dim rez As Double

'Run the bat file connect_count.bat
rez = Shell("javascript:void(null);", vbHide)

'Produce the file to read with the number of connections using output__.txt
Set CurrentFile = fso.GetFile("javascript:void(null);")

'Open the file for reading
Set ts = CurrentFile.OpenAsTextStream(ForReading)

'Get the first line and store into string
Line = ts.ReadLine

'Write to the PI tag
Number_ProcBook_Connection.Value = Line

'Close the file
ts.Close

'Clean the variables
Set ts = Nothing
Set CurrentFile = Nothing

Exit_FileReader:
Exit Sub

Errh_FileReader:
'Write a message to the PI server log if there's an error during execution
LogPIACEMessage mlErrors, Err.Number & " - " & Err.Description, mstrRegisteredName
Resume Exit_FileReader

End Sub


You can create this ACE calc as a 1 minute clock-base execution.
Create the output PI tag with compression ON but compdev/excdev set to 0.



It work! You need use txt file, but yoy have all connection
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.