kansaschuck has asked for the wisdom of the Perl Monks concerning the following question:

I'm running ActiveState 10.5 on WinXP. I have a need to regularly deliver some info from Windows XP (and attached devices) to a web site. The information could be simple flags (on/off) or simple data or messages. This transmit will happen up to every minute.

What would be some different idea for accomplishing that?

windows xp Perl 10.5 laptop} -----> Linux Web ISP platform website (with PHP]. </P

Some possible ideas: FTP a file to website, or could Perl on Windows trigger a PHP file to run an set a flag. How about a DB call to MySQL on the website?(I know/have MySQL running at this site).


So I was looking for recommendations that took into consideration: Security, 24x7 operation, low bandwidth, low complexity, reliability, different options etc.... just a project think tank before I jump in real deep.

Replies are listed 'Best First'.
Re: Perl on Windows project direction
by Corion (Patriarch) on Feb 24, 2008 at 19:21 UTC

    The traditional approach to system monitoring would be to use SNMP. There are many tools for about every platform under the sun to accomplish this. The second approach to poll a Windows machine for system information would be to use the WMI (also available via a module by me, DBD::WMI).

    As you don't seem to do the system monitoring in a "professional" environment (which to me means SNMP), there are various possibilities:

    • Use SSH / SCP. With that, you can simply copy any file to the remote machine, as long as you set up passwordless keys. See Putty and pscp

    • Use mail. With MIME::Lite, your Windows machine can fire off a mail to either a local mailserver which does the routing, or directly to the ISP machine. As soon as MIME::Lite has handed off the mail, you get all the benefits of SMTP, including retries and MX fallbacks if one of your servers becomes unavailable.
    • Use ftp. With Net::FTP, your Windows machine can send a file to an outside machine.
    • Make a HTTP POST request using (for example) LWP::UserAgent and HTTP::Request.

    I would avoid writing directly into a MySQL database, as that means making MySQL accessible via the internet, which likely opens up lots of vulnerabilities for little gain.

Re: Perl on Windows project direction
by pc88mxer (Vicar) on Feb 24, 2008 at 19:37 UTC
    ... I have a need to regularly deliver some info...

    How often is 'regularly', and how much is 'some'? (Update: I see that you need to do this once a minute.)

    My first inclination would be to develop your own interface on top of HTTP (i.e. a REST interface.) It's simple to build, debug and extend incrementally. If you need encryption, just use https. It's also easy to set up action to be performed when you send the data or message. SNMP is a good idea if you already have an SNMP monitoring solution that you want to integrate it with.

    Another possibility is to use the Unix syslog mechanism over tcp if you can run a syslog daemon.

    I would definitely nix the direct Mysql access - it creates too many problems. The best solution kinda depends on what you want to do with the data and what kind of reliability requirements you have. For instance, you might want decouple the collection of the data and the sending of it to the Linux box in case your laptop can't reach the Internet.

Re: Perl on Windows project direction
by NiJo (Friar) on Feb 24, 2008 at 19:18 UTC
    Your project sounds a lot like network monitoring. You just just need to write a couple of plugins: Some custom parameters need to be polled, converted to the right format and configured for display on the server. There are a couple of free network monitoring packages: nagios, big brother, mrtg etc.

    It might even be simpler to move the web server directly to the laptop where you have full control. Some dynamic dns might be required.

Re: Perl on Windows project direction
by CountZero (Bishop) on Feb 24, 2008 at 21:17 UTC
    A first question which needs to be answered is: What kind of data can be picked up by the "Linux Web ISP platform website (with PHP)"?

    It is all nice and dandy to want to FTP a file over to the Linux machine, if there is no FTP-server listening that scheme will not work.

    If everything else fails, you can still write a PHP-webpage which offers a form that can be remotely filled in by WWW::Mechanize

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      Wow! Thanks to all for excellent direction! I thank you all for considering a question in this format. It will let me start off on the right foot. Since I'm partial to PHP and have html forms running the front end of this application I'm going to look at WWW::Mechanize to start with.. Thanks Monks!

      Thing were going ok but I'm stopping for the night after some issues.

      I'm using ActiveState and from what I can see they don't have WWW:Mechanize. They have WWW::Mechanize::FormFiller. I'm confuse cuz I thought FormFiller was subset of Mechanize

      But I get an error:
      Can't locate www/Mechanize.pm in @INC.

      So I was using Mech Formfiller and LWP::UserAgent ; FF was working ok and return a complet 'GET' statement but LWP was complaining about

      Can't locate object method "Request=HASH(0x1cb5f94)" via package "HTTP"

      Formfiller was returning a full Get statement and just needs a service to run it.



      sleepy.