
Checking the Health of Citrix VDA Machines with Centreon
All of us who work with Citrix environments know about the criticality of VDA machines, A very simple way to know your health, will be monitored with Centreon. We will be able to know the status of the VDA agent of the machines, On the one hand, you get VDA machines that have registration problems with the Delivery Controller, and also interesting if we have one in maintenance mode.
GOOD, We will do it very easily, with 2 PowerShell scripts, one to identify machines that are in maintenance mode and another for those that are not registered. We will leave these scripts in the Delivery Controller and execute them from Centreon using NRPE. If you have doubts about what you need to install to have NRPE on the Delivery Controller or how to configure it, Check out This chapter.
I leave you the 2 Scripts We'll Use, we put them as we know in '%ProgramFiles%NSClient++scripts':
vdas_mantenimiento.ps1
[SourceCode]Citrix Asnp.*
$m = Get-BrokerDesktop -MaxRecordCount 5000 | ? {$_. InMaintenanceMode -eq 'True'} | fl DNSName | measure
if ($m.Count -gt 0) {
echo "There is a VDA in maintenance mode"
Get-BrokerDesktop -MaxRecordCount 5000 | ? {$_. InMaintenanceMode -eq 'True'} | fl DNSName
exit 2
}
echo "All VDAs working"
exit 0[/SourceCode]
vdas_registrados.ps1
[SourceCode]Citrix Asnp.*
$m = Get-BrokerDesktop -MaxRecordCount 5000 | ? {$_. RegistrationState -eq 'Unregistered'} | fl DNSName | measure
if ($m.Count -gt 0) {
echo "There is any unregistered VDA"
Get-BrokerDesktop -MaxRecordCount 5000 | ? {$_. RegistrationState -eq 'Unregistered'} | fl DNSName
exit 2
}
echo "All VDAs are registered"
exit 0[/SourceCode]
We modify the file nsclient.ini and add the part that we have left, which would be to define an alias for when we call him from Centreon and the command he will execute. We added something like:
[SourceCode][/settings/external scripts/scripts]
vdas_mantenimiento = cmd /c echo scripts\vdas_mantenimiento.ps1; exit($lastexitcode) | powershell.exe -executionpolicy bypass -command –
vdas_registrados = cmd /c echo scripts\vdas_registrados.ps1; exit($lastexitcode) | powershell.exe -executionpolicy bypass -command –
…
[/settings/external scripts/alias]
vdas_mantenimiento = vdas_mantenimiento
vdas_registrados = vdas_registrados[/SourceCode]
Save the file and restart the NSClient++ service,
After that, we register the Service in the Centreon configuration as usual, usually against the check_nrpe command and enter in the Argument the Alias that we have defined in the fichero.ini. As usual, we export the Centreon configuration and we will be able to see that we already have these services monitored, if we have a VDA left in Maintenance mode we will know, as well as if a VDA has not been properly registered against the Citrix site.