Forum OpenACS Q&A: Naviserver + nscgi

Collapse
Posted by Michael Steigman on
We're trying to reenable our old Perl-based log analyzer after switching to NS 4.99.6. Our config is bare-bones:

ns_section "ns/server/${server}/module/nscgi"
ns_param map "GET /stats/awstats ${serverroot}/cgi-bin/awstats"
ns_param map "POST /stats/awstats ${serverroot}/cgi-bin/awstats"

Naviserver utilization jumps to 100% when we hit the analyzer's URL. The connection threads (each time we hit the URL, we get another 100% spike in utilization) hang, etc.

Not sure if http://wiki.tcl.tk/40516 is up to date but there doesn't appear to be anything new required configuration-wise. Any ideas/suggestions?

Thanks.

Collapse
2: Re: Naviserver + nscgi (response to 1)
Posted by Gustaf Neumann on
Hi Michael,

i have an installation running with awstats and naviserver 4.99.6, using

ns_section "ns/server/${server}/module/nscgi" 
       ns_param map     "GET  /awstats /usr/lib/cgi-bin"
       ns_param Interps CGIinterps

ns_section "ns/interps/CGIinterps" 
       ns_param .pl "/usr/bin/perl"
where /usr/lib/cgi-bin contains among other things awstats.pl
Awstats can be called via "http://yoursite//awstats/awstats.pl?config=...".
Runs smoothly.

The nscgi documentation is in [1].

[1] http://naviserver.sourceforge.net/n/nscgi/files/nscgi.html

Collapse
3: Re: Naviserver + nscgi (response to 2)
Posted by Michael Steigman on
Thanks, Gustaf.

I double-checked/adjusted our settings and restarted and still see the same behavior. The awstats script exists and I can run it by hand as Naviserver user. The April stats DB looks to be up to date and OK. The last update to Awstats was in 2012 and it was running fine behind Aolserver well after that date.

Any suggestions as to where to look next?

Thanks, again.

Collapse
4: Re: Naviserver + nscgi (response to 3)
Posted by Gustaf Neumann on
Can it be that this machine is running low on memory?

What happens, if you ran a "hello world" CGI script via NaviServer? (see example below, put "hello-world.cgi" into your global www directory).

Do you have the chance to compile the newest version of NaviServer from bitbucket [1]. I've just added more debugging aids, one can now turn on at runtime debugging of nscgi via "ns_logctl severity Debug(cgi) on".

-g

config snippet

#
# CGI
#
ns_section "ns/server/${server}/module/nscgi"
   ns_param map     "GET  /*.cgi"
   ns_param interps cgi

ns_section "ns/interps/cgi" 
   ns_param .cgi "/usr/local/ns/bin/tclsh"

hello-world.cgi

puts "HTTP/1.0 200 OK
Date: Monday, 06-Nov-95 17:50:15 GMT
Content-Type: text/html

<html>
<body>
Hello World
</body>
"
[1] https://bitbucket.org/naviserver/naviserver/overview
Collapse
5: Re: Naviserver + nscgi (response to 4)
Posted by Michael Steigman on
Same behavior when accessing the Tcl CGI script.

I don't think memory is the issue; Awstats ran smoothly with 1/4 of the RAM we have now and ran fine on the current hardware under Aolserver.

Next chance I have, I'll compile Naviserver and let you know what that turns up.

Thanks.

Collapse
6: Re: Naviserver + nscgi (response to 4)
Posted by Michael Steigman on
Finally had the opportunity to build the 4.99.8 release. Turned on CGI debugging (the run-time debug switch is great, btw) and ... it worked :). No other configuration changes since trying with the previous build a few days ago.

If the problem shows up again, I'll try to debugging again. For now, though, thanks for the release!

Collapse
7: Re: Naviserver + nscgi (response to 6)
Posted by Gustaf Neumann on
Good news! hope, it stays like this.
Thanks for the feedback!
Collapse
8: Re: Naviserver + nscgi (response to 6)
Posted by Gustaf Neumann on
Btw, you might be interested in the WebSocket interface of NaviServer

https://bitbucket.org/naviserver/websocket

which lets you watch e.g. the error.log in a browser window (like "tail -f"); you can switch from the error.log view the logging options...

-g