Citrix Plugin

Tom DE BLENDE tdeblend at gcc.dhl.com
Fri Sep 13 16:20:18 CEST 2002


That was me :-) 

This script needs plink.exe
(http://the.earth.li/~sgtatham/putty/latest/x86/plink.exe) in the same
folder and should be scheduled to run every five minutes on the Citrix
server. It writes the logon status of a server straight into the
external command file. Be sure to enable this in the configuration of
your NetSaint/Nagios setup.

You might have to change some stuff every here and there. For example:
the line where plink makes the connection (password, hostname,
username). Also make sure that you run plink once to connect to your
NetSaint server in order to save the SSH host key in the registry.
Then while being logged in as that user, using regedit, copy the key
from [HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys] to
[HKEY_USERS\.DEFAULT\Software\SimonTatham\PuTTY\SshHostKeys] as well.

As this is a passive service check, don't forget to read that part
from the documentation.

This script works in NetSaint, but should work on Nagios as well. If
you need any additional info, don't hesitate to contact me.


**********************************************************************************************************************************************

'*** Citrix check ***
'
'Created by Tom De Blende ~ 2002
'
'#################################################################################################################################

Option Explicit                 'All variables should be explicitly
declared

'#################################################################################################################################

'DECLARING VARIABLES

'Declaring Objects
'
Dim objFSO                  'Object file system
Dim objWshNetwork           'Object network
Dim objWshShell             'Object shell
Dim objWshEnv               'Object environment
Dim objFile

'Declaring string variables
'
Dim strStatus
Dim strNote
Dim strDateUnix0
Dim strDateNow
Dim strDate
Dim strFile
Dim strHost
Dim strService
Dim strTemp

'Declaring integers
Dim intTimeDiff

'Declaring arrays
'


'#################################################################################################################################

Set objWshNetwork = Wscript.CreateObject("Wscript.Network")
Set objFSO = Wscript.CreateObject("Scripting.FileSystemObject")
Set objWshShell = Wscript.CreateObject("Wscript.Shell")
Set objWshEnv = objWshShell.Environment("PROCESS")

'Setting strTemp

'#################################################################################################################################

'CHANGE THESE SETTINGS:

'Enter the hostname the Citrix host has in NetSaint (case sensitive!),
you can use the predefined function, or enter this hard-coded
strHost = LCase(objWshNetwork.ComputerName)
'Enter the Service Description this service has in NetSaint (case
sensitive!)
strService = "Citrix Logins"
'Enter the time difference in minutes between your time zone and UTC.
intTimeDiff = "7200"
'Enter the name of command file
strFile = "status.tmp"

'#################################################################################################################################


'NOTHING TO BE CHANGED FROM HERE EXCEPT SSH PARAMETERS OF PLINK

'Calculate time_t Unix Time
strDateUnix0 = "1/01/70 00:00:00"
strDateNow = Now
strDate = DateDiff ("s", strDateUnix0, strDateNow)
strDate = strDate - intTimeDiff

'Read logon status from registry
strStatus = objWshShell.RegRead
("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon\WinStationsDisabled")

'Assign error code and comments
If strStatus = "0" Then
    strNote = "Remote Citrix logins are currently ENABLED."
ElseIf strStatus = "1" Then
    strNote = "Remote Citrix logins are currently DISABLED."
End If

'Append info to a text file in the correct format.
Set objFile = objFSO.OpenTextFile(strFile, 2, True)
objFile.WriteLine "echo '[" & strDate & "]
PROCESS_SERVICE_CHECK_RESULT;" & strHost & ";" & strService & ";" &
strStatus & ";" & strNote & "' >>
/usr/local/netsaint/var/rw/netsaint.cmd"
objFile.Close

objWshShell.Run "plink.exe -ssh -pw <enter password here> -m
status.tmp <username>@<netsaintserver>", 0, True

Wscript.Quit



**********************************************************************************************************************************************
"Bishop, Dean" wrote:
> 
> what do you need to check?  if you just want to check for existance use
> check_tcp!1494
> 
> if you want something more search the archives.  i remember someone had a VB
> script that did something.  i don't remember details but i think it check
> the registry for logon ability.
> 
> let me know if you need it, i may have it in an archive.
> 
> later,
> dean
> 
> -----Original Message-----
> From: jdhicks at cableone.net [mailto:jdhicks at cableone.net]
> Sent: Friday, September 13, 2002 9:28 AM
> To: Nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] Citrix Plugin
> 
> Does anyone know of any Citrix plugins? Thanks,
> 
> John Hicks
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users

-- 
Tom De Blende
Senior NT Infrastructure Analyst (Frango)
DHL Global Coordination Center - IT Department
Tel +32 2 713 42 62        
Fax +32 2 713 52 00


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf




More information about the Users mailing list