I am using the prtgshell powershell module with http://blogs.lockstepgroup.com/2013/09/monitoring-citrix-licensing.html to monitor citrix license usage. I am getting Error reading response: Invalid XML (XML Parser mismatch: Wanted </channel>, got </result>) after setting it up. the script runs correctly and outputs to the file correctly when setting PRTG to output.

The following is the contents of the results file:

------
<prtg>
  <result>
    <channel>Service: Citrix Licensing</channel>
    <value>0</value>
    <unit>custom</unit>
    <customunit>state</customunit>
    <limitminwarning></limitminwarning>
    <limitmaxerror>0</limitmaxerror>
    <limiterrormsg>Service is not running</limiterrormsg>
    <limitmode>1</limitmode>
    <ValueLookup>lockstep.sensor.citrix.licensing</ValueLookup>
    <showchart>0</showchart>
  </result>
  <result>
    <channel>Service: Citrix Licensing WMI</channel>
    <value>0</value>
    <unit>custom</unit>
    <customunit>state</customunit>
    <limitminwarning></limitminwarning>
    <limitmaxerror>0</limitmaxerror>
    <limiterrormsg>Service is not running</limiterrormsg>
    <limitmode>1</limitmode>
    <ValueLookup>lockstep.sensor.citrix.licensing</ValueLookup>
    <showchart>0</showchart>
  </result>
  <result>
    <channel>Service: Citrix Licensing Support Service</channel>
    <value>0</value>
    <unit>custom</unit>
    <customunit>state</customunit>
    <limitminwarning></limitminwarning>
    <limitmaxerror>0</limitmaxerror>
    <limiterrormsg>Service is not running</limiterrormsg>
    <limitmode>1</limitmode>
    <ValueLookup>lockstep.sensor.citrix.licensing</ValueLookup>
    <showchart>0</showchart>
  </result>
  <result>
    <channel>License: Provisioning Services|Concurrent: Percent In Use</channel
>
    <value>0</value>
    <unit>Percent</unit>
    <float>1</float>
    <limitmaxwarning>90</limitmaxwarning>
    <limitminwarning></limitminwarning>
    <limitmaxerror>100</limitmaxerror>
    <limitwarningmsg>0% of licenses allocated.</limitwarningmsg>
    <limiterrormsg>No more licenses available.</limiterrormsg>
    <limitmode>1</limitmode>
  </result>
  <result>
    <channel>License: Provisioning Services|Concurrent: Available</channel>
    <value>48</value>
    <unit>custom</unit>
    <customunit>#</customunit>
    <float>1</float>
    <showchart>0</showchart>
  </result>
  <result>
    <channel>License: Provisioning Services|Concurrent: Total Installed</channe
l>
    <value>48</value>
    <unit>custom</unit>
    <customunit>#</customunit>
    <float>1</float>
    <showchart>0</showchart>
  </result>
  <result>
    <channel>License: StorageLink Enterprise|Concurrent: Percent In Use</channe
l>
    <value>0</value>
    <unit>Percent</unit>
    <float>1</float>
    <limitmaxwarning>90</limitmaxwarning>
    <limitminwarning></limitminwarning>
    <limitmaxerror>100</limitmaxerror>
    <limitwarningmsg>0% of licenses allocated.</limitwarningmsg>
    <limiterrormsg>No more licenses available.</limiterrormsg>
    <limitmode>1</limitmode>
  </result>
  <result>
    <channel>License: StorageLink Enterprise|Concurrent: Available</channel>
    <value>48</value>
    <unit>custom</unit>
    <customunit>#</customunit>
    <float>1</float>
    <showchart>0</showchart>
  </result>
  <result>
    <channel>License: StorageLink Enterprise|Concurrent: Total Installed</chann
el>
    <value>48</value>
    <unit>custom</unit>
    <customunit>#</customunit>
    <float>1</float>
    <showchart>0</showchart>
  </result>
  <result>
    <channel>License: XenApp Enterprise|Concurrent: Percent In Use</channel>
    <value>0</value>
    <unit>Percent</unit>
    <float>1</float>
    <limitmaxwarning>90</limitmaxwarning>
    <limitminwarning></limitminwarning>
    <limitmaxerror>100</limitmaxerror>
    <limitwarningmsg>0% of licenses allocated.</limitwarningmsg>
    <limiterrormsg>No more licenses available.</limiterrormsg>
    <limitmode>1</limitmode>
  </result>
  <result>
    <channel>License: XenApp Enterprise|Concurrent: Available</channel>
    <value>48</value>
    <unit>custom</unit>
    <customunit>#</customunit>
    <float>1</float>
    <showchart>0</showchart>
  </result>
  <result>
    <channel>License: XenApp Enterprise|Concurrent: Total Installed</channel>
    <value>48</value>
    <unit>custom</unit>
    <customunit>#</customunit>
    <float>1</float>
    <showchart>0</showchart>
  </result>
  <result>
    <channel>License: XenDesktop Enterprise|User/Device: Percent In Use</channe
l>
    <value>2.08</value>
    <unit>Percent</unit>
    <float>1</float>
    <limitmaxwarning>90</limitmaxwarning>
    <limitminwarning></limitminwarning>
    <limitmaxerror>100</limitmaxerror>
    <limitwarningmsg>2.08% of licenses allocated.</limitwarningmsg>
    <limiterrormsg>No more licenses available.</limiterrormsg>
    <limitmode>1</limitmode>
  </result>
  <result>
    <channel>License: XenDesktop Enterprise|User/Device: Available</channel>
    <value>47</value>
    <unit>custom</unit>
    <customunit>#</customunit>
    <float>1</float>
    <showchart>0</showchart>
  </result>
  <result>
    <channel>License: XenDesktop Enterprise|User/Device: Total Installed</chann
el>
    <value>48</value>
    <unit>custom</unit>
    <customunit>#</customunit>
    <float>1</float>
    <showchart>0</showchart>
  </result>
  <result>
    <channel>License: XenDesktop Enterprise|Concurrent System: Percent In Use</
channel>
    <value>0</value>
    <unit>Percent</unit>
    <float>1</float>
    <limitmaxwarning>90</limitmaxwarning>
    <limitminwarning></limitminwarning>
    <limitmaxerror>100</limitmaxerror>
    <limitwarningmsg>0% of licenses allocated.</limitwarningmsg>
    <limiterrormsg>No more licenses available.</limiterrormsg>
    <limitmode>1</limitmode>
  </result>
  <result>
    <channel>License: XenDesktop Enterprise|Concurrent System: Available</chann
el>
    <value>48</value>
    <unit>custom</unit>
    <customunit>#</customunit>
    <float>1</float>
    <showchart>0</showchart>
  </result>
  <result>
    <channel>License: XenDesktop Enterprise|Concurrent System: Total Installed<
/channel>
    <value>48</value>
    <unit>custom</unit>
    <customunit>#</customunit>
    <float>1</float>
    <showchart>0</showchart>
  </result>
  <result>
    <channel>License: Provisioning Server for Desktops|Concurrent System: Perce
nt In Use</channel>
    <value>0</value>
    <unit>Percent</unit>
    <float>1</float>
    <limitmaxwarning>90</limitmaxwarning>
    <limitminwarning></limitminwarning>
    <limitmaxerror>100</limitmaxerror>
    <limitwarningmsg>0% of licenses allocated.</limitwarningmsg>
    <limiterrormsg>No more licenses available.</limiterrormsg>
    <limitmode>1</limitmode>
  </result>
  <result>
    <channel>License: Provisioning Server for Desktops|Concurrent System: Avail
able</channel>
    <value>92</value>
    <unit>custom</unit>
    <customunit>#</customunit>
    <float>1</float>
    <showchart>0</showchart>
  </result>
  <result>
    <channel>License: Provisioning Server for Desktops|Concurrent System: Total
 Installed</channel>
    <value>92</value>
    <unit>custom</unit>
    <customunit>#</customunit>
    <float>1</float>
    <showchart>0</showchart>
  </result>
  <text>OK</text></prtg>

------

Article Comments

Hello,

thank you very much for your KB-Post. The XML-Output does of course look correct. Was this created by running the script on commandline?

best regards.


Apr, 2014 - Permalink

Hi,

The output was created by the PRTG sensor using the save output to file option.

Thanks, Andreas


Apr, 2014 - Permalink

Hi,
just to update this post with a solution, if you are getting above error most likely a line break is added to the output because the Powershell session has only a buffer width of 80. To resolve this open your script in an editor and before the first Write-Host statement add the following line:

$host.UI.RawUI.BufferSize = new-object System.Management.Automation.Host.Size(150,5000)

This should fix your issue. Best regards


May, 2014 - Permalink

Thanks that worked!


May, 2014 - Permalink