Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Collecting data from a program that doesn't make it easy

by c4onastick (Friar)
on Oct 15, 2007 at 23:56 UTC ( #645069=perlquestion: print w/ replies, xml ) Need Help??
c4onastick has asked for the wisdom of the Perl Monks concerning the following question:

Greetings Monks,

I've got a problem at work that's I've been avoiding since not a 100% perl problem but after reading Empowered by Perl I was rejuvenated and I feel empowered enough to tackle it again!

We've got several pieces of equipment that we need to monitor the health of. Now, in the past this has just been done by calling the 'fix-it' guy as soon as it breaks. I did a little snooping and found a option to print a pretty detailed report containing a bunch of values that we might be interested in monitoring. It's even in a nice form that would be cake to parse with perl. I contacted the software company to see if they had an API that I could directly query to get that information out or a command line switch to generate that report to STDOUT, only to be disappointed. I get the feeling that when they were developing the software, they didn't foresee any single company owning as many of these as we do so I can't say that I blame them.

Ideally, I'd like to set up a 'cron' job (of course these all run on Windows so I'm not sure that's trivial) to generate that report in plain text and save it somewhere on the network, then I can get another perl script to parse them and add them to a sqlite database.

So I seek your wisdom regarding the following problems:

  • How could I set up a perl program (or another program) to act as a printer so I can get the output in plain text? (Essentially a 'print to file' workaround since there's no other output for that report besides printing it.)
  • How can I run that command (which, as far as I know, needs to be selected from the GUI's menu) in this program at scheduled intervals?

Thanks in advance for your insights, any thoughts on another approach would be greatly appreciated!

Comment on Collecting data from a program that doesn't make it easy
Re: Collecting data from a program that doesn't make it easy
by perlfan (Curate) on Oct 16, 2007 at 00:07 UTC
    Might something like this be helpful? Also, I am no Windows expert, but I know there is a cron-like scheduler.

      It may even be possible to scrape the windows for the text of the reports. That way you don't have to mess around with printing things.

      If that doesn't work, I was able to extract the text from a PDF file I printed with PDFCreator--an open source virtual printer for windows systems.


      TGI says moo

      Excellent, thank you. This module looks amazing, I can think of about a dozen other things I'd love to automate. I had no idea that such a module even existed!

      I'll keep everyone posted, thanks again for your help!

Re: Collecting data from a program that doesn't make it easy
by GSF (Acolyte) on Oct 16, 2007 at 00:50 UTC
    Take a look at something like http://www.cutepdf.com/Products/CutePDF/writer.asp

    Consider the AT command for scheduling jobs on windows.

    AT will not work if you don't have a command line. Consider looking at video game hacks. I remember a Ultima Online hack that used Macro.exe from windows 3.1 to interact with windows online.

    Let me know your progress I have lots of suggestions. But wife just called so gotta runnnn

Re: Collecting data from a program that doesn't make it easy
by Corion (Pope) on Oct 16, 2007 at 06:28 UTC
Re: Collecting data from a program that doesn't make it easy
by salva (Monsignor) on Oct 16, 2007 at 07:37 UTC
    There are several free/open source monitoring tools that you can use as the base for your aplication. For instance Nagios or Cacti.
Re: Collecting data from a program that doesn't make it easy
by andreas1234567 (Vicar) on Oct 16, 2007 at 07:49 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://645069]
Approved by naikonta
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2014-07-25 09:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (170 votes), past polls