#!/usr/bin/perl # # @(#)$Header: $ ################################################################################ # # Documentation for libwww and URI is available at: # http://www.linpro.no.lwp # # Both of these modules are available on CPAN at: # http://www.perl.com/CPAN # use LWP::UserAgent; use URI::URL; ################################################################################ # # Create a User Agent to make our query # $ua = new LWP::UserAgent; $ua->agent("Mozilla/0.1 " . $ua->agent); # # Create the URL for our query. # Insert the hostname of your Inmon Traffic server in the url here # my $url = url('http://www.inmon.com/its/query/Traffic'); # # Each of these query parameters is documented at: # http://www.inmon.com/help/traffic # $url->query_form ( tableType => 'IPV4', addressType => 'IP', resultField => 'sourceAddress,destinationAddress,frames', resultTruncate => '500', resultSort => 'frames', groupMask => '10.0.0.0/8/24', date => 'today', resultFormat => 'csv' ); # # This is a sample query - review the documentation referenced above, and # modify as necessary. # # # Actually make the request # $request = new HTTP::Request 'GET' => $url; # # Receive the response # $request->header('Accept' => 'text/html'); $response = $ua->request($request); # # check status! # if ($response->is_success) { print "Request Succeeded\n"; } else { print "Failed Request\n"; print "Error: " . $response->code . " " . $response->message; exit; } # # Format the content of the response, and place it in an array # @matrix = split(/\n/,$response->content); # # Here's where you could do other fun stuff - # I'm just going to print the results here # foreach $record (@matrix) { print "$record\n"; } exit;