Background:
I recently set up a check that runs a simple Powershell script that returns how many Citrix licenses we have in use in our environment. This is on a Windows host using NSClient++ and NRPE.
Powershell Script:
Code: Select all
Add-PSSnapin *citrix*
$licenseServer = "[citrix license server FQDN]"
$countLicenseFree = Get-WmiObject -Class "Citrix_GT_License_Pool" -Namespace "ROOT\CitrixLicensing" -ComputerName $licenseServer | Measure-Object -Property PooledAvailable -Sum
$returnStateOK = 0
$returnStateWarning = 1
$returnStateCritical = 2
$returnStateUnknown = 3
if ($countLicenseFree.sum -gt 300) {
Write-Host "We're good:"$countLicenseFree.sum
exit $returnStateOK
}
if ($countLicenseFree.sum -lt 300) {
Write-Host "Keep an eye on this:"$countLicenseFree.sum
exit $returnStateWarning
}
if ($countLicenseFree.sum -lt 100) {
Write-Host "We're going down captain!"$countLicenseFree.sum
exit $returnStateCritical
}
Write-Host "UNKNOWN script state"
exit $returnStateUnknown[/settings/external scripts/scripts]
citrix_licenses = cmd /c echo scripts\citrix_licenses.ps1; exit($lastexitcode) | powershell.exe -command -
Question:
How do I set up this check to record historical data and possibly show a performance graph? Is one related to the other?
Thanks