FW: Nagios: Error while writing to pipe

pankaj.dhali at wipro.com pankaj.dhali at wipro.com
Tue Sep 25 16:39:18 CEST 2007


 
Hi  All,
           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
by checking Passive Service Check Result submitted by this script.

          I have attached the Python script which is used write "Passive
Service check Result" to Nagios external command file
for creating an alert/event. But when I run this script 
 
--------------------------------------------------
[root at Symbol eventhandlers]# pwd

/usr/local/nagios/libexec/eventhandlers

 [root at Symbol eventhandlers]# python snmptraphandling.py 10.207.40.203
CRITICAL 12

2

[root at Symbol eventhandlers]#

---------------------------------------------
 
 
I get following error:
 
[root at Symbol rw]# tail -f nagios.cmd

[1190731734]
PROCESS_SERVICE_CHECK_RESULT;10.207.40.203;snmp_trap_handling_critical;2
;" 12"

tail: nagios.cmd: file truncated

tail: nagios.cmd: cannot seek to offset 0: Illegal seek 

[root at Symbol rw]#

--------------------------------------------------

nagios.cmd is a pipe: 

[root at Symbol rw]# ls -l

total 0

prw-rw---- 1 nagios nagcmd 0 Sep 25 20:18 nagios.cmd 

[root at Symbol rw]#

[root at Symbol rw]# pwd

/usr/local/nagios/var/rw

 

 why I am getting Illegal seek 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 

showing error. If the problem is due to the script then it could be here

output = open('/usr/local/nagios/var/rw/nagios.cmd', 'w')
        print return_code
        results = "[" + mytime + "] " + "PROCESS_SERVICE_CHECK_RESULT;"
\
        + host + ";" + "snmp_trap_handling_" + service_suffix + ";" \
        + return_code + ";" + mondata_res + "\n"
        output.write(results)

It could be file(pipe) permission problem, I have no idea.

I have followed below link to give permission to nagios.cmd

http://nagios.sourceforge.net/docs/2_0/commandfile.html 

Thanks & Regards,

Pankaj

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20070925/6737e72b/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: snmptraphandling.py.txt
URL: <https://www.monitoring-lists.org/archive/users/attachments/20070925/6737e72b/attachment.txt>
-------------- next part --------------
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list