
Monitor -r 5 machineTooBusy hrProcessorLoad > 2Īnd then ran a service snmpd restart. Following the steps in the net-snmp wiki link, I added this to /etc/snmp/nf: createUser lemonitor SHA lepassword AES In NET-SNMP land, the general idea of a "threshold trap" is done using the DisMan Event MIB. Since I have NET-SNMP, and it is thoroughly documented in the world, I'm going to lean heavily on a couple of references. So, how you go about this part may vary from agent to agent. For most SNMP agents, the idea of "sending based on a threshold" is not a common concept. But, it is also the "least Splunkadelic" part of the question. This is where it actually gets interesting. I'll go with nf because that's how I roll. So, this should be as simple as adding a Data input in the Splunk UI, or editing nf directly. If your trap didn't make it, then you should be looking at things like firewalls and so forth in order to debug the issue. SNMPv2-SMI::snmpModules Cold Start Trap (0) Uptime: 0:00:00.00 Now we do a simple test to see if another host (my Mac) can send an arbitrary trap and have it show up in the log. We can now do a service snmptrapd start and see the daemon start, and see it log a little intro line to the snmptrapd.log file: log]# tail -f snmptrapd.logĬreated directory: /var/lib/net-snmp/mib_indexes OPTIONS="-A -Lf /var/log/snmptrapd.log -p /var/run/snmptrapd.pid" # OPTIONS="-Lsd -p /var/run/snmptrapd.pid" # traphandle SNMPv2-MIB::coldStart /usr/bin/bin/my_great_script coldĪnd in /etc/sysconfig/snmptrapd: # snmptrapd command line options # No traps are handled by default, you must edit this file! In /etc/snmp/nf: # Example configuration file for snmptrapd
Snmp trap receiver java example snmp4j install#
sudo yum install -y net-snmp net-snmp-utils We start by making sure Net-SNMP is installed. I'll use my CentOS 6.2 box as a guinea pig here.
Snmp trap receiver java example snmp4j code#
Limits the amount of code that must run as root to support the "standard" UDP port of 162.It separates the concerns of listening on the socket from indexing the data.Given the options, I would personally choose to run snmptrapd for the following reasons. Make a server able to send traps based on a thresholdįor #1, you can choose to use the native snmptrapd on the host running Splunk, or you can choose to use the modular input.Make a server able to send ANY trap successfully to Splunk (and see it get indexed).Make Splunk able to receive a trap and index it.Let's start out by separating your concerns and working out a logical sequence of first principles to build on.
