You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Mladen Turk <ml...@mail.inet.hr> on 2001/08/06 16:16:11 UTC
CONTRIBUTION : Monitoring Services on WIN32
Hi all,
As I understood there has been some need for service monitoring utility
application.
Well, I've assembled one, and if you guys think that it has the purpose,
than it can be put in the official distribution.
It was build to comply with the Bill's request (monitoring-services.txt),
using only WIN32 API.
How it works:
Upon start-up the app goes to Windows try. Double-click pops up the window
with all the installed services on local machine (walking through registry).
Right click shows the pop-up menu, and try tool-tip shows the number of
currently running services. It tests if the particular service is running
using either SCM (NT) or FindWindow (9x), and shows the small status icon in
the service list.
Service management has the options to start, stop, restart and uninstall any
installed service.
The app checks service status each second and if there is a status change
updates the service list.
For starting, stopping and installing the services on WIN9x it spawns the
invisible console with proper command line arguments, and on WINNT it uses
the SCM to do the job. For service starting on NT the command parameter is
either "--ntservice" (Apache 1.3) and "-k runservice" (Apache 2.0).
TODO:
*Is there a need to add the option to install the service ? I was thinking
something like dialog with fields for service name, apache.exe path and
optionaly httpd.conf and server root directory.
*Get PID on WINNT 4.0
*Document code.
Please give some feedback.
Mladen Turk
MCSE/GIS Specialist
MappingSoft
mailto: [ mturk@mappingsoft.com ]
http://apache.mappingsoft.com
Re: CONTRIBUTION : Monitoring Services on WIN32
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
From: "Mladen Turk" <ml...@mail.inet.hr>
Sent: Tuesday, August 07, 2001 10:12 AM
> > From: William A. Rowe, Jr. [mailto:wrowe@rowe-clan.net]
> > Sent: Monday, August 06, 2001 8:10 PM
> >
> > I'd argue this would be in the relm of a gui configurator. I'd
> > like to see both
> > install and uninstall dropped from the 'simple' taskbar app. To
> > easy to for the
> > 'operator' to accedentally undo the work of the 'administrator'.
> > Let's leave
> > both out, and let the user (who _knows_ what they are doing)
> > fiddle the command
> > line or trust their gui tool (which would help new users to
> > understand all the
> > implications, or just solve the implications for them.)
>
> I agree, so here is an modified version without uninstall button.
Too late, need a patch ... It's already committed :)
> > I think we should be using the real service status for NT, except
> > as extra info.
> > And I think the 'pids by numbers' bit just confuses users. But
> > I'll take a closer
> > look a little later.
>
> I've removed the PID displaying and QueryServiceStatusEx, and added console
> redirection to get some feedback on WIN9x.
Those would be cool as well. Definately worth committing a patch. I'll be
off list, so anyone who can catch Mladen's patch to ApacheMonitor, please
apply.
I have some ideas of my own to add some left/right click features, and definately
add the Manual v.s. Automatic startup toggling right in the controller. These can
wait a bit, and I'll offer some patches next week.
Great job MT!
Bill
RE: CONTRIBUTION : Monitoring Services on WIN32
Posted by Mladen Turk <ml...@mail.inet.hr>.
> -----Original Message-----
> From: William A. Rowe, Jr. [mailto:wrowe@rowe-clan.net]
> Sent: Monday, August 06, 2001 8:10 PM
> To: new-httpd@apache.org
> Subject: Re: CONTRIBUTION : Monitoring Services on WIN32
> I'd argue this would be in the relm of a gui configurator. I'd
> like to see both
> install and uninstall dropped from the 'simple' taskbar app. To
> easy to for the
> 'operator' to accedentally undo the work of the 'administrator'.
> Let's leave
> both out, and let the user (who _knows_ what they are doing)
> fiddle the command
> line or trust their gui tool (which would help new users to
> understand all the
> implications, or just solve the implications for them.)
I agree, so here is an modified version without uninstall button.
> I think we should be using the real service status for NT, except
> as extra info.
> And I think the 'pids by numbers' bit just confuses users. But
> I'll take a closer
> look a little later.
I've removed the PID displaying and QueryServiceStatusEx, and added console
redirection to get some feedback on WIN9x.
MT (read Multi Theaded)
Re: CONTRIBUTION : Monitoring Services on WIN32
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
From: "Mladen Turk" <ml...@mail.inet.hr>
Sent: Monday, August 06, 2001 12:40 PM
> From: William A. Rowe, Jr. [mailto:wrowe@rowe-clan.net]
> To: Mladen Turk; new-httpd@apache.org
> >
> > From: "Mladen Turk" <ml...@mail.inet.hr>
> > Sent: Monday, August 06, 2001 9:16 AM
> > > TODO:
> > > *Is there a need to add the option to install the service ? I was thinking
> > > something like dialog with fields for service name, apache.exe path and
> > > optionaly httpd.conf and server root directory.
> >
> > That's a thought, but it would 1. add weight to what should stay a very tiny
> > piece of code, and 2. anyone introducing a service would need to grok creating
> > their second httpd.server2.conf file, or intermixing two servers in the same
> > conf file (tricky.)
>
> Yes it would add additional 15K code, but on the other hand if you have
> uninstall, it makes sense to have the install option too( just to be user friendly :).
> I hate to type those long command line sausages :). Hate that.
I'd argue this would be in the relm of a gui configurator. I'd like to see both
install and uninstall dropped from the 'simple' taskbar app. To easy to for the
'operator' to accedentally undo the work of the 'administrator'. Let's leave
both out, and let the user (who _knows_ what they are doing) fiddle the command
line or trust their gui tool (which would help new users to understand all the
implications, or just solve the implications for them.)
> > > *Get PID on WINNT 4.0
> >
> > Hmmm. Need to think about that. Do we (ever) need to get the PID on winNT,
> > since we have the SCM? Or is this just for information purposes?
>
> I use pid as a service status flag, and it's also an info. NT4.0 doesn't
> have a QueryServiceStatusEx, so each running service pid is set to 1 (not
> very cool :)
I think we should be using the real service status for NT, except as extra info.
And I think the 'pids by numbers' bit just confuses users. But I'll take a closer
look a little later.
Bill
RE: CONTRIBUTION : Monitoring Services on WIN32
Posted by Mladen Turk <ml...@mail.inet.hr>.
> -----Original Message-----
> From: William A. Rowe, Jr. [mailto:wrowe@rowe-clan.net]
> Sent: Monday, August 06, 2001 5:14 PM
> To: Mladen Turk; new-httpd@apache.org
> Subject: Re: CONTRIBUTION : Monitoring Services on WIN32
>
>
> From: "Mladen Turk" <ml...@mail.inet.hr>
> Sent: Monday, August 06, 2001 9:16 AM
> > TODO:
> > *Is there a need to add the option to install the service ? I
> was thinking
> > something like dialog with fields for service name, apache.exe path and
> > optionaly httpd.conf and server root directory.
>
> That's a thought, but it would 1. add weight to what should stay
> a very tiny
> piece of code, and 2. anyone introducing a service would need to
> grok creating
> their second httpd.server2.conf file, or intermixing two servers
> in the same
> conf file (tricky.)
Yes it would add additional 15K code, but on the other hand if you have
uninstall, it makes sense to have the install option too( just to be user
friendly :).
I hate to type those long command line sausages :). Hate that.
>
> > *Get PID on WINNT 4.0
>
> Hmmm. Need to think about that. Do we (ever) need to get the
> PID on winNT,
> since we have the SCM? Or is this just for information purposes?
I use pid as a service status flag, and it's also an info. NT4.0 doesn't
have a QueryServiceStatusEx, so each running service pid is set to 1 (not
very cool :)
MT
Re: CONTRIBUTION : Monitoring Services on WIN32
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
From: "Mladen Turk" <ml...@mail.inet.hr>
Sent: Monday, August 06, 2001 9:16 AM
> Hi all,
>
> As I understood there has been some need for service monitoring utility
> application.
> Well, I've assembled one, and if you guys think that it has the purpose,
> than it can be put in the official distribution.
>
> It was build to comply with the Bill's request (monitoring-services.txt),
> using only WIN32 API.
Very slick! Thank you for submitting this.
> TODO:
> *Is there a need to add the option to install the service ? I was thinking
> something like dialog with fields for service name, apache.exe path and
> optionaly httpd.conf and server root directory.
That's a thought, but it would 1. add weight to what should stay a very tiny
piece of code, and 2. anyone introducing a service would need to grok creating
their second httpd.server2.conf file, or intermixing two servers in the same
conf file (tricky.)
> *Get PID on WINNT 4.0
Hmmm. Need to think about that. Do we (ever) need to get the PID on winNT,
since we have the SCM? Or is this just for information purposes?
> *Document code.
I could read it just fine :) Seriously, we tend to document bits that are
somewhat obscure, or counterintuitive. Since anyone fiddling here is a win32
person, they should be able to read event loops. There are some bits that
you could add about whys for folks not familiar with what's changed in the
taskbar operation, but we should be fine.
I've cleaned out the 4-char tabs (a definate no-no on new-httpd :) and just
changed whitespace for our coding style. Other than that, it's ready to
commit, unless I hear an objection today :) Attached is Mlladen's (cleaned)
code, sans extra .ico and other binary files, for anyone's review.
Bill