18 January 2014

Installing Net-SNMP and SNMPTT in Fedora 20

Documenting this on-the-fly for my reference and anyone else who would find it useful.After freshly installing Fedora 20, I was perplexed to find that it didn't have gcc or g++ installed. So step 1 is to get them. (You don't really have to use sudo in all steps below)sudo yum install gcc sudo yum install gcc-c++You can also optionally install mysql (if you wish to have MYSQL Trap Logging) like so:

Or if you don't want embedded perl, type (you'll need to install with embedded perl for this tutorial):

sudo ./configure --with-perl-modules --with-mysql

You'll be given a lot of options. Just keep pressing enter for all of them (unless you want to configure it differently).Once configuration is done, type:

sudo make -j 4The -j 4 is to tell make that it can use the four cores of my processor. It works faster this way, by dividing the make process into separate jobs which complete parallelly. You can also simply type "sudo make". At any point if you want to redo the make process, type "sudo make clean" and you'll be able to start from the configure step again.

Now you can optionally start "make test" which is
not really required, but it is what helped me find out that I didn't
have ExtUtils-MakeMaker installed. I wasn't able to make install without
it, and the net-snmp mailing list was unable to figure it out either. I
updated the mailing list with the solution when I found it.sudo make testsudo make install ...and tadaah! You now have net-snmp installed!The snmptrapd file which snmptt requires, you'll now find installed in /usr/local/sbin/snmptrapd

To be able to start and stop snmptrapd, a script is also included. sudo cp /usr/local/net-snmp-5.7.2/dist/snmptrapd-init.d /etc/rc.d/init.d/snmptrapd

You can optionally use the above script to start snmptrapd with the command "sudo service snmptrapd start"or "snmptrapd -On"

------------------------------------Now for snmptt:Extract the snmptt tar file into /usr/local/ using:sudo tar -xvzf snmptt_1.4.tgzNavigate into the newly created snmptt_1.4 directory and create a file named snmptrapd.conf:

sudo vim snmptrapd.confTo test out snmptrapd, add the line "disableAuthorization yes" to the snmptrapd.conf file (remove this line later for proper authorizations) and type the following command at the terminal:

snmptrapd will start and will keep listening for traps.Meanwhile, download and start a MIB browser like the one iReasoning has.Go
to Tools > Trap sender in the MIB browser and type the address
to send traps to, as "localhost" (without the quotes). Then click the
"Send Trap" and immediately, you'll see the trap being received at the
terminal where you started snmptrapd.

You have the choice of installing snmptt as a standard handler or as an embedded handler. I'd recommend installing as the embedded handler, because it is loaded when snmptrapd is started, so it won't need a process to be created everytime a trap is received (which is what happens with the standard handler). Type the following commands:

sudo cp examples/snmptt.conf.generic /etc/snmp/snmptt.confsudo mkdir /var/log/snmptt/Open the snmptrapd.conf file and add the following line to it "perl do
"/usr/sbin/snmptthandler-embedded";"sudo mkdir /var/spool/snmpttsudo cp snmptt-init.d /etc/rc.d/init.d/snmptt (this is a script that can be used to start and stop snmptt)and now add snmptt as a service:sudo chkconfig --add snmpttConfigure snmptt to start at runlevel 2345 sudo chkconfig --level 2345 snmptt on

The above command will start snmptt automatically on reboot. You can also start it right now using:

sudo service snmptt start

To stop it, use:sudo service snmptt stopCopy a script to rotate log files: sudo cp snmptt.logrotate /etc/logrotate.d/snmptt (you can edit this file if you wish)

Special Posts

Etcetera

You can call me a versatile creator. I'm known for quickly adopting new technologies and creating good quality working products with them. Apart from spending most of my life getting people to pronounce my name correctly, I also have a taste for fun, adventure and unprejudiced thought.