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: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
        Sent: 25 September 2007 15:39
        To: nagios-users@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 
         
        --------------------------------------------------
        [EMAIL PROTECTED] eventhandlers]# pwd

        /usr/local/nagios/libexec/eventhandlers

         [EMAIL PROTECTED] eventhandlers]# python snmptraphandling.py
10.207.40.203 CRITICAL 12

        2

        [EMAIL PROTECTED] eventhandlers]#

        ---------------------------------------------
         
         
        I get following error:
         
        [EMAIL PROTECTED] 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 

        [EMAIL PROTECTED] rw]#

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

        nagios.cmd is a pipe: 

        [EMAIL PROTECTED] rw]# ls -l

        total 0

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

        [EMAIL PROTECTED] rw]#

        [EMAIL PROTECTED] 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.
                                        
-------------------------------------------------------------------------
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/
_______________________________________________
Nagios-users mailing list
Nagios-users@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

Reply via email to