uplink_summary.pl - generate and email a pretty HTML formatted report of your ISP uplinks
uplink_summary.pl [-options] [-v] available options: ------------------------------------------------ back: days backwards used to determine reporting period email: email address to send the report to start/stop: start/end day in DD format help: display this help page verbose: verbose/debug output
Add to cron:
# crontab -e 30 5 1 * * /usr/local/sbin/uplink_summary.pl
Or better yet, add to your systems periodic scripts. On FreeBSD, this would be optimal:
mkdir -p /usr/local/etc/periodic/weekly && chdir /usr/local/etc/periodic/weekly echo '#!/bin/sh' > uplink_summary.sh echo '/usr/local/sbin/uplink_summary.pl' >> uplink_summary.sh chmod 755 uplink_summary.sh
The default reporting time period is the first day of the current month until the last complete day of data, yesterday. The exception to this rule is EOM (End of Month) days. If run within 5 days of of the end of the month (ie, the 1-5 of the next month), then the reporting interval is the previous complete month.
This setting allows specification of how many days -back are used when calculating the month to report. To run a report for the previous month when the current day is greater than 5, set -back to a value of todays day plus one.
Examples: Jan 25th, -back 5, reports Jan 1-24 Feb 04th, -back 5, reports Jan 1-31 Feb 10th, -back 5, reports Feb 1-9 Feb 10th, -back 11, reports Jan 1-31 Feb 10th, -back 45, reports Dec 1-31
The report is automatically emailed to each email address listed in the reporter.conf file. You can optionally specify an email address on the command line that overrides the config file settings.
Prints out the pod documentation.
If the -back option doesn't provide the exact date range you want, you can optional specify a -start and -end day for the report. This would be useful if you were reporting on a basis other than monthly.
This billing is designed to run quietly via cron and only generate noise if errors are encountered. The -verbose option prints out status information while processing.
Generates an uplink report that shows how much traffic each ISP uplink port is utilizing. We run this report weekly and it gives our operations team and executives a high level overview of our network traffic. It also gives us handy reference points to compare and validate the usage our ISPs bill us for. An example is included.
Configuration and syntax is defined in the rtgreport.conf file. The default location is in /usr/local/etc. See the example configuration file for additional documentation.
Uses the following perl built-in modules: English, Getopt::Long
Also uses the following CPAN perl modules: Date::Calc, DBIx::Simple, MIME::Lite, Net::SMTP, Config::Std
- added pod documentation - moved config settings into rtgreport.conf - renamed dcs to groups (more generally applicable) - renamed pods to networks (see above)
Matt Simerson <email@example.com> and Jason Morton <firstname.lastname@example.org>
Copyright (c) 2007 Layered Technologies, Inc. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.