HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] Audit hook not getting all Job events



I'll try the have a look at the patch tomorrow morning but in response to your question:

>I'm confused... when JOB_DEAD is fired on that, is "[Job time limit
>exceeded]" not part of the status messages in the job q-file?

The status:  message in the job file is null.

I'll let you know as soon as I've test the patch.
Thank you
Dominique


On Tue, Jul 13, 2010 at 10:32 PM, Aidan Van Dyk <aidan@xxxxxxxx> wrote:
On 13 July 2010 15:36, Dominique dHotman <dominique@xxxxxxxxxxx> wrote:
> Hi Aidan,
> Thanks for the quick reply.  I understand that the audit hook script will
> just be called ever time an event is fired and that the audit hook then
> needs to determine the job state.
> The way that we have done this is to look in the job file determining first
> if the job file is in the sendq or doneq.  Our manner of getting this
> information is not very advanced, we just use /bin/grep to parse the data
> out of the job file and populate the variables we are interested in.  Then
> depending on the event class (Job, Send or Recv) and event ID we classify
> the event as something that we are interested in and if so insert a record
> into our database.

Right, so you can't see the state yet on JOB_PREP_END, but next event
(JOB_DEAD), the state should be state_failed (8), no?

And the status field should have the explanotory message that notify gets?

> So the answer to my first question is basically answered: The events are
> only fired based on different stages of the fax job and so we are definitely
> getting all the events.

Right.

> The problem that we are having is that something happens to the fax job
> during the preparation phase (the auto rotate times out) and we are not able
> to determine the reason for this failure by looking in the job file.  The
> only way we know something has happened is to check when we the "job marked
> dead" event is fired.  So when "job marked dead" is fired we check if the
> previous event is "send job done".  If not then we have to parse
> /var/log/message and and find out what exactly the output from the job
> scheduler is.  Then take this reason and load a job failed status into our
> database.

I'm confused... when JOB_DEAD is fired on that, is "[Job time limit
exceeded]" not part of the status messages in the job q-file?

A quick check, and I think I can see why.  How does this patch work out for you?
diff --git a/faxd/faxQueueApp.c++ b/faxd/faxQueueApp.c++
index d99aad1..008a70e 100644
--- a/faxd/faxQueueApp.c++
+++ b/faxd/faxQueueApp.c++
@@ -1293,6 +1293,7 @@ faxQueueApp::runConverter(Job& job, const char*
app, char* const* argv, Status&
               kill(pid, SIGTERM);
               (void) Sys::waitpid(pid);
               status = Job::format_failed;
+               result = Status(347, "%s", (const char*)output);
           }
           break;
       }


> Last point:  I can post a copy of our audit hook script if it would be
> helpful but I'd have to anonimise it a bit first.  We have spent a lot of
> time working on this and it forms a core part of our overall fax
> infrastructure. We'd be very happy to share it with the community if others
> will benefit from it.

I think that would be great.  Maybe a page on the wiki describing your
setup and solution.

a.



--
Aidan Van Dyk                                             aidan@xxxxxxxx
Senior Software Developer                          +1 215 825-8700 x8103
iFAX Solutions, Inc.                                http://www.ifax.com/




Project hosted by iFAX Solutions