Hello community
I created a new powershell sensor to read out free IP Adresses from a DHCP server:
param([string]$sitename) function Set-PrtgResult {} function Set-PrtgError {} #functions downloaded from https://github.com/brianaddicks/prtgshell try { $scope1 = ((Get-DhcpServerv4Scope -ComputerName srvmwdhcp01.domain.local | Where name -eq $sitename).ScopeId).IPAddressToString $freeIPs = Get-DhcpServerv4ScopeStatistics -ComputerName srvmwdhcp01.domain.local -ScopeId $scope1 | select free -ExpandProperty free $usedIPs = Get-DhcpServerv4ScopeStatistics -ComputerName srvmwdhcp01.domain.local -ScopeId $scope1 | select InUse -ExpandProperty InUse $totalIPs = $freeIPs + $usedIPs $XMLOutput = "<prtg>`n" $XMLOutput += Set-PrtgResult "Total IPs" $totalIPs "" $XMLOutput += Set-PrtgResult "Free IPs" $freeIPs "" $XMLOutput += "</prtg>" } catch { $XMLOutput = "<prtg>`n" $XMLOutput += Set-PrtgError "Irgndöppis isch mächtig id Hose" $XMLOutput += "</prtg>" } return $XMLOutput.ToString()
It runs very good. Problem is, it creates two channels. Free IPs and Total IPs. I would like to have only one channel showing free IPs where the Total IPs is the "max" value that can be achieved. I would like to have a field in a channel where i can define a maximum to scale it correctly. I know i can scale it in PRTG manually. Problem is, that the max value is different for every DHCP Scope and i'd have to maintain it manually for every sensor. Is there a possibility to do that?
I've seen the taglist provided here: https://www.paessler.com/manuals/prtg/custom_sensors But none of these seem to fit. Any help is appreciated.
Thanks
Add comment