I have some question about SNMP and using traps.
I'm not an SNMP expert, but I understand and know a bit how to use SNMP tools.
Before describing what I would exactly want to do, I would ask a little question about SNMP traps.
In brief, I have read this tutorial about Net-SNMP : and I try to test snmptrap
on my agent and manager. I defined SNMPV1 trap and SNMPV2 notifications on the agent the way indicated in the tutorial, and try same commands to send snmpv1 traps and snmpV2 notification.
My question is about the snmptrapd logs.
When I sent this command from the agent :
snmptrap -v 1 -c commnunity_string my_server TRAP-TEST-MIB::demotraps my_agent 6 17 '' SNMPv2-MIB::sysLocation.0 s "Just here"
I see this in the server snmptrapd
log file :
2015-01-23 18:55:07 X.X.X (via UDP: [Y.Y.Y.Y]:36679) TRAP, SNMP v1, community community_string
UCD-SNMP-MIB::ucdExperimental.990 Enterprise Specific Trap (17) Uptime: 31 days, 4:06:05.63
SNMPv2-MIB::sysLocation.0 = STRING: Just here
And when I sent this command from the agent:
snmptrap -v 2c -c community_string my_serever '' NOTIFICATION-TEST-MIB::demo-notif SNMPv2-MIB::sysLocation.0 s "just here"
I see this in the server snmptrapd
log file :
27/01/2015 09:56:59 Cold Start de 0.0.0.0
While I didn't sent a Cold Start (0) generic strap. But when I dissect the packet I can see all the information sent via this snmpv2 trap. So my first question is why the snmptrapd daemon sometimes logs just the "cold start" message instead of full trap information.
Now for the real mater, I've heard we are not obliged to use MIBs to send traps, and just need OIDs. My matter actually is that I would like to monitor a set of file (using incrond or whatever), and send a trap when a file is modified to the server to make a specific action. How can I set this accurately, so that the server can receive trap information indicating a different action for each file, parse the trap and run the action? I would like to know how you people here would design this.