Jannos-443 / PRTG-DHCP-Stats

Monitors DHCP Scopes and Failover Status
MIT License
4 stars 1 forks source link

PRTG-DHCP-Stats.PS1

About The Project

Project Owner: Jannos-443

PRTG Script to monitor Windows DHCP

Free and open source: MIT License

Features

Getting Started

  1. Place PRTG-DHCP-Stats.ps1 under C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML

  2. Place the lookup File dhcp.failover.mode.ovl dhcp.failover.state.ovl under C:\Program Files (x86)\PRTG Network Monitor\lookups\custom

  3. Run PRTG Lookup File Reload

  4. Install DHCP-Servertools on the PRTG Probe (DHCP Powershell Module)

    PRTG-DHCP-Stats

  5. create a "EXE/Script Advanced" sensor. Choose this script from the dropdown and set at least:

    • Parameters: -DHCPServer %host or -DHCPServer "YourDHCPServer"
    • Security Context: Use Windows credentials of parent device
    • User needs "DHCP Users" AD Permission!
    • PRTG-DHCP-Stats
  6. Set the $ExcludeScope or $IncludeScope parameter to Exclude/Include DHCP Scopes if needed

Examples

-DHCPServer "YourDHCPServer" -CheckFailOver -PercentageInUse

Display Failover and PercentageInUse channels PRTG-DHCP-Stats

-DHCPServer "YourDHCPServer" -AddressesFree -AddressesInUse

Display AddressesFree and AddressesInUse channels PRTG-DHCP-Stats

DHCP Scope exceptions

You can either use the parameter $ExcludeScope to exclude a DHCP Scope on sensor basis, or set the variable $ExcludeScript within the script. Both variables take a regular expression as input to provide maximum flexibility. These regexes are then evaluated againt the DHCP Scope ID

By default, the $ExcludeScript varialbe looks like this:

$ExcludeScript = '^(TestIgnore)$'

For more information about regular expressions in PowerShell, visit Microsoft Docs.

".+" is one or more charakters ".*" is zero or more charakters