New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

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

Free PRTG
Download >>

 

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

 

Top Tags


View all Tags


Monitoring Hyper-V Replication

Votes:

0

Your Vote:

Up

Down

Is there already a way or plan to monitor VM replication in Hyper-V 3.0 (2012) in PRTG?

Regards, PeterFrentin

hyper-v prtg replication

Created on Apr 6, 2013 11:45:59 AM by  Peter Frentin (0) 1



Best Answer

Accepted Answer

Votes:

3

Your Vote:

Up

Down

Hi

Sorry, resurrecting an old entry. We are currently using the following to monitor our Hyper-v Replica's. It takes the hyper-v host the replica's are "stored" on as a variable. We currently run this from the probe device. You will need to probably set both the x32 and x64 powershell to at least a remotesigned execution policy for the local machine.

I am not a programmer so this is rough and use at your own risk

========
param(
[string]$Hypervserver
)

$Session = New-PSSession -computername $Hypervserver 

Import-PSSession $Session -Module Hyper-V

$VMReplication = Get-VMReplication | select name,health,state

Write-Host 	"<prtg>"

foreach ($Name in $VMReplication) {
if ($Name.Health -like "Normal" -and $Name.State -like "Replicating") {
$state = 0
}
else {
$state = 1
}
$VM = $Name.Name

Write-Host 	"<result>" 
		"<channel>$VM</channel>" 
		"<value>$state</value>"
		"<LimitMaxError>0.99</LimitMaxError>"
		"<LimitMode>1</LimitMode>"
		"</result>"
}

Write-Host 	"</prtg>"

Exit 0

========
  

Hope this helps some one

Created on Oct 6, 2014 8:47:24 PM by  rhyse (127) 1 1

Last change on Oct 7, 2014 8:42:01 AM by  Torsten Lindner [Paessler Support]



11 Replies

Votes:

0

Your Vote:

Up

Down

Hello,

thank you very much for this feature request! We appreciate it! I'm very much afraid currently there are no plans to support Hyper-V-Replication, but we have put it on the wishlist. If you'd like, please have a look at the following blog post by our CEO, explaining "How We Rate Your Feature Requests".

It may also be possible for you to create your own custom powershell sensor with powershell scripts similar to the one here Hyper-V Monitoring but you would have to develop this yourself. Custom Scripts

best regards.

Created on Apr 8, 2013 12:19:37 PM by  Torsten Lindner [Paessler Support]

Last change on Apr 8, 2013 12:36:57 PM by  Greg Campion [Paessler Support]



Accepted Answer

Votes:

3

Your Vote:

Up

Down

Hi

Sorry, resurrecting an old entry. We are currently using the following to monitor our Hyper-v Replica's. It takes the hyper-v host the replica's are "stored" on as a variable. We currently run this from the probe device. You will need to probably set both the x32 and x64 powershell to at least a remotesigned execution policy for the local machine.

I am not a programmer so this is rough and use at your own risk

========
param(
[string]$Hypervserver
)

$Session = New-PSSession -computername $Hypervserver 

Import-PSSession $Session -Module Hyper-V

$VMReplication = Get-VMReplication | select name,health,state

Write-Host 	"<prtg>"

foreach ($Name in $VMReplication) {
if ($Name.Health -like "Normal" -and $Name.State -like "Replicating") {
$state = 0
}
else {
$state = 1
}
$VM = $Name.Name

Write-Host 	"<result>" 
		"<channel>$VM</channel>" 
		"<value>$state</value>"
		"<LimitMaxError>0.99</LimitMaxError>"
		"<LimitMode>1</LimitMode>"
		"</result>"
}

Write-Host 	"</prtg>"

Exit 0

========
  

Hope this helps some one

Created on Oct 6, 2014 8:47:24 PM by  rhyse (127) 1 1

Last change on Oct 7, 2014 8:42:01 AM by  Torsten Lindner [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hey Rhyse,

We are dying to get a good replica monitoring. We daily check hundreds of replica statusses....if only prtg had a default sensor for this.... It seems quite simple if you are a programmer, but unfortunatley not for me. there are 3 results with hyper-v replica: normal/warning/critical. Seems like a perfect status for green/orange/red....

I tried your ps1 script, but cannot get it working. error: Response not wellformed: "(New-PSSession : Cannot validate argument on parameter 'ComputerName'. The argum ent is null or empty. Supply an argument that is not null or empty and then try the command again.

Can someone help?

Created on Dec 2, 2014 1:42:25 PM by  ServerProtector (0)



Votes:

0

Your Vote:

Up

Down

Which parameters did you fill in the parameter field of the sensor? Enter the host name of the sensor in quotes and see if you receive a valid result.

"hostname"

Created on Dec 3, 2014 1:42:44 PM by  Felix Saure [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Ok, that helped (I think)

after that filled in, I get a green response with the message 'UnauthorizedAccess' After setting x86 and x64 exectutionpolicy on probe, I get the same red response:

Response not wellformed: "(New-PSSession : [xxxxx.xxx.xxx] Connecting to remote server xxxx.xxx.xxx failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic

setting executionpolicy to unrestricted on hyper-v server does not solve this problem.

Created on Dec 9, 2014 8:11:14 AM by  ServerProtector (0)



Votes:

0

Your Vote:

Up

Down

Seems to be a problem with the remote permissions. Have a look at the following pages:

Entry at Technet for PSRemoting
http://technet.microsoft.com/en-us/library/hh849694.aspx

Enabling non-administrators http://blogs.msdn.com/b/powershell/archive/2009/11/23/you-don-t-have-to-be-an-administrator-to-run-remote-powershell-commands.aspx

Created on Dec 10, 2014 9:54:33 AM by  Stephan Linke [Paessler Support]



Votes:

0

Your Vote:

Up

Down

I set up the script and get back even values, but with the error message "Answer not well-formed". Why is that?

Created on Jan 8, 2015 2:20:30 PM by  uebektas (0)



Votes:

0

Your Vote:

Up

Down

# param([string]$Hypervserver)
$Hypervserver = "servernameofthehypervbox"
# $Session = New-PSSession -computername $Hypervserver 

$VMReplication = Get-VMReplication | select name,health,state

$ErrMessage = " "
$Errors = 0
$Warning = 0
$Critical = 0
foreach ($Name in $VMReplication) {
    if ($Name.Health -like "Normal" -and $Name.State -like "Replicating") {
    $state = 0
    }
    elseif ($Name.Health -like "Warning") {
    $state = 1
    $Warning = $Warning + 1
    }
    elseif ($Name.Health -like "Critical") {
    $state = 1
    $Critical = $Critical + 1
    }


$VM = $Name.Name
$Health = $NAme.Health
$Status = $Name.State
$ErrMessage = $ErrMessage, $VM, " " , $Health , " ", $Status, "`t"
 $Errors = $Errors + 1
}

If ($Errors = 0 ){
Write-Host 0 , ":OK", "Replicating is working fine"
}
elseif ($Critical = 1) {
Write-Host 10 , ":", $ErrMessage 
}
elseif ($Warning = 1) {
Write-Host 5 , ":", $ErrMessage 
}
else {
Write-Host 2 , ":", $ErrMessage
}


Exit 0

change servernameofthehypervbox to your servername

With this you can set also Warning an Error limits (4 and 9)

Created on Jun 5, 2015 12:09:20 PM by  elemer82 (0)



Votes:

0

Your Vote:

Up

Down

we also would like to get a more "integrated" solution for this issue

Created on Jan 27, 2016 10:49:41 AM by  CFU (0)



Votes:

0

Your Vote:

Up

Down

Cleaned up the above scripts a bit (original left connections open). Also I have to run the below in CMD to get Windows 8 to work with the script. I also had to change the user that runs the PRTG service to a domain account.

%SystemRoot%\SysWOW64\WindowsPowerShell\v1.0\powershell.exe "Set-ExecutionPolicy RemoteSigned"
param([string]$Hypervserver)
$Session = New-PSSession -computername $Hypervserver 

Import-PSSession $Session -Module Hyper-V
 
$VMReplication = Get-VMReplication | select Name,Health,State

$ErrMessage = " "
$Errors = 0
$Warning = 0
$Critical = 0
foreach ($Name in $VMReplication) {
    if ($Name.Health -Contains "Normal" -and $Name.State -Contains "Replicating") {
    $stat = 0
    }
    elseif ($Name.Health = "Warning") {
    $stat = 1
    $Warning = $Warning + 1
    }
    elseif ($Name.Health = "Critical") {
    $stat = 1
    $Critical = $Critical + 1
    }

$VM = $Name.Name
$Health = $Name.Health
$Status = $Name.State
$ErrMessage = $ErrMessage, $VM, " " , $Health , " ", $Status, " "
	if ($stat -gt 0) {
	$Errors = $Errors + 1
	}
}

If ($Errors -eq 0 ){
Write-Host 0 , ":OK", "Replicating is working fine"
}
elseif ($Critical -gt 0) {
Write-Host 10 , ":", $ErrMessage 
}
elseif ($Warning -gt 0) {
Write-Host 5 , ":", $ErrMessage 
}
else {
Write-Host 2 , ":", $ErrMessage
}
Remove-PSSession -ID $Session.ID


Exit 0

Created on Feb 5, 2016 4:44:43 PM by  polskifacet (0) 1

Last change on Feb 10, 2016 12:38:54 PM by  Torsten Lindner [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Many thanks. Once I'd put the server name parameter within inverted single commas this works well. It would be nice if there was a supported integrated sensor for this.

Created on Jul 8, 2016 4:10:23 PM by  Mark Underhill (0)



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.