Gheek.net

February 15, 2008

Solarwinds_report_sh

Filed under: shell scripts, solarwinds — Tags: , — lancevermilion @ 3:37 pm

This is used with the following files to create the Solarwinds report.
Calls Solarwinds_report.pl which uses Solarwinds_sample_wanstatusinput

#!/bin/sh
#
# Call cat /usr/local/bin/statusinput.txt | /usr/bin/perl /usr/local/bin/solarwinds_report.pl
#
/bin/cat /srv/www/htdocs/reports/inputfiles/Solarwinds_sample_wanstatusinput.txt | /usr/bin/perl /usr/local/bin/solarewinds_report.pl > /srv/www/htdocs/reports/WWOSR-`date +%m-%d-%Y`.html

echo "Please go to http://SOME_SOLARWINDS_SERVER_URL to login.
Then you can go to the URL below to view the report.
The report will only show graphs if you are logged into http://SOME_SOLARWINDS_SERVER_URL.

https://SOME_SOLARWINDS_SERVER_URL/reports/BWNOSR-`date +%m-%d-%Y`.html

-Status Report Generator" | mailx -r "SOME_FROM_USER_AT_SOME_DOMAIN" -s "Weekly WAN Operations Report" SOME_TO_USER_AT_SOME_DOMAIN

Solarwinds_report_pl

Filed under: perl, solarwinds — Tags: , — lancevermilion @ 3:32 pm

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 ' ' . "\n"; print ' ' . "\n"; print ' ' . "\n"; print ' ' . "\n"; print ' ' . "\n"; print ' ' . "\n"; print ' ' . "\n"; print '
Utilization statistics
From: ' . "$LASTWEEKYESTERDAY" . ' To: ' . "$YESTERDAY" . '
Response Time Statistics
From: ' . "$LASTWEEKYESTERDAY" . ' To: ' . "$YESTERDAY" . '
Utilization GraphResponse Time Graph
' . "\n"; print '
' . "\n"; print '
' . "\n"; print 'Issues:
' . "\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"; print ' ' . "\n"; print '
N/A
' . "\n"; print '

' . "\n"; } #next if ( /^(Summary:)\s(.*$)/ ); } print ' ' . "\n";

Solarwinds_sample_wanstatusinput

Filed under: solarwinds — Tags: — lancevermilion @ 3:32 pm

This is a sample input that is used with Solarwinds_report_pl


Circuit: Circuit Description
Provider / Type: Vendor / Circuit Type
Speed: xxx kbps/mbps/gbps/etc
Primary Service: What is this link used for? Maybe link to Chase Bank
Summary: Short description of what this ciruit is used for and what kind of traffic goes over this link
N:
I:

Create a free website or blog at WordPress.com.