<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3157" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=137240115-25092007>Hi All,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=137240115-25092007> Is
there any simpler way to receive SNMP Traps by Nagios server and create and
alert/event? Please provide the steps(exact) as I am new to
Nagios.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=137240115-25092007></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=137240115-25092007>Thanks in Advance,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=137240115-25092007>Pankaj</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=137240115-25092007></SPAN></FONT> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Pankaj Dhali (WT01 - INNOVATION GROUP)
<BR><B>Sent:</B> Tuesday, September 25, 2007 8:09 PM<BR><B>To:</B>
'nagios-users@lists.sourceforge.net'<BR><B>Subject:</B> FW: Nagios: Error while
writing to pipe<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2></FONT> </DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT face=Arial
color=#800000 size=2><SPAN class=043052012-25092007>Hi<SPAN
class=902433314-25092007><FONT color=#0000ff>
All,</FONT></SPAN></SPAN></FONT></DIV>
<DIV><FONT color=#800000><SPAN class=043052012-25092007><FONT face=Arial><FONT
size=2> <SPAN
class=902433314-25092007><FONT color=#0000ff> I am new to Nagios, I am
trying to receive SNMP Trap from Windows client machine. I am using Python
script to see how Nagios can create an
event/alert</FONT></SPAN></FONT></FONT></SPAN></FONT></DIV>
<DIV><FONT color=#800000><SPAN class=043052012-25092007><FONT face=Arial><FONT
size=2><SPAN class=902433314-25092007><FONT color=#0000ff>by checking Passive
Service Check Result submitted by this
script.</FONT> </SPAN> <SPAN
class=902433314-25092007><FONT
color=#0000ff> </FONT></SPAN></FONT></FONT></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#800000 size=2><SPAN class=043052012-25092007><SPAN
class=902433314-25092007><FONT
color=#0000ff>
</FONT> </SPAN>I have attached the Python script which is used write
"Passive Service check Result" to Nagios external command
file</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#800000 size=2><SPAN class=043052012-25092007>for
creating an alert/event. But when I run this script </SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=043052012-25092007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=043052012-25092007>--------------------------------------------------</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=043052012-25092007><FONT size=2>
<P>[root@Symbol eventhandlers]# pwd</P>
<P>/usr/local/nagios/libexec/eventhandlers</P>
<P> <FONT color=#0000ff>[root@Symbol eventhandlers]# python
snmptraphandling.py 10.207.40.203 CRITICAL 12</FONT></P>
<P>2</P>
<P>[root@Symbol eventhandlers]#</P></FONT></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=043052012-25092007>---------------------------------------------</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=043052012-25092007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=043052012-25092007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#800000 size=2><SPAN class=043052012-25092007>I get
following error:</SPAN></FONT></DIV>
<DIV><SPAN class=043052012-25092007><SPAN class=043052012-25092007><FONT
face=Arial><FONT size=2><SPAN class=902433314-25092007><FONT
color=#0000ff></FONT></SPAN></FONT></FONT></SPAN></SPAN> </DIV>
<DIV><FONT size=+0><SPAN class=043052012-25092007><FONT face=Arial
size=2>[root@Symbol rw]# tail -f nagios.cmd</FONT></DIV>
<DIV>
<P><FONT face=Arial size=2>[1190731734]
PROCESS_SERVICE_CHECK_RESULT;10.207.40.203;snmp_trap_handling_critical;2;"
12"</FONT></P>
<P><FONT face=Arial color=#0000ff size=2><STRONG>tail: nagios.cmd: file
truncated</STRONG></FONT></P>
<P><FONT color=#0000ff><FONT face=Arial><FONT size=2><STRONG>tail: nagios.cmd:
cannot seek to offset 0: Illegal seek</STRONG> </FONT></FONT></FONT></P>
<P><FONT face=Arial size=2>[root@Symbol rw]#</FONT></P>
<P><SPAN class=043052012-25092007><FONT face=Arial
size=2>--------------------------------------------------</FONT></SPAN></P>
<P><SPAN class=043052012-25092007><FONT face=Arial size=2>nagios.cmd is a pipe:
</FONT></SPAN></P>
<P><SPAN class=043052012-25092007><SPAN class=043052012-25092007><FONT
face=Arial size=2>[root@Symbol rw]# ls -l</FONT></P>
<DIV>
<P><FONT face=Arial size=2>total 0</FONT></P>
<P><FONT face=Arial><FONT size=2><STRONG><FONT
color=#0000ff>prw-rw</FONT></STRONG>---- 1 nagios nagcmd 0 Sep 25 20:18 <FONT
color=#0000ff><STRONG>nagios.cmd</STRONG> </FONT></FONT></FONT></P>
<P><FONT face=Arial size=2>[root@Symbol rw]#</FONT></P>
<P><FONT face=Arial size=2>[root@Symbol rw]# pwd</FONT></P>
<P><FONT face=Arial size=2>/usr/local/nagios/var/rw</FONT></P>
<P><FONT face=Arial size=2></FONT> </P>
<P><SPAN class=043052012-25092007><FONT face=Arial><FONT size=2> <FONT
color=#800000>why I am getting <STRONG>Illegal seek</STRONG> error. I have tried
to use this script to a normal read write file and it works fine, but while
writing to a pipe it is </FONT></FONT></FONT></SPAN></P>
<P><SPAN class=043052012-25092007><FONT face=Arial color=#800000
size=2>showing error. If the problem is due to the script then it
could be here</FONT></SPAN></P>
<P><SPAN class=043052012-25092007><FONT face=Arial size=2>output =
open('/usr/local/nagios/var/rw/nagios.cmd',
'w')<BR> print
return_code<BR> results = "[" + mytime
+ "] " + "PROCESS_SERVICE_CHECK_RESULT;"
\<BR> + host + ";" +
"snmp_trap_handling_" + service_suffix + ";"
\<BR> + return_code + ";" +
mondata_res + "\n"<BR>
output.write(results)</FONT></SPAN></P>
<P><SPAN class=043052012-25092007><FONT face=Arial color=#800000 size=2>It could
be file(pipe) permission problem, I have no idea.</FONT></SPAN></P>
<P>
<P><SPAN class=043052012-25092007><FONT
face="Courier New"><TT></TT></FONT></SPAN></P><SPAN
class=043052012-25092007><FONT face="Courier New"><TT>I have followed below link
to give permission to nagios.cmd</TT></FONT></SPAN>
<P></P>
<P><SPAN class=043052012-25092007><FONT face="Courier New"><TT><FONT face=Arial
size=2><A
href="http://nagios.sourceforge.net/docs/2_0/commandfile.html">http://nagios.sourceforge.net/docs/2_0/commandfile.html</A></FONT> </TT></FONT></P><PRE style="MARGIN: 0em"></PRE></SPAN>
<P><SPAN class=043052012-25092007><FONT face=Arial size=2>Thanks &
Regards,</FONT></SPAN></P>
<P><SPAN class=043052012-25092007><FONT face=Arial
size=2>Pankaj</FONT></SPAN></P>
<P><SPAN class=043052012-25092007><FONT face=Arial
size=2></FONT></SPAN> </P>
<P><SPAN class=043052012-25092007><FONT face=Arial
size=2></FONT></SPAN> </P></SPAN></DIV></SPAN>
<P><FONT face=Arial size=2></FONT> </P></SPAN></FONT></DIV></BODY></HTML>