Re: [PATCH] adding xml output to mod_status -- [REPOST]

2001-10-03 Thread Ian Holsman

Sander van Zoest wrote:

> On Tue, 2 Oct 2001, Mark J Cox wrote:
> 
> 
>>What we ought to do is to first decide what the XML output is going to
>>look like (it'll be a pain to change this later), then it doesn't really
>>matter if it's a patch to mod_status or a new module.
>>  http://www.awe.com/mark/dev/mod_status_xml/example.xml
>>
> 
> I like the XML schema, but I would make a few minor adjustments.
> 
> I would specify an httpd.apache.org xml namespace and a charset.
> Also spliting up the actual request into method, uri, protocol would it
> easier to manipulate those with xpath.
> 
> I would also consider potentially using a different way to handle time such
> as NTP Timestamps and adding a numeric time zone. The current method works
> perfectly, but to do some mathematical calculations it might be useful to
> have it expressed differently.
> 
> I will probably look into running this on my server soon.
> 

I'm happy with this layout Mark,

And I'll volunteer to write the 2.x version of this.
we (cnet) are going to use a XML-status

The only issue I have with it is that the XML output doesn't really follow
the standard HTML one, so it will probably have to duplicate the scorecard
logic..

What do the rest of the Apache Ppl think.. should I add this as another
module (in experimental) or modify the existing mod_status.

Sander, if you can provide me with a sample of the XML you want I'll do that as
well.
..Ian


> Cheers,
> 
> --
> Sander van Zoest  [EMAIL PROTECTED]
> High Geek http://Sander.vanZoest.com/
> 
> 





Re: [PATCH] adding xml output to mod_status -- [REPOST]

2001-10-03 Thread Mark J Cox

> - on Linux and NetWare I only get the data unformated back, looks as
> there are problems with the scoreboard.xsl or so. Any ideas what's

Yeah, Mozilla isn't very stable at doing the rendering.  Most of the
problems you mention are due to the XSLT being done inside the browser.
I'm not real worried about problems with the XSL because most of the time
you'll want the raw XML data instead, and these browsers will only get
better at XSLT over time.

> 6.29982236431605997495353221893310546875kB

If you look in the XSLT I wanted to use xsl:format-number to round to one
decimal place, but Mozilla doesn't support format-number yet.  You could
probably negotiate the xsl file returned based on user-agent and have
several.

> you should really change the TZ to numerous expression as Sander
> already suggested:

Good plan.  I wanted to avoid timestamps that are offsets though so the
XML data is consistant (and can be compared) across platforms.

Cheers,
Mark




Re: [PATCH] adding xml output to mod_status -- [REPOST]

2001-10-02 Thread Günter Knauf

Hi Mark,
> I wrote an example sometime in July/Aug but didn't get around to porting
> it to 2.0.  Here is what we have so far

>   http://www.awe.com/mark/dev/mod_status_xml/

I've tested your module on Linux, NetWare and Win32, and used Mozilla 0.9.4 to diplay,
here's what I get:

- on Linux and NetWare I only get the data unformated back, looks as there are 
problems with the scoreboard.xsl or so. Any ideas what's going wrong here? I looked 
into access_log and the scoreboard.xsl is retrieved, but it looks like Mozilla doesnt 
use it then.
- on Win32 it looks fine, but here another problem occures: stupid M$ doesnt return 
abbreviations with srtftime() but huge strings instead: 
time="20011003062706W. Europe Daylight Time"
and in addition national characters which I'm not sure are allowed in xml:
time="20011003052554Westeuropaeische Sommerzeit"
- 3 chars for the timezone abbreviation is too short; even on Linux many TZs have 4 
chars.
- some kByte outputs appear with a huge number of digits behind the comma:
6.29982236431605997495353221893310546875kB
this is perhaps a problem of Mozilla as it doesnt appear in the returned data but only 
in the browsers output.

you should really change the TZ to numerous expression as Sander already suggested:

> I would also consider potentially using a different way to handle time such
> as NTP Timestamps and adding a numeric time zone. The current method works
> perfectly, 
unfortunately it does not work perfectly on Win32.

> but to do some mathematical calculations it might be useful to
> have it expressed differently.

also while testing I got some segfaults on NT4 SP6a (on W2K not), but I'm not sure if 
it comes from mod_status_xml, I will make some further tests...





Re: [PATCH] adding xml output to mod_status -- [REPOST]

2001-10-02 Thread Sander van Zoest

On Tue, 2 Oct 2001, Mark J Cox wrote:

> What we ought to do is to first decide what the XML output is going to
> look like (it'll be a pain to change this later), then it doesn't really
> matter if it's a patch to mod_status or a new module.
>   http://www.awe.com/mark/dev/mod_status_xml/example.xml

I like the XML schema, but I would make a few minor adjustments.

I would specify an httpd.apache.org xml namespace and a charset.
Also spliting up the actual request into method, uri, protocol would it
easier to manipulate those with xpath.

I would also consider potentially using a different way to handle time such
as NTP Timestamps and adding a numeric time zone. The current method works
perfectly, but to do some mathematical calculations it might be useful to
have it expressed differently.

I will probably look into running this on my server soon.

Cheers,

--
Sander van Zoest  [EMAIL PROTECTED]
High Geek http://Sander.vanZoest.com/




Re: [PATCH] adding xml output to mod_status -- [REPOST]

2001-10-02 Thread Mark J Cox

> I had a patch which added a '?xml' option
> to mod_status.
> It's a large (>400 lines) patch, but most of it is puts.
> does anyone have any objections to it?

At the last ApacheCon I mentioned to a few people that I had written some
patches to 1.3 mod_status for XML output but not cleaned them up. After
playing with them internally for a while we thought that it made more
sense to have a mod_status_xml module:

 - mod_status is already getting quite convulted having to check for table
   support and minimal (?auto).
 - I needed to add a directive, and allow optional commands to
   tailor the XML output (less output for example)
 - I wanted some of the output in a different format (dates for example)
   so the amount of shared code was minimal
 - Because recent browsers can render the XML into HTML internally (and
   it involves less bytes transferred) I could see mod_status_xml being
   used without mod_status

I wrote an example sometime in July/Aug but didn't get around to porting
it to 2.0.  Here is what we have so far

  http://www.awe.com/mark/dev/mod_status_xml/

Ian's patch is also good; although we've chosen different ways of
representing the data (different combinations of attributes too).

What we ought to do is to first decide what the XML output is going to
look like (it'll be a pain to change this later), then it doesn't really
matter if it's a patch to mod_status or a new module.

Heres what the module produces (you might have to view source if you get a
rendered version)

  http://www.awe.com/mark/dev/mod_status_xml/example.xml

Mark
--
Mark J Cox ... www.awe.com/mark
Apache Software Foundation . OpenSSL Group . Apache Week editor





Re: [PATCH] adding xml output to mod_status -- [REPOST]

2001-10-01 Thread Justin Erenkrantz

On Mon, Oct 01, 2001 at 10:02:32PM -0700, Ian Holsman wrote:
> Hi.
> I had a patch which added a '?xml' option
> to mod_status.
> It's a large (>400 lines) patch, but most of it is puts.
> does anyone have any objections to it?

Style for starters.  -- justin




[PATCH] adding xml output to mod_status -- [REPOST]

2001-10-01 Thread Ian Holsman

Greg Stein wrote:

> On Mon, Oct 01, 2001 at 03:51:07PM -, [EMAIL PROTECTED] wrote:
> 
>>wrowe   01/10/01 08:51:07
>>
>>  Modified:modules/generators mod_status.c
>>  Log:
>>Clean up some warnings by summing bytecounts into apr_off_t holders
>>instead of ulongs.
>>
> 
> Ah! Good stuff.
> 
> Cheers,
> -g
> 
> 

Hi.
I had a patch which added a '?xml' option
to mod_status.
It's a large (>400 lines) patch, but most of it is puts.
does anyone have any objections to it?




Index: modules/generators/mod_status.c
===
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_status.c,v
retrieving revision 1.47
diff -u -u -r1.47 mod_status.c
--- modules/generators/mod_status.c 2001/10/01 15:51:07 1.47
+++ modules/generators/mod_status.c 2001/10/02 04:55:22
@@ -206,10 +206,11 @@

  /* ID values for command table */

-#define STAT_OPT_END   -1
-#define STAT_OPT_REFRESH   0
-#define STAT_OPT_NOTABLE   1
-#define STAT_OPT_AUTO  2
+#define STAT_OPT_END   -1
+#define STAT_OPT_REFRESH0
+#define STAT_OPT_NOTABLE1
+#define STAT_OPT_AUTO   2
+#define STAT_OPT_XML3

  struct stat_opt {
  int id;
@@ -222,6 +223,7 @@
  {STAT_OPT_REFRESH, "refresh", "Refresh"},
  {STAT_OPT_NOTABLE, "notable", NULL},
  {STAT_OPT_AUTO, "auto", NULL},
+{STAT_OPT_XML, "xml", NULL},
  {STAT_OPT_END, NULL, NULL}
  };

@@ -249,6 +251,8 @@
  #endif
  int short_report = 0;
  int no_table_report = 0;
+int xml_report = 0;
+int html_report =0;
  worker_score ws_record;
  process_score ps_record;
  char stat_buffer[HARD_SERVER_LIMIT * HARD_THREAD_LIMIT];
@@ -273,6 +277,7 @@
return DECLINED;

  r->content_type = "text/html";
+html_report =1;

  /*
   * Simple table-driven form data set parser that lets you alter the header
@@ -300,7 +305,14 @@
case STAT_OPT_AUTO:
r->content_type = "text/plain";
short_report = 1;
+html_report =0;
break;
+ 
case STAT_OPT_XML:
+ 
r->content_type = "text/xml";
+ 
xml_report = 1;
+html_report =0;
+ 
break;
+
}
}
i++;
@@ -355,25 +367,37 @@
  /* up_time in seconds */
  up_time = (apr_uint32_t) ((nowtime - ap_restart_time)/APR_USEC_PER_SEC);

-if (!short_report) {
- 
ap_rputs(DOCTYPE_HTML_3_2
+if (html_report) {
+ap_rputs(DOCTYPE_HTML_3_2
 "\nApache Status\n\n",
 r);
- 
ap_rputs("Apache Server Status for ", r);
- 
ap_rvputs(r, ap_get_server_name(r), "\n\n", NULL);
- 
ap_rvputs(r, "Server Version: ",
- 
   ap_get_server_version(), "\n", NULL);
- 
ap_rvputs(r, "Server Built: ",
- 
   ap_get_server_built(), "\n\n", NULL);
- 
ap_rvputs(r, "Current Time: ",
- 
   ap_ht_time(r->pool, nowtime, DEFAULT_TIME_FORMAT, 0), "\n", NULL);
- 
ap_rvputs(r, "Restart Time: ",
- 
   ap_ht_time(r->pool, ap_restart_time, DEFAULT_TIME_FORMAT, 0),
- 
   "\n", NULL);
- 
ap_rprintf(r, "Parent Server Generation: %d\n", (int) ap_my_generation);
- 
ap_rputs("Server uptime: ", r);
- 
show_time(r, up_time);
- 
ap_rputs("\n", r);
+ap_rputs("Apache Server Status for ", r);
+ap_rvputs(r, ap_get_server_name(r), "\n\n", NULL);
+ap_rvputs(r, "Server Version: ",
+  ap_get_server_version(), "\n", NULL);
+ap_rvputs(r, "Server Built: ",
+  ap_get_server_built(), "\n\n", NULL);
+ap_rvputs(r, "Current Time: ",
+  ap_ht_time(r->pool, nowtime, DEFAULT_TIME_FORMAT, 0), "\n", NULL);
+ap_rvputs(r, "Restart Time: ",
+  ap_ht_time(r->pool, ap_restart_time, DEFAULT_TIME_FORMAT, 0),
+  "\n", NULL);
+ap_rprintf(r, "Parent Server Generation: %d\n", (int) 
+ap_my_generation);
+ap_rputs("Server uptime: ", r);
+show_time(r, up_time);
+ap_rputs("\n", r);
+}
+if (xml_report) {
+ap_rputs("\n",r);
+ap_rprintf(r,"\n",ap_get_server_name(r));
+
+ap_rprintf(r,"%s%s%s\n",
+ap_get_server_built(),
+ap_ht_time(r->pool, nowtime, DEFAULT_TIME_FORMAT, 0),
+ap_ht_time(r->pool, ap_restart_time, DEFAULT_TIME_FORMAT, 0));
+ap_rprintf(r,"\n",(int)ap_my_generation);
+ap_rputs("",r);
+show_time(r,up_time);
+ap_rputs("\n",r);
  }

  if (ap_extended_status) {
@@ -401,81 +425,156 @@
ap_rprintf(r, "BytesPerReq: %g\n",
KBYTE * (float) kbcount / (float) count);
}
- 
else {  /* !short_report */
- 
 ap_rprintf(r, "Total accesses: %lu - Total Traffic: ", count);
- 
 format_kbyte_out(r, kbcount);
- 
 ap_rputs("\n", r);
+else {
+if (html_report) { /* !short_report */
+   ap_rprintf(r, "Total accesses: %lu - Total Traffic: ", count);
+