FW: Nagios: Error while writing to pipe

Paul Weaver paul.weaver at bbc.co.uk
Tue Sep 25 16:42:16 CEST 2007


I'm no expert in python or passive results, however you appear to be
opening the file for write access. Have you tried opening for append (w+
perhaps?)
 
--

"Even if you're on the right track, you'll get run over if you just sit
there."

Paul Weaver    
Systems Development Engineer
News Production Facilities, BBC News
Work:   020 8225 8109
Mobile:   07738 481006
Room 1244, BBC Television Centre,
Wood Lane, London, W12 7RJ

	-----Original Message-----
	From: nagios-users-bounces at lists.sourceforge.net
[mailto:nagios-users-bounces at lists.sourceforge.net] On Behalf Of
pankaj.dhali at wipro.com
	Sent: 25 September 2007 15:39
	To: nagios-users at lists.sourceforge.net
	Subject: [Nagios-users] FW: Nagios: Error while writing to pipe
	
	
	 
	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

	 

	 

	 


http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
					
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20070925/77402caf/attachment.html>
-------------- 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