Pandora FMS Community

Returning DHCP Info using Powershell

m25m · 28 abr 2021, 23:34 · 3 mensajes · 114 visitas

  1. Inicio del debate

    I'm trying to learn how to create a custom module to monitor DHCP Address usage on a Windows DHCP server. Server is 7.0NG.750(Build 201111) Here's what I have so far: This Powershell command returns the information:

    PS C:Windowssystem32> Get-DHCPServerv4ScopeStatistics | Select-Object -Property ScopeId,Free
    
    ScopeId     Free
    -------     ----
    10.100.0.0   137
    192.168.1.0  133
    

    I put that into pandora_agent.conf at the bottom of the file like this:

    # DHCP Stats
    module_begin
    module_name DHCPStats
    module_type generic_data
    module_exec C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -Command "Get-DHCPServerv4ScopeStatistics | Select-Object -Property ScopeId,Free"
    module_description Show Available DHCP Addresses
    module_end
    

    After saving the file and restarting the agent, nothing appears, except  Warning: Non-initialized modules found However, I am not finding an explanation so far on what that means or how to resolve it. Thank you for your assistance.

  2. Hello, I think this may fail for several reasons, the first is the type of data you are trying to use, from what I see in the output of the command there are several letters and symbols, which does not support the type of module "generic_data". When this happens is when we see that the modules are never initialized. On the other hand, I don't think that changing the data type is going to work for you, since you are extracting several data and trying to register them in the same module... My advice is to make a script that creates one module per data obtained, ignoring the command header. If you do it this way, using the "generic_data" data type should work for you. Greetings Diego

  3. Diego, thank you for your reply.

Entra en tu cuenta para publicar.