Search code examples
snmp

SNMP Trap on Unix


Nearly for 6 days i 'm trying to get over this problem .

I have 2 machines . One of them is manager 10.201 machine, and the other is agent (10.226)

i've configured manager's snmptrap.conf file like this .

authCommunity  execute  public      default  .1
traphandle  default /usr/bin/traptoemail -s localhost -f snmp@localhost root@localhost

and then i've configured agent's snmpd.conf file like this.

###########################################################################
# SECTION: Access Control Setup

rocommunity  public  
rwcommunity  private



###########################################################################
# SECTION: System Information Setup

syslocation  "Izmir, 226. machine "
syscontact  [email protected]

###########################################################################
# SECTION: Trap Destinations

trap2sink  10.0.0.201  162

authuser   read -s v2c guest_user noauth  .1
authuser   read -s usm guest_user noauth  .1
authcommunity read  public  default .1
iquerySecName guest_user
agentSecName  guest_user

monitor   -u guest_user  -r  1  "interface down" -o ifDescr ifOperStatus != 1

But I want to trap for agent machine's CPUIdle rate. For example I can get CpuIdle like this way by snmpwalk command.

# snmpwalk -v 2c  -c public 10.0.0.226 .iso.org.dod.internet.private.enterprises.ucdavis.systemStats.**ssCpuIdle**.0

* I want to trap to manager host(10.0.0.201) when agent's (10.0.0.226) *ssCPuIdle rate is over 98.*

Is there anyone can help me ? Where I ve done mistakes,conf files or anything else ?


Solution

  • One thing to note is that the ssCpuIdle variable is actually going away. It was measured over a fixed period of time, which is a problem as it's inaccurate.

    If you still want to use it on an old version of snmpd, then the following monitor line will probably do what you want:

    monitor   -u guest_user  -r  1  "idle too high"  ssCpuIdle > 97
    

    If you use the newer ssCpuRawIdle object, then you'll need to monitor it's delta instead:

    monitor   -u guest_user  -r  1  "idle too high" -D ssCpuRawIdle > NUMBER
    

    But the size of the NUMBER will likely depend on the system in question (specifically, how many cores). You can use the description of the object to come up with an initial calculated guess and go from there:

      DESCRIPTION   "The number of 'ticks' (typically 1/100s) spent idle.
    
                 On a multi-processor system, the 'ssCpuRaw*'
                 counters are cumulative over all CPUs, so their
                 sum will typically be N*100 (for N processors)."