Table of content
Installation of an SNMP server providing access to management data such as networking activities, memory use, processes status, … Data will be shared read-only and protected by a simple password (aka: community string).
Build information
Ensure the following options:
| 1 2 3 4 5 |  | 
Configuration
The SNMP daemon is configured for a read-only access from the
community community-string, only the
MIBs which are used will be exported.
It’s possible to split the configuration in two separate files, the
first one holding a generic configuration (snmpd.conf), the
second one holding a configuration specific to the computer
(snmpd.local.conf).
snmpd.conf
The information is shared read-only and is only protected by a
password: community-string. 
The 2c version of the protocol is used. 
The version 3 would have allowed a stronger security with the
integration of confidentiality, integrity and authentication.
| 1 2 3 4 5 6 7 8 9 10 11 |  | 
Set the different level of visibility for the MIBs, the information which will be published are about the network interfaces, resources (memory, process, disk), system status (temperature) and imap.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 |  | 
AgentX (RFC 2741) is a protocol allowing external programs
to extend the SNMP agent with their own management information,
communication is done through the use of a UNIX socket. This will be
used, for example, by Cyrus IMAP with the OID
enterprises.3.6.
If the agentx group is not present on the system,
another appropriate group can be used (wheel, …). Or
the group can be created using a free id number, here we use the
arbitrary value of 1025:
| 1 |  | 
| 1 2 3 4 5 |  | 
It is also possible to extend net-snmp with a perl script thank to the
embedded interpreter. Adding CPU temperature and frequency is done
through this script, in the UCD-SNMP-MIB::systemStats branch.
| 1 2 3 |  | 
snmpd.local.conf
syslocation and syscontact entries need
to be tailored:
| 1 2 3 4 5 6 |  | 
During disk device analyses, the snmpd daemon can get stuck until a
timeout is reached. To avoid this situation the
ignoredisk directive is used.
Extending
Temperature
Extending is done at the netSnmp MIB, which is part of
UCD-SNMP-MIB::systemStats.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |  | 
Startup
To allow automatic startup, the following line is added to the
/etc/rc.conf file:
| 1 |  | 
MIBs
Information can be accessed by using a name instead of it’s numerical representation (OID). For that purpose a MIB definition must be installed.
If the MIB is not already present, it must be added and made available:
- 
    Adding (globaly or locally): Adding to MIBs repository 1 2 cp my-mib.txt /usr/local/share/snmp/mibs/ # Adding globaly cp my-mib.txt $HOME/.snmp/mibs/ # Adding localy
- 
    Making available (one time usage, globaly, or localy): Notify of new MIBs to use 1 2 3 export MIBS=+MY-MIB # One time usage echo "mibs +MY-MIB" >> /usr/local/etc/snmp/snmpd.conf # Global usage echo "mibs +MY-MIB" >> $HOME/.snmp/snmp.conf # Local usage