## Guidelines to generate SNMP traps in OpenPegasus

Version: 0.1
Created: Feb 24th 2011

### Overview

The following document serves as a guide on how to setup net-snmp to enable SNMP trap generation from Open Pegasus. This guide requires a basic understanding of net-snmp (www.net-snmp.org). This guide is intended to help developers and administrators to setup Open Pegasus to generate snmp traps.

### Related Information

Refer to the following PEP’s to understand the SNMP support in Open Pegasus.

- PEP#062 - PEP#062 - SNMP Mapper Backgrounder , PEP#062 - SNMP Mapper Indication Handler
- PEP#357 - PEP#357 - SNMP v3 trap generation in Pegasus

### Building Pegasus with SNMP

To build Pegasus with SNMP support, you will need to build against the Net-SNMP bundle. Pegasus has to be built with PEGASUS_USE_NET_SNMP=true. By default Snmp V3 trap generation is enabled. To disable it build with PEGASUS_ENABLE_NET_SNMPV3=false.

### Creating net-snmp user

To enable sending snmp v1 and v2C traps add the following line in /etc/snmp/snmptrapd.conf

authcommunity log,execute,net public

To enable sending snmp V3 traps from an example user, “sahana”, with password “setup_passphrase”, authentication protocol MD5, privacy protocol DES and with engine id “0x80001f88808a67e858ee38ec4c” follow the below steps:

1. The following needs to be present in snmptrapd.conf

“authUser log,execute,net sahana"

2. Add following line to /etc/snmp/snmpd.conf

# VACM configuration entries
rwuser sahana
# USM configuration entries
createUser sahana MD5 setup_passphrase DES à this line is not needed in Suse.

3. #service snmpd stop

4. To change the engine id of the SNMP user on RHEL edit /var/net-snmp/snmpd.conf to change the engine id of the new user sahana created. Edit the 4th column to have the following value for engine id, 0x80001f88808a67e858ee38ec4c. On Suse Linux add line "createUser -e 0x80001f88808a67e858ee38ec4c sahana MD5 setup_passphrase DES setup_passphrase" in /var/lib/net-snmp/snmpd.conf.

5. service snmpd restart

6. Check if entry in /var/net-snmp/snmpd.conf has the changed engine id.

7. service snmptrapd stop

8. Add the following entry in RHEL in /var/net-snmp/snmptrapd.conf or on SUSE in /var/lib/snmp/snmptrapd.conf

createUser -e 0x80001f88808a67e858ee38ec4c sahana MD5 setup_passphrase DES setup_passphrase

9. service snmptrapd start; service snmptrapd stop;

10. Check if the entry similar to the below is created in /var/net-snmp/snmptrapd.conf

usmUser 1 3 0x80001f88808a67e858ee38ec4c 0x736168616e6100 0x736168616e6100 NULL .1.3.6.1.6.3.10.1.1.2 0xc6ba3349675003521469de1cb7dea212 .1.3.6.1.6.3.10.1.2.2 0xc6ba3349675003521469de1cb7dea212 0x00

To verify if user ”sahana” can send SnmpV3 traps do the following:

1. snmptrapd -f -Lf /tmp/snmplog &

2. snmptrap -v 3 -n "" -a MD5 -A setup_passphrase -l authNoPriv -u sahana -e 0x80001f88808a67e858ee38ec4c localhost 0 coldStart.0

3. cat /tmp/snmplog à should list the new tarp on coldstart

### Resources

For information on net-snmp refer to http://net-snmp.org

To run OpenPegasus tests for generating net-snmp traps refer to http://cvs.opengroup.org/cgi-bin/viewcvs.cgi/pegasus/src/Pegasus/Handler/snmpIndicationHandler/tests/testclient/

Licensed to The Open Group (TOG) under one or more contributor license agreements. Refer to the OpenPegasusNOTICE.txt file distributed with this work for additional information regarding copyright ownership. Each contributor licenses this file to you under the OpenPegasus Open Source License; you may not use this file except in compliance with the License.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.