Hi,
I created a custom sensor for our system which scans within VMM for checkpoints and shows how many days ago the checkpoints have been created. For the ones who are interested:
#Imprting the Virtual Machine Manager Module Import-Module "VirtualMachineManager" #Define the VMM Host $vmHost = "Your VM HOST" #Get the current date $CurrentDate = (Get-Date) #Variable that will get all VM's that has checkpoints $vm = Get-SCVMCheckPoint -VMMServer $vmHost | Select VM, AddedTime #Converting to a PRTG Sensor $xmlstring = "<?xml version=`"1.0`"?>`n <prtg>`n" foreach($vmCheckPoint IN $vm) { $TotalDays = (New-TimeSpan -Start $vmCheckPoint.AddedTime -End $CurrentDate).Days $xmlstring += " <result>`n" $xmlstring += " <channel>$($vmCheckPoint.VM)</channel>`n" $xmlstring += " <unit>Custom</unit>`n" $xmlstring += " <CustomUnit>Days</CustomUnit>`n" $xmlstring += " <mode>Absolute</mode>`n" $xmlstring += " <showChart>1</showChart>`n" $xmlstring += " <showTable>1</showTable>`n" $xmlstring += " <float>0</float>`n" $xmlstring += " <value>$(IF ($TotalDays -lt 1) {"0"} ELSE {IF ($TotalDays -le 14) {$TotalDays.ToString("#")} ELSE {"14"}})</value>`n" $xmlstring += " <LimitMaxError>14</LimitMaxError>`n" $xmlstring += " <LimitMaxWarning>10</LimitMaxWarning>`n" $xmlstring += " <LimitWarningMsg>VM Checkpoint is in Warning state</LimitWarningMsg>`n" $xmlstring += " <LimitErrorMsg>VM Checkpoint is in Critical state</LimitErrorMsg>`n" $xmlstring += " <LimitMode>1</LimitMode>`n" $xmlstring += " </result>`n" } $xmlstring += " </prtg>" Write-Host $xmlstring
(just change the $vmHost to your own host)
The reason I created this is that we (as a team) sometimes forget to delete the checkpoint after we have created them.
This sensor reminds us that there is a checkpoint and will give a warning after 10 days and an alarm after 14 days.
This sensor works FINE until you actually remove the checkpoint. Because it cannot get any data anymore it gives an error and thus causing an alarm.
Is there a way we can delete channels within PRTG? I have understood that is not something that can be done within PRTG am I correct?
We cannot hide the channels that have no checkpoints because they might get a checkpoint in the future.
Thanks,
Engin
Add comment