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 !
Fabien,
Great effort!
quick question: does your resource cSNMPManager allow for enforcing a setting of “Accept SNMP packets from any host”?
My tests seem to indicate this means deleting all registry values (1-9) under HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesSNMPParametersPermittedManagers
which of course I could enforce one-by-one, but a shorter solution would be nice…
Hi Pieter,
Thanks for your comment π
Right now, it’s not possible, but i’ll commit a new version where you’ll find a resource to enable packets from any hosts checkbox.
If i’ve got time enough, you can excepect it on monday GMT time π
Regards,