Question

I am new to snmp and after some readings I have 2 questions:-

1) Does net-snmp AUTOMATICALLY sends trap when we configure agent's snmpd.conf file with directives like trapsink, monitor, etc. for inbuilt OIDs like cpu and disk??

I am asking because I am trying to send a trap when cpu goes beyond 90%. My agent and master are on the same linux box.

My snmptrad.conf file:-

authCommunity log aaa
authCommunity log public

My snmpd.conf file (removing extra comment lines):-

master agentx com2sec notConfigUser default public

group notConfigGroup v1 notConfigUser group
notConfigGroup v2c notConfigUser

view systemview included .1.3.6.1.2.1.1 view systemview
included .1.3.6.1.2.1.25.1.1 view all included .1 view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc

access notConfigGroup "" any noauth exact systemview none none

createUser internalMonitoringName SHA mysecretpassword AES rouser internalMonitoringName iquerySecName internalMonitoringName

com2sec local localhost aaa
com2sec net-27 10.0.0.0/8 aaa
com2sec net-46 10.9.46.0/24 aaa
com2sec net-60 10.9.60.0/24 aaa
com2sec net-10 10.20.0.0/16 aaa

group MyRWGroup any local
group MyROGroup any net-27
group MyROGroup any net-46
group MyROGroup any net-60
group MyROGroup any net-10

access MyROGroup "" any noauth 0 all none none
access MyRWGroup "" any noauth 0 all mib2 mib2

syslocation "Somewhere in testlab"
syscontact Root root@localhost

dontLogTCPWrappersConnects yes

trap2sink localhost aaa

monitor -r 30 machineTooBusy hrProcessorLoad > 90

When I run some process to increase cpu load, the cpu load goes beyond 90% (I can see that in top command) but I can't see the trap message in /var/log/messages.

What I am doing wrong here?

2) Also, my next question is, if I have a custom MIB file for which I have wrtten an agent, Can I add the variable/OID from that custom MIB with "monitor" directive in snmpd.conf file to send trap AUTOMATICALLY? OR I must send trap from within my agent???

Please help on my confusion...

Was it helpful?

Solution

No, it doesn't send anything automatically. You have two steps to follow:

1) define where you want to send traps or informs. That's what the trapsink and similar lines do.

2) then define what you want sent. That's what the monitor and similar directives do. The monitor directive can be used to monitor just about anything, including your own custom MIB variables.

When you include both of these, then it'll send out traps automatically (by doing internal monitoring, and then sending a trap to each configured trapsink or other destination).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top