This creates a report form information that solarwinds has. Perfect for management that needs bits of information on what is going on. Unfortunately at the time I wrote this Solarwinds didn’t support anything like this.
Make sure you use the sample input file from “Solarwinds_sample_wanstatusinput“.
This script is called by Solarwinds_report.sh
Solarwinds_report.sh
#!/usr/bin/perl -w
#
# Use the DateTime perl module
#
use DateTime;
#
# Set the timezone to Phoenix time and create an object that hold the current time
#
my $dt = DateTime->now(time_zone => 'America/Phoenix' );
#
# Subtract 1 day from today (as this is suppose to run only on mondays)
#
$dt->subtract( days => 1 );
my $YESTERDAY = $dt->mdy('/');
#
# Subtract 6 day from sunday to represent last monday
#
$dt->subtract( days => 6 );
my $LASTWEEKYESTERDAY = $dt->mdy('/');
#
# print the html required to document everything.
#
print'
Weekely Network Operations Status Report
P.breakhere {page-break-before: always}
Weekly Network Operations Status Report
' . "\n";
#
# while we read everything into this script preform a variety of tasks
#
while ()
{
#
# Match lines that start with Circuit: follow by a space and anything till the end of the line.
#
print ''. $2 . '
' . "\n" if ( /^(Circuit:)\s(.*$)/ );
#
# Match lines that start with Provider follow by anything
# until Type: followed a space and anything till the end of the line.
#
print '' . $1 . ' ' . $2 . "
\n" if ( /^(Provider.*Type:)\s(.*$)/ );
#
# Match lines that start with Speed: follow by a space and anything till the end of the line.
#
print '' . $1 . ' ' . $2 . "
\n" if ( /^(Speed:)\s(.*$)/ );
#
# Match lines that start with Primary follow by anything
# until : followed a space and anything till the end of the line.
#
print '' . $1 . ' ' . $2 . "
\n" if ( /^(Primary.*:)\s(.*$)/ );
#
# Match lines that start with Summary: follow by a space and anything till the end of the line.
#
print '' . $1 . ' ' . "
\n$2\n
\n" if ( /^(Summary:)\s(.*$)/ );
#
# Match lines that start with N: follow by a space and anything till the end of the line.
#
$NODENUM = $1 if ( /^N:\s(\d+).*$/ );
#
# Match lines that start with I: follow by a space and anything till the end of the line.
#
$INTERFACENUM = $1 if ( /^I:\s(\d+).*$/ );
if ( /^(I:)\s(\d+)/ )
{
print "\n
\n";
print '
' . "\n";
print ' ' . "\n";
print ' Utilization statistics From: ' . "$LASTWEEKYESTERDAY" . ' To: ' . "$YESTERDAY" . ' | ' . "\n";
print ' Response Time Statistics From: ' . "$LASTWEEKYESTERDAY" . ' To: ' . "$YESTERDAY" . ' | ' . "\n";
print '
' . "\n";
print ' ' . "\n";
print ' ![Utilization Graph]() | ' . "\n";
print ' ![Response Time Graph]() | ' . "\n";
print '
' . "\n";
print '
' . "\n";
print '
' . "\n";
print '
' . "\n";
print '
Issues:' . "\n";
print '
' . "\n";
print ' ' . "\n";
print ' N/A | ' . "\n";
print '
' . "\n";
print ' ' . "\n";
print ' | ' . "\n";
print '
' . "\n";
print ' ' . "\n";
print ' | ' . "\n";
print '
' . "\n";
print ' ' . "\n";
print ' | ' . "\n";
print '
' . "\n";
print '
' . "\n";
print '
' . "\n";
}
#next if ( /^(Summary:)\s(.*$)/ );
}
print '
' . "\n";