LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-05-2014, 03:07 AM   #1
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,363

Rep: Reputation: 135Reputation: 135
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 ??
 
Old 03-05-2014, 04:15 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,394

Rep: Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855
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.
 
1 members found this post helpful.
Old 03-05-2014, 09:09 PM   #3
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,363

Original Poster
Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by TenTenths View Post
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.
 
Old 03-06-2014, 02:12 AM   #4
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,394

Rep: Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855
Quote:
Originally Posted by divyashree View Post
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
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Identify additional or lacking of characters between pairs of string ends Cheah Boon Huat Programming 6 02-28-2013 03:11 AM
Assigning custom string to std::string in C++ jh7777 Programming 4 10-13-2009 12:02 AM
ldap_add: Undefined attribute type (17) additional info: ojectclass: attribute type vinaytp Linux - Newbie 2 05-28-2009 04:57 AM
The method contains(String) is undefined for the type String sampada Programming 1 06-30-2007 10:02 AM
custom kernel -- additional driver deadlinx Ubuntu 2 09-14-2006 04:36 AM


All times are GMT -5. The time now is 04:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration