SNMP client

Revision as of 15:04, 12 June 2014 by WikiFreak (talk | contribs) (Created page with "Category:Linux =SNMP configuration= Simple Network Management Protocol (SNMP). SNMP is a technnology use to monitor your network components, servers and workstations. ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


SNMP configuration

Simple Network Management Protocol (SNMP).

SNMP is a technnology use to monitor your network components, servers and workstations. Each component will expose some status, settings and events. All that can be use and process to generate health reports, alerts and trigger some actions.


Installation

You need to install SNMP + SNMPD packages. The daemon is required to start the SNMP agent automatically on each reboot.

apt-get install snmp snmpd
apt-get install libsnmp-perl libsnmp-info-perl


Since ubuntu 12.04 you need to install the sensors (MIBs) separatly due to legal issues.

apt-get install snmp-mibs-downloader


Zabbix server specific

Zabbix server also required some specific SNMP libraries:

apt-get install libnet-snmp-perl python-netsnmp


SNMP agent configuration

Edit the configuration file:

vim /etc/snmp/snmpd.conf


Adjust the following options:

####### General
# Run as SNMP agent
master   agentx

###############################################################################
#  AGENT BEHAVIOUR
#
# Listen for connection from all interfaces - required if you want to use a central monitoring server
agentAddress udp:161,udp6:[::1]:161

###############################################################################
#  SNMPv3 AUTHENTICATION
#
createUser vehco


###############################################################################
#  ACCESS CONTROL
#
# ... default "view" settings



####### SNMP v1 / SNMP v2
### Read / write communities
rwcommunity   vehco     172.16.50.0/24

### Read-only communities
# Allow full access from localhost
rocommunity   public    default           -V systemonly
# Allow full access to LAN community
rocommunity   vehco     172.16.50.0/24 

####### SNMP v3
## Read / write user
rwuser   vehco         noauth
 
## Read-only users
rouser   authOnlyUser
rouser   internalUser


###############################################################################
#  SYSTEM INFORMATION

####### SysInformation
sysLocation   Goteborg
sysContact    guillaume@qin-diaz.com

# Application + End-to-End layers (default)
sysServices    72


# ... default value for all others settings


###############################################################################
#  ACTIVE MONITORING
#

####### Traps (SNMP event push)
#  Note that you typically only want *one* of these three lines
#  Uncommenting two (or all three) will result in multiple copies of each notification.
# 
#### SNMP v1 receiver
#trapsink      localhost              public
#### SNMP v2 receiver
trap2sink     smartcard-monitoring   vehco
#### SNMP v2 informer
#trap2sink     smartcard-monitoring   vehco


# Trap community
trapcommunity vehco

# Send traps on authentication failure
authtrapenable 1


# ... default value for all others settings



SNMP daemon configuration

Since you have installed the "snmp-mibs-downloader" package you need to comment the default daemon option.

vim /etc/snmp/snmp.conf


Comment the "mibs" line:

#mibs :


Restart the SNMP service:

service snmp restart


Service testing

Run the following command:

# Localhost test
snmpwalk -v2c -c public localhost

# Check what's available on the network -- Use your own client's IP @
snmpwalk -v2c -c vehco 172.16.50.12


-Note-

  • v2c = SNMP v2
  • v3 = SNMP v3


Expected result:

  • You should see some key:value in form of "IF-MIB::ifOperStatus.116 = INTEGER: up(1)" or "SNMPv2-MIB::sysServices.0 = INTEGER: 2"


Known bugs:

  • if you see something like "iso.1.2.3.4 ... : value" then you forget to comment the mibs : in /etc/snmp/snmp.conf. You configuration is not correct.



Check that you can retrieve the rights params:

# Retrieve computer name [local]
snmpget -v2c -c public localhost "SNMPv2-MIB::sysName.0"

# Retrieve computer name [network]
snmpget -v2c -c vehco 172.16.50.12 "SNMPv2-MIB::sysName.0"




References