Xymon Mailing List Archive search

Query current host status via CLI

9 messages in this thread

list Al Jeffcoat · Wed, 6 Sep 2006 10:16:38 -0400 ·
Hello All,

 
One of my Intel admins has asked if there is a way to determine the
total number of citrix sessions in use using hobbit.  We are currently
using the citrix plug-in, but he would like the same information
displayed as a total for the farm.  I'm sure there are ways within
windows to do this, but I am not a windows admin.  I know that I could
easily to this from the command line in many ways.  

 
My three questions are:

 
1.       Is anyone already doing this?

2.       Is there a way from the command line on the hobbit server to
determine the most current status for a hobbit client?  My thought was
to scrape the include file for the citrix servers in question, feed it
to a for loop, and then query the status,  and then just count up the
logged in clients.  I've looked in the files in ~/data, and do not see
current status messages there.

3.       Can anyone think of a better way than in question #2, assuming
I can get the most current status message via CLI?

 
Thanks,

 
Al


This e-mail message and any attached files are confidential and are intended solely for the use of the addressee(s) named above. If you are not the intended recipient, any review, use, or distribution of this e-mail message and any attached files is strictly prohibited. This communication may contain material protected by Federal privacy regulations, attorney-client work product, or other privileges. If you have received this confidential communication in error, please notify the sender immediately by reply e-mail message and permanently delete the original message.  To reply to our email administrator directly, send an email to:  user-ecde3bbc361d@xymon.invalid .  If this e-mail message concerns a contract matter, be advised that no employee or agent is authorized to conclude any binding agreement on behalf of Orlando Regional Healthcare by e-mail without express written confirmation by an officer of the corporation. Any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of Orlando Regional Healthcare.
list Al Jeffcoat · Wed, 6 Sep 2006 16:12:50 -0400 ·
Found the solution, although I’m sure there are easier methods.  I used curl to scrape the number of users from each citrix server, and added them as the script went along.  Fortunately, making a fake host using noconn, and then naming the test citrix (which matches the real citrix test coming from the individual servers) was all I had to do, hobbit is now generating a graph.

 
Al
quoted from Al Jeffcoat

 
From: Jeffcoat, Al 
Sent: Wednesday, September 06, 2006 10:17 AM
To: user-ae9b8668bcde@xymon.invalid
Subject: [hobbit] Query current host status via CLI

 
Hello All,

 
One of my Intel admins has asked if there is a way to determine the total number of citrix sessions in use using hobbit.  We are currently using the citrix plug-in, but he would like the same information displayed as a total for the farm.  I’m sure there are ways within windows to do this, but I am not a windows admin.  I know that I could easily to this from the command line in many ways.  

 
My three questions are:

 
1.       Is anyone already doing this?

2.      Is there a way from the command line on the hobbit server to determine the most current status for a hobbit client?  My thought was to scrape the include file for the citrix servers in question, feed it to a for loop, and then query the status,  and then just count up the logged in clients.  I’ve looked in the files in ~/data, and do not see current status messages there.

3.      Can anyone think of a better way than in question #2, assuming I can get the most current status message via CLI?

 
Thanks,

 
Al


This e-mail message and any attached files are confidential and are intended solely for the use of the addressee(s) named above. If you are not the intended recipient, any review, use, or distribution of this e-mail message and any attached files is strictly prohibited. This communication may contain material protected by Federal privacy regulations, attorney-client work product, or other privileges. If you have received this confidential communication in error, please notify the sender immediately by reply e-mail message and permanently delete the original message. To reply to our email administrator directly, send an email to: user-ecde3bbc361d@xymon.invalid . If this e-mail message concerns a contract matter, be advised that no employee or agent is authorized to conclude any binding agreement on behalf of Orlando Regional Healthcare by e-mail without express written confirmation by an officer of the corporation. Any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of Orlando Regional Healthcare.


--


-- 
 

This e-mail message and any attached files are confidential and are intended solely for the use of the addressee(s) named above. If you are not the intended recipient, any review, use, or distribution of this e-mail message and any attached files is strictly prohibited. This communication may contain material protected by Federal privacy regulations, attorney-client work product, or other privileges. If you have received this confidential communication in error, please notify the sender immediately by reply e-mail message and permanently delete the original message.  To reply to our email administrator directly, send an email to:  user-ecde3bbc361d@xymon.invalid .  If this e-mail message concerns a contract matter, be advised that no employee or agent is authorized to conclude any binding agreement on behalf of Orlando Regional Healthcare by e-mail without express written confirmation by an officer of the corporation. Any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of Orlando Regional Healthcare.
list Henrik Størner · Thu, 7 Sep 2006 11:32:26 +0200 ·
quoted from Al Jeffcoat
On Wed, Sep 06, 2006 at 10:16:38AM -0400, Jeffcoat, Al wrote:
One of my Intel admins has asked if there is a way to determine the
total number of citrix sessions in use using hobbit.  We are currently
using the citrix plug-in, but he would like the same information
displayed as a total for the farm.  I'm sure there are ways within
windows to do this, but I am not a windows admin.  I know that I could
easily to this from the command line in many ways.  

1.       Is anyone already doing this?
Yes. 

You can use the command
  bb 127.0.0.1 "hobbitdboard test=citrix fields=msg"
then search each line of output for the string "NNN users active" 
and sum up the NNN values. I have some rather ugly C code to do
it, but I'm sure it can easily be done in Perl if you know how.
quoted from Al Jeffcoat
2.       Is there a way from the command line on the hobbit server to
determine the most current status for a hobbit client?
"hobbitdboard" command as above if you want the status for many hosts,
"hobbitdlog host=HOSTNAME test=TESTNAME" if you want just a single
status.


Regards,
Henrik
list Andy France · Mon, 11 Sep 2006 13:34:06 +1200 ·

"Jeffcoat, Al" wrote on 07/09/2006 08:12:50 a.m.:
quoted from Al Jeffcoat
Found the solution, although I’m sure there are easier methods.  I
used curl to scrape the number of users from each citrix server, and
added them as the script went along.  Fortunately, making a fake
host using noconn, and then naming the test citrix (which matches
the real citrix test coming from the individual servers) was all I
had to do, hobbit is now generating a graph.

Al
user-ce4a2c883f75@xymon.invalid (Henrik Stoerner) wrote on 07/09/2006 09:32:26 p.m.:
quoted from Henrik Størner
You can use the command
  bb 127.0.0.1 "hobbitdboard test=citrix fields=msg"
then search each line of output for the string "NNN users active"
and sum up the NNN values. I have some rather ugly C code to do
it, but I'm sure it can easily be done in Perl if you know how.
A Citrix Farm summary is something I've thought about for ages - so thanks
to both of you for the push to finally get a script done!

I've created dummy entries for both of our Citrix farms, and have the
"citrix" test pages generated with the "X users active" text showing, but
I'm not getting any RRD files and I'm getting a "broken image" for my
citrix graph.

Is there anything else I should have to do?

Cheers,
Andy.
#####################################################################################

This email is intended for the person to whom it is addressed
only. If you are not the intended recipient, do not read, copy
or use the contents in any way. The opinions expressed may not
necessarily reflect those of ZESPRI Group of Companies ('ZESPRI').

While every effort has been made to verify the information
contained herein, ZESPRI does not make any representations 
as to the accuracy of the information or to the performance
of any data, information or the products mentioned herein.
ZESPRI will not accept liability for any losses, damage or
consequence, however, resulting directly or indirectly from
the use of this e-mail/attachments.
#####################################################################################
list Henrik Størner · Mon, 11 Sep 2006 08:48:12 +0200 ·
quoted from Andy France
On Mon, Sep 11, 2006 at 01:34:06PM +1200, Andy France wrote:
A Citrix Farm summary is something I've thought about for ages - so thanks
to both of you for the push to finally get a script done!

I've created dummy entries for both of our Citrix farms, and have the
"citrix" test pages generated with the "X users active" text showing, but
I'm not getting any RRD files and I'm getting a "broken image" for my
citrix graph.
The parser looks for the string "<newline>N users active<newline>" so
make sure you dont have any tabs, spaces or anything else in front of
(or after) the line with the user-count.


Henrik
list Andy France · Mon, 11 Sep 2006 20:36:06 +1200 ·

Henrik Stoerner wrote on 11/09/2006 06:48:12 p.m.:
quoted from Andy France
On Mon, Sep 11, 2006 at 01:34:06PM +1200, Andy France wrote:
A Citrix Farm summary is something I've thought about for ages - so
thanks
to both of you for the push to finally get a script done!

I've created dummy entries for both of our Citrix farms, and have the
"citrix" test pages generated with the "X users active" text showing,
but
I'm not getting any RRD files and I'm getting a "broken image" for my
citrix graph.
The parser looks for the string "<newline>N users active<newline>" so
make sure you dont have any tabs, spaces or anything else in front of
(or after) the line with the user-count.


Henrik
Aha!  It was the trailing newline that I needed to add to my script.  I now
have a lovely graph showing 0 users logged into my 5 server farm ;)  I'll
let the slackers off seeing as it's 2035 local time.

Excellent service as usual Henrik - Thank You Very Much!
quoted from Andy France

Andy.


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

This email is intended for the person to whom it is addressed
only. If you are not the intended recipient, do not read, copy
or use the contents in any way. The opinions expressed may not
necessarily reflect those of ZESPRI Group of Companies ('ZESPRI').

While every effort has been made to verify the information
contained herein, ZESPRI does not make any representations 
as to the accuracy of the information or to the performance
of any data, information or the products mentioned herein.
ZESPRI will not accept liability for any losses, damage or
consequence, however, resulting directly or indirectly from
the use of this e-mail/attachments.
#####################################################################################
list Enrico Morigi · Mon, 11 Sep 2006 14:48:49 +0200 ·
hi,

where can i download the citrix plugin to get the users sessions?

thanks
enrico
list Al Jeffcoat · Mon, 11 Sep 2006 10:58:38 -0400 ·
There's a file in the contrib directory of the source distribution file
called citrix.zip.  We are using it with the bbwin client.

Al
quoted from Enrico Morigi


-----Original Message-----
From: Enrico Morigi [mailto:user-e71d55725ae4@xymon.invalid] 
Sent: Monday, September 11, 2006 8:49 AM
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] Query current host status via CLI

hi,

where can i download the citrix plugin to get the users sessions?

thanks
enrico


This e-mail message and any attached files are confidential and are intended solely for the use of the addressee(s) named above. If you are not the intended recipient, any review, use, or distribution of this e-mail message and any attached files is strictly prohibited. This communication may contain material protected by Federal privacy regulations, attorney-client work product, or other privileges. If you have received this confidential communication in error, please notify the sender immediately by reply e-mail message and permanently delete the original message.  To reply to our email administrator directly, send an email to:  user-ecde3bbc361d@xymon.invalid .  If this e-mail message concerns a contract matter, be advised that no employee or agent is authorized to conclude any binding agreement on behalf of Orlando Regional Healthcare by e-mail without express written confirmation by an officer of the corporation. Any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of Orlando Regional Healthcare.
list John A. Milburn · Mon, 11 Sep 2006 15:46:44 -0500 ·
This is what we are using. It runs on one of the Citrix servers. The
others don't collect farm data.
It's not real pretty, but it does what we need.

BEGIN
'*******************************************************************
'*******************************************************************
'******************************************************************* 

'***********************************************************************
***
'
' VBScript Source File
'
' NAME: CITRIXALL.VBS
'
' AUTHOR: John A. Milburn
' DATE  : 02/04/05
'
'
'***********************************************************************
***
Option Explicit
'***********************************************************************
***

Const ForReading = 1
Const ForWriting = 2

Public Const wbemFlagReturnImmediately = &h10
Public Const wbemFlagForwardOnly = &h20

'On Error Resume Next

Dim strComputer
strComputer = "."

Dim strFileOut, blArgs
Dim lngResult, lngUsersOnFarm
lngResult = 0

strFileOut = "-ctxinfo"

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(strFileOut) Then
 	fso.DeleteFile(strFileOut)
End If
Set fso = Nothing

lngUsersOnFarm = GetFarmUsers(strComputer)
lngResult = GetCitrixInfo(strComputer)

WScript.Quit lngResult
		
'***********************************************************************
***
'***********************************************************************
***
'***********************************************************************
***
'***********************************************************************
***
		
'***********************************************************************
***
' Function name: GetCitrixInfo
' Parameters: 
'
'***********************************************************************
***
Function GetCitrixInfo(strComputer)
'***********************************************************************
***
'	On Error Resume Next

  Dim strFarmName, strIPAddress, strLoginsEnabled,
strNumberOfActiveSessions
  Dim strNumberOfDisconnectedSessions, strNumberOfSessions,
strServerName
  Dim strServerType, strZoneName, strZoneRanking

  Dim objWMIService, colItems, objItem
  Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\Citrix")
  Set colItems = objWMIService.ExecQuery("SELECT * FROM
MetaFrame_Server", "WQL", _
                               wbemFlagReturnImmediately +
wbemFlagForwardOnly)

	Dim strOut
  strOut = ""
  For Each objItem In colItems
    strFarmName = objItem.FarmName
    strIPAddress = objItem.IPAddress
    strLoginsEnabled = objItem.LoginsEnabled
    strNumberOfActiveSessions = objItem.NumberOfActiveSessions
    strNumberOfDisconnectedSessions =
objItem.NumberOfDisconnectedSessions
    strNumberOfSessions = objItem.NumberOfSessions
    strServerName = objItem.ServerName
    strServerType = objItem.ServerType
    strZoneName = objItem.ZoneName
    strZoneRanking = objItem.ZoneRanking
  Next
  Set objItem = Nothing
  Set colItems = Nothing
  Set objWMIService = Nothing
  
  strZoneName = Right(strZoneName, Len(strZoneName) -
(InStr(strZoneName, Chr(34))))
  strZoneName = Left(strZoneName, (InStr(strZoneName, Chr(34)) - 1))

  strOut = strOut & "Farm Name      : " & strFarmName & vbLf
  strOut = strOut & "Farm users     : " & CStr(lngUsersOnFarm) & vbLf
  strOut = strOut & "IP Address     : " & strIPAddress & vbLf
  strOut = strOut & "Logins Enabled : " & strLoginsEnabled & vbLf
  strOut = strOut & "Sessions" & vbLf
  strOut = strOut & "        Active : " & strNumberOfActiveSessions &
vbLf
  strOut = strOut & "  Disconnected : " &
strNumberOfDisconnectedSessions & vbLf
  strOut = strOut & "         Total : " & strNumberOfSessions & vbLf
  strOut = strOut & "Server Type    : " & strServerType & vbLf
  strOut = strOut & "Zone Name      : " & strZoneName & vbLf
  strOut = strOut & "Zone Ranking   : " & strZoneRanking & vbLf
  strOut = strOut & vbLf
  strOut = strOut & strNumberOfActiveSessions & " users active" & vbLf
  strOut = strOut & vbLf
'  WScript.Echo strOut


	Dim fso, objFileOut
	Set fso = CreateObject("Scripting.FileSystemObject")

	Dim blRed, blYellow, blGreen
	blRed = False
	blYellow = False
	blGreen = True

'Set warning and error
  If strNumberOfActiveSessions > 20 Then
    blYellow = True
  End If

  If strNumberOfActiveSessions > 25 Then
  	blRed = True
  End If


  Set objFileOut = fso.OpenTextFile(strFileOut, ForWriting, True)
  If blRed Then
  	objFileOut.WriteLine "red Citrix Server Information"
  Else
    If blyellow Then
    	objFileOut.WriteLine "yellow Citrix Server Information"
    Else
    	objFileOut.WriteLine "green Citrix Server Information"
    End If
  End If

  objFileOut.WriteLine ""
  objFileOut.WriteLine strOut
  objFileOut.WriteLine ""
  objFileOut.Close

  Set fso = Nothing
  GetCitrixInfo = -1
  Exit Function

End Function
'***********************************************************************
***


'***********************************************************************
***
Function GetFarmUsers(strComputer)
'Server:
\\COSTERMSERV3\root\Citrix:Citrix_Server.ServerName="D8TERMSERV1"
'Zone: \\COSTERMSERV3\root\Citrix:Citrix_Zone.ZoneName="D8"
'***********************************************************************
***
  Dim lngUserCount, objWMIService, colItems, objItem
  Dim strThisServer, lngPtr, strThisComputer
  Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\Citrix")
  Set colItems = objWMIService.ExecQuery("SELECT * FROM
Citrix_ServersInZone", "WQL", _
                                         wbemFlagReturnImmediately +
wbemFlagForwardOnly)
  For Each objItem In colItems
    strThisServer = objItem.Server
    lngPtr = InStr(strThisServer, "=") + 2
    strThisComputer = Mid(strThisServer, lngPtr, (Len(strThisServer) -
lngPtr))
    lngUserCount = lngUserCount + GetUsersOnServer(strThisComputer)
  Next
  Set objItem = Nothing
  Set colItems = Nothing
  Set objWMIService = Nothing
  GetFarmUsers = lngUserCount
End Function
'***********************************************************************
***

'***********************************************************************
***
Function GetUsersOnServer(strThisComputer)
'***********************************************************************
***
  Dim objWMIService, colItems, objItem, lngNumberOfSessions
  Set objWMIService = GetObject("winmgmts:\\" & strThisComputer &
"\root\Citrix")
  Set colItems = objWMIService.ExecQuery("SELECT * FROM
MetaFrame_Server", "WQL", _
                               wbemFlagReturnImmediately +
wbemFlagForwardOnly)

  For Each objItem In colItems
'    lngNumberOfSessions = CLng(objItem.NumberOfSessions)
    lngNumberOfSessions = CLng(objItem.NumberOfActiveSessions)
'    lngNumberOfSessions = CLng(objItem.NumberOfDisconnectedSessions)
'    lngNumberOfSessions = CLng(objItem.NumberOfSessions)
  Next
  Set objItem = Nothing
  Set colItems = Nothing
  Set objWMIService = Nothing

  GetUsersOnServer = lngNumberOfSessions

End Function
'***********************************************************************
***
'*******************************************************************
'*******************************************************************
'******************************************************************* 
END
quoted from Al Jeffcoat


-----Original Message-----
From: Jeffcoat, Al [mailto:user-eca780a472ed@xymon.invalid] 
Sent: Monday, September 11, 2006 9:59 AM
To: user-ae9b8668bcde@xymon.invalid
Subject: RE: [hobbit] Query current host status via CLI

There's a file in the contrib directory of the source distribution file
called citrix.zip.  We are using it with the bbwin client.

Al


-----Original Message-----
From: Enrico Morigi [mailto:user-e71d55725ae4@xymon.invalid] 
Sent: Monday, September 11, 2006 8:49 AM
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] Query current host status via CLI

hi,

where can i download the citrix plugin to get the users sessions?

thanks
enrico


This e-mail message and any attached files are confidential and are
intended solely for the use of the addressee(s) named above. If you are
not the intended recipient, any review, use, or distribution of this
e-mail message and any attached files is strictly prohibited. This
communication may contain material protected by Federal privacy
regulations, attorney-client work product, or other privileges. If you
have received this confidential communication in error, please notify
the sender immediately by reply e-mail message and permanently delete
the original message.  To reply to our email administrator directly,
send an email to:  user-ecde3bbc361d@xymon.invalid .  If this e-mail
message concerns a contract matter, be advised that no employee or agent
is authorized to conclude any binding agreement on behalf of Orlando
Regional Healthcare by e-mail without express written confirmation by an
officer of the corporation. Any views or opinions presented in this
e-mail are solely those of the author and do not necessarily represent
those of Orlando Regional Healthcare.