cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 7

Citrix Application Template reporting null array values

Wanted to see if anyone else was having this problem.  The build in template for Citrix (Citrix XenApp and XenDesktop 7.x (Advanced)) is returning errors that say "Index operation failed; the array index evaluated to null.".  If I run the get commands they return information so I think it is something to do with the array.  Has anyone else ran into this and know how to fix it?  Powershell script below.

try {
Add-PsSnapIn Citrix.Broker.Admin.V2;
$res=Get-BrokerController;
}
catch {
Write-Host "Message: $($Error[0])";
exit 1;
}
if ($res -eq $null) {
Write-Host "Message.Active: Information not available. Possibly broker is not configured properly.";
Write-Host "Statistic.Active: -1";
exit 0;
}
$stat1=$stat2=$stat3=$stat4=0;
$mess1=$mess2=$mess3=$mess4="";
if ($res -is [system.array])
{
if ($res[$i].State -match "Active")
{
$stat1++;
$mess1 += "<br/>";
$mess1 += $res[$i].MachineName;
$mess1 += ";"
}
if ($res[$i].State -match "Transitioning")
{
$stat2++;
$mess2 += "<br/>";
$mess2 += $res[$i].MachineName;
$mess2 += ";"
}
if ($res[$i].State -match "Off")
{
$stat3++;
$mess3 += "<br/>";
$mess3 += $res[$i].MachineName;
$mess3 += ";"
}
if ($res[$i].State -match "Failed")
{
$stat4++;
$mess4 += "<br/>";
$mess4 += $res[$i].MachineName;
$mess4 += ";"
}
}
else
{
if ($res.State -match "Active")
{
$stat1++;
$mess1 = $res.MachineName;
}
if ($res.State -match "Transitioning")
{
$stat2++;
$mess2 = $res.MachineName;
$mess2 += ";"
}
if ($res.State -match "Off")
{
$stat3++;
$mess3 = $res.MachineName;
}
if ($res.State -match "Failed")
{
$stat4++;
$mess4 = $res.MachineName;
}
}
Write-Host "Message.Active: Controllers in Active state: $mess1";
Write-Host "Statistic.Active: $stat1";
Write-Host "Message.Transitioning: Controllers in Transitioning state: $mess2";
Write-Host "Statistic.Transitioning: $stat2";
Write-Host "Message.Off: Controllers in Off state: $mess3";
Write-Host "Statistic.Off: $stat3";
Write-Host "Message.Failed: Controllers in Failed state: $mess4";
Write-Host "Statistic.Failed: $stat4";
exit 0;

Labels (4)
0 Kudos
1 Reply

Hello,

I will copy/paste some internal resolution on a very similar customer issue:Issue:

  • one of the component monitors (the specific machine state component monitor) has a script that is setup to poll the broker on the same server as the Citrix server. This is not really how people have it setup at all (as they have it set up as a many Citrix servers to a single broker).
  • The next issue that we ran into with that component monitor was the permissions wrapper. The script gets pushed to the Citrix server and then the Citrix server calls the broker. This continually resulted in the following error:
    The return code is different than expected. Testing on node 'IP' failed with 'Down' status ('Down' might be different if script exits with a different exit code).
    The caller was not authenticated by the service.
    To get around that we used the agent (thus not having to worry about a double hop with the power shell script).
    Once we used the agent, the monitors appeared to be working. However, upon further investigation, the only one that is working is the Specific Machine State. All of the other monitors are showing as up, but erroring out with the following error with the script:
    Index operation failed; the array index evaluated to null.

Support communicated with client and client managed to resolve issues:

I updated the scripts to point to the broker, set them to run locally on the Orion server, updated the Job Engine V2 service to use a domain account (this account is domain admin, plus has read-only rights to the Broker database). This caused the scripts to function. To pass the machine name, I’ve set the template up to use the variable Domain\${Node.DNS}, and also edited the script again to strip out the FQDN of the DNS entry to just get the shortname. Seems to be working fine.

--------------

This is fixed in SAM 6.4. Under below link you can find fixed template - as workaround you can apply this template to customer https://thwack.solarwinds.com/docs/DOC-175320

----------

Agent might help with that application monitor.

Alternatively you might need a newer version of SAM if you are on a version previous to SAM 6.4

Also the template above may work better than the out of the box template.

Try this and if none of this helps I recommend opening a support case referencing internal only (development) case CUST-30741

-Jonathon Privett (Senior Tech at SW)

0 Kudos