Procedimiento para monitorizar el uso de licencias en una granja citrix, interesante para llevar la gestión de las mismas y conocer el crecimiento que puedes tolerar sin gastarte mas dinero.
Lo primero, el script tiene que correr en la maquina que tenga instalado el servidor de licencias de Citrix.
Es una modificación del script original para que nos deje el numero de licencias en uso en un fichero de texto para que luego el agente de zabbix sea capaz de tratarlo.
Cosas que hay que modificar:
– C:\Program Files\Citrix\Licensing\Myfiles\license_xxxxxxxx.lic -> Aqui tienes que poner tu fichero de licencias
‘—————————————————————————————————————————————–
‘ Script : CitrixLicCount.vbs
‘ Description : Check Licenses in use
‘ Author : Super Pippo
‘ Date : 7.10.2005
‘ Revision :
‘ Argument : none
‘——————————————————————————————————————————————
Public countLicenses
WarningLimit = 10 ‘choose the limit that triggers the alarm
CheckMPSLicUsage
Function CheckMPSLicUsage
CommandLine = chr(34) & «C:\Program Files\Citrix\Licensing\LS\lmstat» & chr(34) & » -c » & chr(34) & «C:\Program Files\Citrix\Licensing\Myfiles\license_xxxxxxxx.lic» & chr(34) & » -a»
‘wscript.echo commandline
Set objShell = CreateObject(«WScript.Shell»)
Set oExec = objShell.Exec(CommandLine)
countLicenses = 0
Do Until oExec.StdOut.AtEndOfStream
Input = oExec.StdOut.ReadLine
if InStr(Input, «v2005») Then
countLicenses = countLicenses + 1
end if
Loop
wscript.echo countlicenses
End Function
dim filesys
Set filesys = CreateObject(«Scripting.FileSystemObject»)
filesys.CreateTextFile «c:\licencias.txt», True
If filesys.FileExists(«c:\licencias.txt») Then
filesys.DeleteFile «c:\licencias.txt»
End If
Dim testfile
Set testfile= filesys.CreateTextFile(«c:\licencias.txt», True)
testfile.Write countLicenses
testfile.Close
Una vez creado el script puedes comprobar que crea el fichero c:\licencias.txt y que contiene algun numero.
El paso siguiente es modificar el fichero zabbix.conf para incluir la siguiente linea:
UserParameter=chklicense,cscript.exe /nologo «c:\wmpub\countlicense10.vbs»
chklicense es el identificador con el trabajaremos en zabbix.
Paramos y arrancamos el agente y ya podremos disponer del valor enla variable chklicense para crear el correspondiente trigger, grafico o lo que necesitemos.