Nagios core – SNMP – monitor ethernet adapter bandwidth – part 1

In this part we will configure SNMP on Windows and Linux servers:

Linux (debian/ubuntu) SNMP install and config:

    1. Install required packages
      apt-get install snmpd snmp snmp-mibs-downloader
    2. configure SNMP
      add/change in /etc/snmp/snmpd.conf :
      
      agentAddress udp:161,udp6:161
      rocommunity your_community_string Nagios_Core_server_IP
      
    3. update iptables
      iptables -A INPUT -i eth0 -p udp -s Nagios_Core_server_IP --dport 161:162 -j ACCEPT
      iptables -A OUTPUT -p udp -d Nagios_Core_server_IP --dport 1024:65535 -j ACCEPT

Windows Config:

1. Install and configure snmp with this Powershell script:

Import-Module ServerManager
Install-WindowsFeature -Name 'SNMP-Service','RSAT-SNMP'

# ENTER YOUR CONFIG HERE:
$pollers = @("Nagios_Core_server_IP")
$CommunityStr = @("your_community_string")

#test if SNMP-Service Feature is enabled
$test = Get-WindowsFeature -Name SNMP-Service

#Install/Enable SNMP-Service if it is not enabled
If ($test.Installed -ne "True") {
Write-Host "Enabling SNMP-Service Feature"
Get-WindowsFeature -name SNMP* | Add-WindowsFeature -IncludeManagementTools | Out-Null
}

#re-test if SNMP-Service Feature is enabled and update variable
$test = Get-WindowsFeature -Name SNMP-Service

#Setup reg keys to configure SNMP-Service if Feature is Enabled
If ($test.Installed -eq "True"){
Write-Host "Configuring SNMP-Services with your Community strings and Permitted pollers"
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\PermittedManagers" /v 1 /t REG_SZ /d localhost /f | Out-Null

Foreach ($String in $CommunityStr){
reg add ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\TrapConfiguration\" + $String) /f | Out-Null
reg delete ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\TrapConfiguration\" + $String) /ve /f | Out-Null
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\ValidCommunities" /v $String /t REG_DWORD /d 4 /f | Out-Null
$i = 2

Foreach ($Manager in $pollers){
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\PermittedManagers" /v $i /t REG_SZ /d $manager /f | Out-Null
reg add ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\TrapConfiguration\" + $String) /v $i /t REG_SZ /d $manager /f | Out-Null
$i++
}
}
}

 

 

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

13 − 9 =

This site uses Akismet to reduce spam. Learn how your comment data is processed.