I would like to create a MapObject, where I could display the data of all channels from a sensor and not just the primary. Just like the gauge object but without the gauges or the graph object but of cause without the graph.
For Example I have a custom Powershell Sensor which lists all VMs with snapshots on it with the help of PowerCLI. On my map/dashboard I have an area for vm related monitoring where I want to display a list of vm-Names with VMs which have a current snapshot. Here my Custom PS Sensor:
______________________________________
Connect-VIServer -Server *** -User ***
$VMList = Get-VM | Get-Snapshot | Select-Object VM, Name, Created
$CurrentDate = Get-Date
$SnapshotCount = $VMList.COUNT
$output = @"
<?xml version=`"1.0`" encoding=`"UTF-8`" ?>
<prtg>
<result>
<channel>Snapshot Count</channel>
<value>$SnapshotCount</value>
<CustomUnit>snps</CustomUnit>
<showChart>0</showChart>
<showTable>0</showTable>
</result>
"@
foreach ($VM in $VMList) {
$VMName = $VM.VM
$SnapshotDate = [datetime]$VM.Created
$timebetween = New-TimeSpan -Start $SnapshotDate -End $CurrentDate
$daysbetween = $timebetween.Days
$tobeappended = @"
<result>
<channel>$VMName</channel>
<value>$daysbetween</value>
<CustomUnit>Days</CustomUnit>
<showChart>1</showChart>
<showTable>1</showTable>
</result>
"@
$output = $output + $tobeappended
}
$endofoutput = @"
</prtg>
"@
$output = $output + $endofoutput
[Console]::WriteLine($output);
_____________________________________
Don't judge the naming of my variables^^
This script will create for all of the VMs with an active snapshot a separate channel with the value of "days since last snapshot".
Thanks for your help :)