New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.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


Hyper-V get a list of snapshots

Votes:

0

Your Vote:

Up

Down

Hi,

snapshots that are not deleted can often lead to problems. Also it can negatively affect the performance. So I want to see which Hyper-V machine has snapshots. Probably with an option to only warn if the snapshot persists for longer than 2 weeks.

I have found this article online http://blog.abakus.de/artikel/prtg-network-monitor-teil-3-snapshots-hyper-v/ and I tried to modify the script to instead work with the powershell cmd Get-VMSnapshot but I just couldn't get it to work.

Maybe someone already has a script that does that or can point me in the right direction?

thanks, Dominik

checkpoint hyper-v snapshot

Created on Jul 10, 2017 8:43:18 AM by  Dominik Protzek (60) 1 1



Best Answer

Accepted Answer

Votes:

1

Your Vote:

Up

Down

Found a solution:

$x= 0
$i= Invoke-Command –ComputerName 'Hostname' –ScriptBlock{Get-VMSnapshot -VMName * | measure}
$i=$i.Count


if ($i  -eq 0) {
  $x=[string]$i+":OK"
  write-host $x
  exit 0
}
ElseIf ($i -eq 5) {
  $x=[string]$i+": 5 Snapshots"
  write-host $x

  exit 1
}
ElseIf ($i -lt 5) {
  $x=[string]$i+": <5 Snapshots"
  write-host $x

  exit 1
}


ElseIf ($i -gt 5) {
  $x=[string]$i+": >5 Snapshots"
  write-host $x
  exit 1
}

Else 
{
  $x=[string]$i+":Invalid"
  write-host $x
  exit 2
}

cheers dominik

Created on Jul 19, 2017 12:49:18 PM by  Dominik Protzek (60) 1 1



3 Replies

Votes:

0

Your Vote:

Up

Down

Hey Dominik Protzek,
Thanks for your KB-posting.

If you are able to convert and evaluate the return-values of the $list = Get-SCVMCheckpoint -VMMServer $server command line you should be able to force the sensor in PRTG into a warning/error state by using the result

<prtg>
   <error>1</error>
   <text>Your error message</text>
</prtg>

However, please note that we cannot support you in writing custom scripts.

Best regards,
Sven

Created on Jul 12, 2017 11:08:52 AM by  Sven Roggenhofer [Paessler Technical Support]



Accepted Answer

Votes:

1

Your Vote:

Up

Down

Found a solution:

$x= 0
$i= Invoke-Command –ComputerName 'Hostname' –ScriptBlock{Get-VMSnapshot -VMName * | measure}
$i=$i.Count


if ($i  -eq 0) {
  $x=[string]$i+":OK"
  write-host $x
  exit 0
}
ElseIf ($i -eq 5) {
  $x=[string]$i+": 5 Snapshots"
  write-host $x

  exit 1
}
ElseIf ($i -lt 5) {
  $x=[string]$i+": <5 Snapshots"
  write-host $x

  exit 1
}


ElseIf ($i -gt 5) {
  $x=[string]$i+": >5 Snapshots"
  write-host $x
  exit 1
}

Else 
{
  $x=[string]$i+":Invalid"
  write-host $x
  exit 2
}

cheers dominik

Created on Jul 19, 2017 12:49:18 PM by  Dominik Protzek (60) 1 1



Votes:

0

Your Vote:

Up

Down

Hey Dominik,

Thank you very much for sharing this. We really appreciate it.

Cheers,
Sven

Created on Jul 20, 2017 5:40:36 AM by  Sven Roggenhofer [Paessler Technical 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.