What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Custom Sensor Channel gives error when not receiving data

Votes:

0

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

checkpoint scvmm vmm

Created on Jul 17, 2019 1:59:31 PM



1 Reply

Votes:

0

Engin,

Correct, at this time, you would have to remove the sensor, and re-create it to have it scavenge any non-functional channels. The only other option would be to turn off the PRTG Core Server service, and manually remove the channel data from the PRTG Configuration file. I highly recommend against doing this.

Benjamin Day
Paessler Support

Created on Jul 18, 2019 4:21:52 AM by  Benjamin Day [Paessler Support] (1,441) 2 1




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.