Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

NetIQ Report Parser

by JSchmitz (Canon)
on Mar 09, 2006 at 18:28 UTC ( #535462=sourcecode: print w/replies, xml ) Need Help??
Category: HTML utility
Author/Contact Info
Description: This is a script that uses the HTML::TableExtract module that Mojotoad wrote. It is very handy for stripping out just the error messages in NetIQ reports for emailing them out. Matt helped me with this a lot so I have to give him props for this one.
#!/usr/bin/perl -w

use LWP::Simple;
use HTML::TableExtract;

my $html_report;
# replace this with LWP::Simple get() or somesuch
# for fetching main report
open(F, "<Report.htm") or die "oof: $!\n";
$html_report = join('', <F>);

foreach my $row (rows_from_main_report($html_report)) {
  next unless $row->[1] =~ /failed/i;
  my($link) = $row->[2] =~ /href\s*\=\s*\"?([^\"]+)/;
  unless ($link) {
    print STDERR "no link from row ($row->[2])\n";
  print "$link\n";
  my $html = get($link);
  unless ($html) {
    print STDERR "no html from link $link\n";
  print "$link\n";
  foreach my $row (rows_from_fail_report($html)) {
    # do whatever here
    print join(' : ', @$row), "\n";

sub rows_from_main_report {
  my $html = shift || die "HTML string required\n";
  my $te = HTML::TableExtract->new(
    headers   => [qw(computer data time)],
    keep_html => 1,
  my $ts = $te->first_table_state_found;

sub rows_from_fail_report {
  my $html = shift || die "HTML string required\n";
  my $te = HTML::TableExtract->new(
    headers => [qw(job date client class schedule master desc)],
  my $ts = $te->first_table_state_found;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://535462]
and cookies bake in the oven...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2018-01-19 16:44 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (221 votes). Check out past polls.