What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
300.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Powershell script for HpyerV replica

Votes:

0

Your Vote:

Up

Down

I'm trying to setup this Powershell script for HyperV replica located here

I keep getting:

Response not wellformed: "(<prtg> </prtg> )" (code: PE132)

I have PRTG installed on server1 - I have two hyperv servers they are monitor using the remote sensor option (hyperv1 & 2)

I've got the powershell script in the custom scripts folder on Server1. I add the sensor for the powershell script. But all I get is the above message back.

Do I need to install the prtg remote probe on to the hyperv servers and then put the script in the custom scripts directory on the hyperv server and then add the sensor to get it to work?

hyperv2012 powershell prtg

Created on Sep 23, 2015 1:32:23 PM by  joemailey (120) 1 2

Last change on Nov 27, 2015 6:44:31 AM by  Luciano Lingnau [Paessler]



7 Replies

Accepted Answer

Votes:

7

Your Vote:

Up

Down

Managed to get the script to work eventually.

Had to set Powershell on the server that was running the script to unrestricted:
Set-ExecutionPolicy unrestricted (x64 & x32 powershell)

Also had to install HyperV tools for Powershell using the following:

  1. Import-Module ServerManager
  2. Add-WindowsFeature RSAT-Hyper-V-Tools –IncludeAllSubFeature

I added the script to the custom sensor folder in PRTG monitoring folder on the server.

Then on PRTG I added a custom sensor "EXE/Script Advanced" Selected the script from the dropdown list.

In the Parameters field in PRTG sensor I added in my servers in this format including quotes "server1,server2,server3"

With the servers being the actual HyperV host server.

It was as easy as that. First time I had to use a custom script so didn't no how it worked. So hopefully these extra steps help anyone else with the issue.

Created on Sep 24, 2015 9:05:46 AM by  joemailey (120) 1 2

Last change on Sep 24, 2015 12:28:27 PM by  Luciano Lingnau [Paessler]



Votes:

0

Your Vote:

Up

Down

Hi,

I was trying to use this script but I keep getting the following error:

No "result" or "error" in XML response.

The only editing I have done to the script is to:

$ServerList = $Hypervservers.Split("Server1,Server2")

Do I need to use the Hyper-V Server IP address or the fully qualified domain name (FQDN) of the server?

Also, in the Parameters field do I need to use an IP address or FQDN?

Created on Nov 26, 2015 12:42:12 PM by  keithdaly (0)



Votes:

0

Your Vote:

Up

Down

You don't need to edit the script, as said in my post. you put the server names in to the parameters field. it can be ip or FQDN.

So in the parameters field in PRTg it should be "server1.domain.com,server2.domain.com,server3.domain.com"

Created on Nov 26, 2015 1:51:28 PM by  joemailey (120) 1 2



Votes:

0

Your Vote:

Up

Down

Thanks for getting back to me,

When I use the un-edited script I get the following error when I enter the servers as parameters

XML: The returned xml does not match the expected schema. (code: PE233) -- JSON: The returned json does not match the expected structure (Invalid JSON.). (code: PE231)

Do I need to add the sensor in a particular position?

Any suggestions are welcome.

Created on Nov 26, 2015 5:01:27 PM by  keithdaly (0)



Votes:

0

Your Vote:

Up

Down

Hello keithdaly,
As for the described error:

XML: The returned xml does not match the expected schema. (code: PE233)

It will be displayed when the result of the sensor doesn't match the format expected by PRTG. This usually indicates that some error occurred within the script (Authentication, Permission, etc).

Within the sensor's settings in PRTG, it is possible to configure the EXE Result to Write EXE result to disk. That way an result debug log from the sensor will be generated on every scan in the following folder(default) of the PRTG Probe where the sensor was set-up:

C:\ProgramData\Paessler\PRTG Network Monitor\Logs (Sensors)\

This debug log may provide additional information to why the script is failing or why PRTG isn't properly picking up the result. The expected result format is documented within PRTG under Setup > PRTG API on the "Custom Sensors" tab.

Best Regards,

Created on Nov 27, 2015 6:46:13 AM by  Luciano Lingnau [Paessler]



Votes:

0

Your Vote:

Up

Down

Do you add the Custom Sensor to the local probe or to a specific server?

Created on Jul 7, 2016 2:14:50 AM by  briandodds (0)



Votes:

0

Your Vote:

Up

Down

@briandodds: You can add the custom sensor to the server in question.
Best regards

Created on Jul 8, 2016 12:05:42 PM by  Konstantin Wolff [Paessler Support]



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.