On 1/6/11 1:46 AM, sync wrote:
That's to say , is there some methods that I can use to write some perl scripts on Linux Server to check the Windows Server System information ( CPU load , Memory and so on )
Let me make sure I understand this. You have a Windows server, and a Linux server. You need a Perl script running on the Linux server that can report statistics on the Windows servers current load?
I don't think this information is remotely accessible by default on Windows. You'd need some sort of server software on Windows that can poll for this information and report it, the Linux box can contact this server and do whatever it needs to do with the data. The below assumes that the Windows system has Perl and a webserver installed, or can have these tools installed.
Doing this entirely in Perl, I'd use Sys::Info, or if that didn't get all the data I wanted I'd go to the Win32 modules, and write a CGI script on the Windows box that gathers this information and spits it back in XML. JSON is an option too, especially if you need to process or display this data with JavaScript at some point, but XML is more flexible so you should default to it without a very good reason. You can always convert it to JSON later should you ever need that format.
On the Linux server, I'd write a script that calls the above CGI script, parses the result, and passes it on to whatever it is on the Linux server that needs it. Use the LWP module to call the CGI script, and any of the XML parsers to parse the returned data.
The CGI script on the windows box could be done in other languages, you could use ASP or PHP if you want. Hell, if you really wanted to you could even do that part of it in assembler(don't. You can. But don't). But since these two scripts are part of the same system, it would be ideal to use the same language for both, and you already want Perl on the Linux box.
-- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/