LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Additional custom string message with snmptrap with different OID type (https://www.linuxquestions.org/questions/linux-newbie-8/additional-custom-string-message-with-snmptrap-with-different-oid-type-4175497088/)

divyashree 03-05-2014 03:07 AM

Additional custom string message with snmptrap with different OID type
 
Using snmptrap I am able to send traps to a snmp adapter.

for example:

Code:

snmptrap -v 1 -c public localhost HOST-RESOURCES-MIB::hrDeviceStatus.1 121.221.2.11 6 123 '' hrDeviceStatus.1 i 3
Sends a trap message like beloe:

Code:

Mar  5 14:19:27 myxenvm snmptrapd[25808]: 2014-03-05 14:19:22 rnp00267366edc9.eu.tel.uss.com [121.221.2.11] (via UDP: [127.0.0.1]:35661) TRAP, SNMP v1, community public    HOST-RESOURCES-MIB::hrDeviceStatus.1 Enterprise Specific Trap (123) Uptime: 5 days, 22:39:54.83      HOST-RESOURCES-MIB::hrDeviceStatus.1 = INTEGER: warning(3)
I need two helps in this.

1. Can anyone let me understand why the uptime information is coming in the message ?

2. As the warning message is there, I need to send a custom message event to an adapter which will parse the output and do some further task. But as the OID type is INTEGER, I am not able to send any string type with the trap. How can I do it ??

TenTenths 03-05-2014 04:15 AM

Well looking at man snmptrap shows that for version 1, if the uptime is specified as empty (the '' after 123) then the host-uptime is used, so that's why you're uptime is coming through.

divyashree 03-05-2014 09:09 PM

Quote:

Originally Posted by TenTenths (Post 5129245)
Well looking at man snmptrap shows that for version 1, if the uptime is specified as empty (the '' after 123) then the host-uptime is used, so that's why you're uptime is coming through.

But if I am using the snmptrap like this:

Code:

snmptrap -v 1 -c public localhost HOST-RESOURCES-MIB::hrDeviceStatus.1 121.221.2.11 hrDeviceStatus.1 i 3
Instead of sending the actual trap of hrDeviceStatus.1 , its sending the uptime only.

TenTenths 03-06-2014 02:12 AM

Quote:

Originally Posted by divyashree (Post 5129688)
But if I am using the snmptrap like this:

Code:

snmptrap -v 1 -c public localhost HOST-RESOURCES-MIB::hrDeviceStatus.1 121.221.2.11 hrDeviceStatus.1 i 3
Instead of sending the actual trap of hrDeviceStatus.1 , its sending the uptime only.

Which, again according to man snmptrap is missing several parameters between your agent and OID/TYPE/VALUE you wish to return.


At a glance you're missing:
generic trap
specific-trap
uptime


All times are GMT -5. The time now is 11:14 AM.