DSC resource for managing SNMP configuration

Desired State Configuration is a key feature in PowerShell, even more with the last November preview, available since yesterday !

So, little by little, i’m migrating all my customization steps from powershell scripts to DSC Resources, and today i decided to share a quick one, but a mandatory part of my servers configuration, the monitoring part.

This custom resource will permit you to add various number of communities, to add as much manager as you want, enable traps, add comunities for traps and manager for each of theses communities. Bellow you’ll see how use these resource inΒ  you configuration script

As always, you should put the cSNMP folder in your modules directory πŸ˜‰

Configuration Test {

    Import-DscResource -modulename cSNMP

    Node localhost {

        cSNMPEnableAuthenticationTrap trapenable {
            EnableAuthenticationTraps = "1"
            Ensure = "Present"
        }

        cSNMPCommunity Nagios {

            Community = "Nagios"
            Right = "ReadOnly"
            Ensure = "Present"
        }
        
        cSNMPManager NagiosServer {
            Manager = "srvmonitor0"
            Ensure = "Present"
        }
        
        cSNMPTrapCommunity NagiosTrap {
            Community = "Nagios"
            Ensure = "Present"
        }

        cSNMPTrapDestination NagiosTrapServer {
            Community = "Nagios"
            Destination = "172.16.10.252"
            Ensure = "Present"
        }

    }
}


Push-Location G:\Scripts
Test

You can download the full resources module on my github !

If you have remarks or comments on this module, feel free to use comments on this blog or open an issue on github, thanks !