[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xymon] XymonPSClient 64/32 bit and service runner issues



Neil,
> Hi David
>
> I worked on a .Net service which runs any powershell scripts as jobs. It uses the Qaurtz.Net scheduling component. Currently it works very similar to BBWin in that you dump the file to a directory and it picks it up. You can specify additional PS files with scheduling information in a config.xml file. The service is dynamically configurable with changes to the config being picked up in a matter of seconds and the service reloading on the fly. It also allows you to report to more than one Xymon server. I was trying to replace the BBWin client and the vapourware XyWin.net client. 
>
>   
The above sounds ideal. I was kind of hoping you might respond with
details of how far you'd gotten.

The main powershell client code doesn't exit, although if it did it
would be good for the service runner to either restart it if it did or
just die itself so that the Windows service restart options can come
into play.
> Anyway when you guys started working on the PS client I sort of stopped working on it. It is called XyWinMon and there is a project on sourceforge with the code. The idea was to have it execute VBS,JS,CMD and Powershell scripts as well as being able to use ADO.Net to login to Databases and execute queries if need be. Anyway long story short. It requires a script that will output to a file. You specify the information in the xml configuration file. Here is a example:
>
>   
I started looking at running externals today, and it was all going to
end up in .Net Processes anyway - the powershell "start-job" stuff is
pretty limited. The scheduler you describe sounds just what is needed.

Definitely interested!

Thanks, David.
> <?xml version="1.0" encoding="utf-8" ?> 
> <XyMon>
> <Client>
> 	<hostname>PRMW0154</hostname>
> 	<hostclass>bbwin win32</hostclass>
> 	
> </Client>
> <Server>
> 	<ip>172.27.14.199</ip>
> 	<port>1984</port>
> </Server>
>
>
> <Monitor>
> 	<scriptname>xymonclient2.ps1</scriptname>
> 	<timerinterval>360</timerinterval>
> 	<scripttype>powershell</scripttype>
> 	<outputfile>C:\ServiceTest\xymon.txt</outputfile>
> </Monitor> 
> <Monitor>
> 	<scriptname>SQLServerJobsCheck.ps1</scriptname>
> 	<timerinterval>20</timerinterval>
> 	<scripttype>powershell</scripttype>
> 	<outputfile>c:\servicetest\sqljobs</outputfile>
> </Monitor> 
>
> </XyMon>
>
> Anyway the script is run the output captured converted to unix style and sent to the xymon servers listed above. Like I said you can configure it dynamically. If the server is not there the service keeps on running and just logs a error. 
>
> Anyway let me know if you are keen. 
>
> Regards
> Neil
> -----Original Message-----
> From: David Baldwin [mailto:david.baldwin (at) ausport.gov.au] 
> Sent: 29 October 2010 02:48 AM
> To: [xymon-developer]; xymon (at) xymon.com
> Subject: [xymon] XymonPSClient 64/32 bit and service runner issues
>
> All,
>
> The Xymon powershell client is coming along, but I've run into some
> annoying issues which are little to do with powershell itself and was
> seeking some advice if anyone is more familiar with options available
> for Windows for running services and 32/64 bit environments.
>
> I was just testing on a 64-bit 2008 server, installed service from an
> interactive shell, created a reg key with servers list I want to use
> then started service. Problem was, it didn't find the reg keys. Turned
> out that XYMONPSCLIENT.EXE (ABC-SRVANY.EXE) is running in 32-bit mode,
> and despite the PDF doc suggesting it can run 64-bit apps, and that the
> explicit path for powershell.exe appears to be the 64-bit version, it
> started as 32-bit and couldn't find the reg key because it could only
> see HKLM:\SOFTWARE as the HKLM:\SOFTWARE\WOW6432NODE subtree.
>
> I could put in logic to detect that and explicitly use WOW6432NODE even
> in 64-bit mode, but there's no reason to be running in 32-bit mode when
> it should be possible to run 64-bit when running as a service. I also
> have an issue with ABC-SRVANY.EXE, that if the child powershell process
> dies for whatever reason, the service process is still running but it
> doesn't seem to care, doesn't try to restart, doesn't exit (which would
> allow Windows service restart options to take effect), just sits there!
>
> Does anyone have any suggestions? If someone is able to write a basic
> (.Net-based?) .EXE service runner that just calls a powershell script
> and runs in 64-bit mode if it can, 32-bit otherwise that would seem
> ideal. All it would need to do is start the child process, handle
> service stop/start signals and manage the child process, and exit if the
> child dies. Doesn't sound hard, but I have no development environment
> for that available so don't really know where to start.
>
> Thanks, David.
>
>   


-- 
David Baldwin - IT Unit
Australian Sports Commission          www.ausport.gov.au
Tel 02 62147830 Fax 02 62141830       PO Box 176 Belconnen ACT 2616
david.baldwin (at) ausport.gov.au          Leverrier Street Bruce ACT 2617


-------------------------------------------------------------------------------------
Keep up to date with what's happening in Australian sport visit http://www.ausport.gov.au

This message is intended for the addressee named and may contain confidential and privileged information. If you are not the intended recipient please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you receive this message in error, please delete it and notify the sender.
-------------------------------------------------------------------------------------