[GeoNetwork-devel] Error pages does not return http error code status

Hi all,

As a need to monitor GeoNetwork instance using monitoring tools such as Nagios[1] and so on, I recently worked on error pages and http status code returned in headers by Geonetwork.

So from what I see in the code there seems to be one case where a non-error code is returned. In the config files where services are defined, it is possible to define an error page to show if certain exceptions are encountered. The issue seems to be that the error pages are treated as if the request succeeded (status code 200). So my proposal is to change the error page so that you can set the status code to return if that page is shown.

For example, in the config-metadata.xml file the metadata.show service is defined like:

...

I suggest changing the error section to:

I implemented the change locally and it works perfectly.

So here is my question, would you think it could be useful to integrate this functionnality in GN trunk? Anyone else interested in?

Thanks for feedback,

Cheers,


Mathieu

[1] http://www.nagios.org/

Yes, I think it is useful. Is it possible to make a good distinction between “errors” like a authorization failure, returning 403, and server-side exceptions returning 500, etc. ?

kind regards
Heikki Doeleman

On Tue, Jan 12, 2010 at 7:04 PM, Mathieu Coudert <mathieu.coudert@anonymised.com> wrote:

Hi all,

As a need to monitor GeoNetwork instance using monitoring tools such as Nagios[1] and so on, I recently worked on error pages and http status code returned in headers by Geonetwork.

So from what I see in the code there seems to be one case where a non-error code is returned. In the config files where services are defined, it is possible to define an error page to show if certain exceptions are encountered. The issue seems to be that the error pages are treated as if the request succeeded (status code 200). So my proposal is to change the error page so that you can set the status code to return if that page is shown.

For example, in the config-metadata.xml file the metadata.show service is defined like:

...

I suggest changing the error section to:

I implemented the change locally and it works perfectly.

So here is my question, would you think it could be useful to integrate this functionnality in GN trunk? Anyone else interested in?

Thanks for feedback,

Cheers,


Mathieu

[1] http://www.nagios.org/


This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon’s best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev


GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork

On Tue, Jan 12, 2010 at 7:11 PM, heikki <tropicano@anonymised.com…> wrote:

Yes, I think it is useful. Is it possible to make a good distinction between “errors” like a authorization failure, returning 403, and server-side exceptions returning 500, etc. ?

Yes it is. It depends the error configuration you are defining in the config file.
Given the fact that status code which will be returned is the one you set as an attribute of the error definition.

For example,

or

(or 503)

Is this clearer?

ciao,

Mathieu

kind regards
Heikki Doeleman

On Tue, Jan 12, 2010 at 7:04 PM, Mathieu Coudert <mathieu.coudert@anonymised.com.189…> wrote:

Hi all,

As a need to monitor GeoNetwork instance using monitoring tools such as Nagios[1] and so on, I recently worked on error pages and http status code returned in headers by Geonetwork.

So from what I see in the code there seems to be one case where a non-error code is returned. In the config files where services are defined, it is possible to define an error page to show if certain exceptions are encountered. The issue seems to be that the error pages are treated as if the request succeeded (status code 200). So my proposal is to change the error page so that you can set the status code to return if that page is shown.

For example, in the config-metadata.xml file the metadata.show service is defined like:

...

I suggest changing the error section to:

I implemented the change locally and it works perfectly.

So here is my question, would you think it could be useful to integrate this functionnality in GN trunk? Anyone else interested in?

Thanks for feedback,

Cheers,


Mathieu

[1] http://www.nagios.org/


This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon’s best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev


GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork

Hi Mathieu,

I'm definitely interested in this going into the trunk! We are using Nagios extensively.

Cheers,
    Michael

-----Original Message-----
From: Mathieu Coudert [mailto:mathieu.coudert@anonymised.com]
Sent: Wednesday, 13 January 2010 2:05 AM
To: Devel geonetwork-devel@lists.sourceforge.net
Subject: [GeoNetwork-devel] Error pages does not return http
error code status

Hi all,

As a need to monitor GeoNetwork instance using monitoring
tools such as Nagios[1] and so on, I recently worked on error
pages and http status code returned in headers by Geonetwork.

So from what I see in the code there seems to be one case
where a non-error code is returned. In the config files
where services are defined, it is possible to define an error
page to show if certain exceptions are encountered. The
issue seems to be that the error pages are treated as if the
request succeeded (status code 200). So my proposal is to
change the error page so that you can set the status code to
return if that page is shown.

For example, in the config-metadata.xml file the
metadata.show service is defined like:

               <service name="metadata.show">
<class name=".services.metadata.Show"/>

<output sheet="metadata-show.xsl">
...
</output>

<error id="operation-not-allowed" sheet="error.xsl">
<xml name="error" file="xml/metadata-show-error.xml" />
</error>
</service>

I suggest changing the error section to:

<error id="operation-not-allowed" sheet="error.xsl" statuscode="403">
    <xml name="error" file="xml/metadata-show-error.xml" />
</error>

I implemented the change locally and it works perfectly.

So here is my question, would you think it could be useful to
integrate this functionnality in GN trunk? Anyone else interested in?

Thanks for feedback,

Cheers,

--
Mathieu

[1] http://www.nagios.org/