473,387 Members | 1,520 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Monitoring Service Activity

I have a windows service that in the OnStart it creates a thread and runs a
loop forever and ever, assuming the service is running. The loop stops
during the OnStop event, and everything works exactly as expected.

I also have an application that monitors that service using the
ServiceController component, and allows me to start & stop the service as
needed, as well as poll for it's current status. Still everything thus far
works and behaves as expected.

Now I want to add some functionality to the service monitoring application
to get actual useful information from the service, such as what is it
currently doing within the loop.

My idea (not sure if this is correct or not) was to create a new thread
that'll start in the service that will accept and send windows messages back
and forth between the monitoring application. The main processing loop,
everytime it's getting ready to do something would post it's current
activity/status to some variable somewhere that the other thread can pick up
and send (via SendMessage?) to the monitoring app...

Of course this is all hypothetical, assuming I can even do something like
this...

Ideas? Suggestions? Comments? Tips? Pointers??
Nov 17 '05 #1
3 2301
Any ideas or suggestions at all??

"JSheble" <js************@logicor.com> wrote in message
news:O0**************@TK2MSFTNGP10.phx.gbl...
I have a windows service that in the OnStart it creates a thread and runs a
loop forever and ever, assuming the service is running. The loop stops
during the OnStop event, and everything works exactly as expected.

I also have an application that monitors that service using the
ServiceController component, and allows me to start & stop the service as
needed, as well as poll for it's current status. Still everything thus
far works and behaves as expected.

Now I want to add some functionality to the service monitoring application
to get actual useful information from the service, such as what is it
currently doing within the loop.

My idea (not sure if this is correct or not) was to create a new thread
that'll start in the service that will accept and send windows messages
back and forth between the monitoring application. The main processing
loop, everytime it's getting ready to do something would post it's current
activity/status to some variable somewhere that the other thread can pick
up and send (via SendMessage?) to the monitoring app...

Of course this is all hypothetical, assuming I can even do something like
this...

Ideas? Suggestions? Comments? Tips? Pointers??

Nov 17 '05 #2

"JSheble" <js************@logicor.com> wrote in message
news:O0**************@TK2MSFTNGP10.phx.gbl...
I have a windows service that in the OnStart it creates a thread and runs a
loop forever and ever, assuming the service is running. The loop stops
during the OnStop event, and everything works exactly as expected.

I also have an application that monitors that service using the
ServiceController component, and allows me to start & stop the service as
needed, as well as poll for it's current status. Still everything thus
far works and behaves as expected.

Now I want to add some functionality to the service monitoring application
to get actual useful information from the service, such as what is it
currently doing within the loop.

My idea (not sure if this is correct or not) was to create a new thread
that'll start in the service that will accept and send windows messages
back and forth between the monitoring application. The main processing
loop, everytime it's getting ready to do something would post it's current
activity/status to some variable somewhere that the other thread can pick
up and send (via SendMessage?) to the monitoring app...

Of course this is all hypothetical, assuming I can even do something like
this...

Ideas? Suggestions? Comments? Tips? Pointers??


Have another service thread publishing your service state as WMI class
instances and/or events, a monitoring application can register event
listeners or query the state of the service
Both class instances and events can be produced using System.Management and
System.Management.Instrumentation, check the docs for details on event
publishing and how to implement instance providers in WMI. Note that this is
the way all MSFT services like SQL/Exchange and ASP.NET are providing
monitoring and instrumentation information.

Willy.

Nov 17 '05 #3

"JSheble" <js************@logicor.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
ok, thanx... I'll look into it... WMI Event Publishing, right?


Well, you can publish events, but IMO what you are looking for is to publish
instances of .NET classes as WMI classes. The class(es) holds the state of
the service at a certain point in time. Events can be used when a state
changes, for instance when the service is paused you can fire an event so
that the monitor is no longer required to read status instances.

Willy.

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Wally | last post by:
Hi Hi need to monitoring my windows service written in VB NET. How can my monitor application "feel" that my service has made something? Is the only way a polling (for example on a Db table)?...
4
by: johnm | last post by:
Hello, We currently are running a CRM application that uses DB/2 7.2 for the data repository. We will be upgrading to 8.2 later this year....maybe....time and resources permitting. The...
1
by: Sylesh Nair | last post by:
could anyone give me a possible solution for a Windows Service (in C#) listening to a table in a database for insertion or updation. thanks
0
by: Paul Steele | last post by:
I am working in a C# program what monitors the activity on a computer. I have been able to accomplish quite a bit so far, but one item I have not been able to figure out is if there is a way to...
3
by: BC | last post by:
Hi all, I have a windows service (on client machine) that monitors a MSMQ queue (on server machine). When a new message is in the server queue, the client windows service will get the message...
0
by: Scott Daniel | last post by:
Is is possible to do the above? I know there is a mechanism to monitor 'folder' activity and I have used it. But I'm wondering if there is a way of monitoring for CRM or database activity in a...
4
by: natG | last post by:
Well folks, I didn't heed the warnings (that excessive monitoring, statistics, etc. can cause a performance hit) and I have been playing around with all kinds of monitors, snapshots, especially...
2
by: bic1ster | last post by:
I go in through the Control Center Activity Control Center and eventually select view locks, I get a popup window "The Activity Monitor is unable to collect the required snapshot data because the...
0
by: origami.takarana | last post by:
Dear Reader, Designing for Detection ---------------------------- - Get the right equipment from the start. Make sure all of the features you need, or will need, are available from the start....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.