<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
{font-family:"Segoe UI";
panose-1:2 11 5 2 4 2 4 2 2 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
color:black;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"Preformattato HTML Carattere";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
color:black;
mso-fareast-language:EN-US;}
span.StileMessaggioDiPostaElettronica17
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.PreformattatoHTMLCarattere
{mso-style-name:"Preformattato HTML Carattere";
mso-style-priority:99;
mso-style-link:"Preformattato HTML";
font-family:Consolas;
color:black;
mso-fareast-language:EN-US;}
span.StileMessaggioDiPostaElettronica20
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 2.0cm 2.0cm 2.0cm;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:497112813;
mso-list-type:hybrid;
mso-list-template-ids:1719183348 68157457 68157465 68157467 68157455 68157465 68157467 68157455 68157465 68157467;}
@list l0:level1
{mso-level-text:"%1\)";
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l1
{mso-list-id:1534729447;
mso-list-type:hybrid;
mso-list-template-ids:1237612390 -1925010084 68157443 68157445 68157441 68157443 68157445 68157441 68157443 68157445;}
@list l1:level1
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:-;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-font-family:Calibri;}
@list l1:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l1:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l1:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l1:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l1:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l1:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l1:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l1:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=IT link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='color:#1F497D'>Hi Mike<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Actually , I have :<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l1 level1 lfo1'><![if !supportLists]><span lang=EN-GB style='color:#1F497D'><span style='mso-list:Ignore'>-<span style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span lang=EN-GB style='color:#1F497D'> installed snmptt (in daemon mode)<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l1 level1 lfo1'><![if !supportLists]><span style='color:#1F497D'><span style='mso-list:Ignore'>-<span style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span style='color:#1F497D'>Configured a generic passive service in nagios<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l1 level1 lfo1'><![if !supportLists]><span lang=EN-GB style='color:#1F497D'><span style='mso-list:Ignore'>-<span style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span lang=EN-GB style='color:#1F497D'>Run a snmptrap command from a client to test the configuration<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'>What’s happen ?<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo2'><![if !supportLists]><span lang=EN-GB style='color:#1F497D'><span style='mso-list:Ignore'>1)<span style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span lang=EN-GB style='color:#1F497D'>The TRAP has be sent from the client (HOST B)<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo2'><![if !supportLists]><span lang=EN-GB style='color:#1F497D'><span style='mso-list:Ignore'>2)<span style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span lang=EN-GB style='color:#1F497D'>The TRAP has be received from Nagios server (HOST A)<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo2'><![if !supportLists]><span lang=EN-GB style='color:#1F497D'><span style='mso-list:Ignore'>3)<span style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span lang=EN-GB style='color:#1F497D'>Nothing arrived on Nagios <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'>When I run manually submit_trap command, Nagios show me the message on the web gui<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'>I loose something between the TRAP received and Nagios service….what could be ?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'>Moreover in the syslog a read many and messages like: snmptt-sys[501]: Unable to delete trap file #snmptt-trap-1347373658632581 from spool dir<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'>Regards<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'>Marco<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Segoe UI","sans-serif";color:windowtext;mso-fareast-language:IT'>Da:</span></b><span style='font-size:10.0pt;font-family:"Segoe UI","sans-serif";color:windowtext;mso-fareast-language:IT'> Mike Lindsey [mailto:mike-nagios@5dninja.net] <br><b>Inviato:</b> venerd́ 7 settembre 2012 22:41<br><b>A:</b> Nagios Users List<br><b>Oggetto:</b> Re: [Nagios-users] configure receiving snmp traps<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-GB style='font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:IT'><br>You'll need to ensure that snmptrapd is enabled on your Nagios poller, and the typical route from there to get snmp traps submitted into Nagios is to install SNMPTT.<br><br></span><span style='font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:IT'><a href="http://snmptt.sourceforge.net/"><span lang=EN-GB>http://snmptt.sourceforge.net/</span></a></span><span lang=EN-GB style='font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:IT'><br><br>I recommend reading the docs for these, but, a very basic snmptrapd.conf would be:<br>###### snmptrapd.conf<br>snmpTrapdAddr </span><span style='font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:IT'><a href="udp:localhost,udp:YOUR_IP_HERE,tcp:YOUR_IP_HERE"><span lang=EN-GB>udp:localhost,udp:YOUR_IP_HERE,tcp:YOUR_IP_HERE</span></a></span><span lang=EN-GB style='font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:IT'><br><br>authCommunity log,execute public<br>logOption f/var/log/snmptrapd.log<br>traphandle default /usr/sbin/snmptt -i /usr/local/share/snmp/snmptt.ini<br>######<br><br>And then in the TrapFiles section of snmptt.ini you might have:<br>######<br>[TrapFiles]<br>snmptt_conf_files = <<END<br>/usr/local/share/snmp/snmptt/asyncos.conf<br>END<br>######<br><br>In the included config file you map trap oids to script executions, like so:<br>###### asyncos.conf<br># snmptt.conf file for AsyncOS traps.<br></span><span style='font-size:12.0pt;font-family:"Times New Roman","serif";mso-fareast-language:IT'># <br># All of these are stateless so the handler script needs to set and clear the service.<br># The service entry must have 0 retries set and be volatile.<br># <br># .1.3.6.1.4.1.15497<br>#<br><br># powerSupplyStatusChange<br># Status: .1.3.6.1.4.1.15497.1.1.1.8.1.2<br>EVENT powerSupplyStatusChange .1.3.6.1.4.1.15497.1.1.2.0.2 "asyncos" Critical<br>FORMAT $N trap from $r<br>EXEC /usr/local/nagios/customplugins/submit_trap $r AsyncOS-Trap_Alert $s 0 "$N: $*"<br>#<br>#####<br><br>Your submit_trap script takes that, and hands it off to Nagios. You can submit through NSCA, or you can create a result file in the checkresult directory, or you can submit through the external command pipe.<br><br>I do it through NSCA:<br>##### submit_trap<br>#!/usr/local/bin/bash<br><br>PATH=/bin:/usr/bin:/usr/local/bin:/usr/local/nagios/customplugins:/usr/local/nagios/bin<br>CONFIG=/usr/local/nagios/etc/send_nsca.cfg<br>NSCA=`hostname`<br><br>HOST=$1<br>SERVICE=$2<br>STATUS=$3<br>STATEFUL=$4<br>MESSAGE=$5<br>case $STATUS in<br>"Critical")<br> CODE=2<br> ;;<br>"Warning")<br> CODE=1<br> ;;<br>"Normal")<br> CODE=0<br> ;;<br>*)<br> CODE=3<br> ;;<br>esac<br><br>printf "%s\t%s\t%s\t%s\n" "$HOST" "$SERVICE" $CODE "$MESSAGE" | send_nsca -H $NSCA -c $CONFIG<br>if [[ "$STATEFUL" == "0" ]] && [[ "$STATUS" != "0" ]]<br>then<br> # Clear Nagios via delayed at now that the volatile ticket's gone through.<br> echo "/usr/local/nagios/customplugins/clear.sh $HOST \"$SERVICE\" \"$MESSAGE\"" | at now + 15 minutes<br><br>fi<br>#####<br><br>... and clear.sh for clearing stateless alerts.<br><br>#####<br>#!/usr/local/bin/bash<br><br>PATH=/bin:/usr/bin:/usr/local/bin:/usr/local/nagios/bin:/usr/local/ironport/nagios/bin<br>HOST=$1<br>SVC=$2<br>OUT=$3<br><br>if [[ "$HOST" == "" ]] || [[ "$SVC" == "" ]]<br>then<br> echo "Need host, service, optional message."<br> exit 3<br>fi<br><br># Clear it<br>printf "%b" "$HOST\t$SVC\t0\tWas:$OUT\n" | send_nsca -H `hostname` -c /usr/local/nagios/etc/send_nsca.cfg<br><br>fi<br>#####<br><br>If you're using the auto-clear bits, your Nagios user will need to be able to add items to the at queue, you'll need to look at your distribution's documentation on how that's managed. This is just one way of getting snmp traps working. Unfortunately none of them that I know of overly straightforward.<br><br>Even if this doesn't work for you, it should give enough of an insight so that you've got a better idea on what to google for. Good luck.<br><br><o:p></o:p></span></p><pre>-- <o:p></o:p></pre><pre>Mike Lindsey<o:p></o:p></pre></div></body></html>