-
Notifications
You must be signed in to change notification settings - Fork 3
/
bwquota.sh
21 lines (18 loc) · 750 Bytes
/
bwquota.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# +----+----+----+----+
# | | | | |
# Author: Mark David Scott Cunningham | M | D | S | C |
# +----+----+----+----+
# Created: 2014-11-09
# Updated: 2014-11-09
#
#
#!/bin/bash
# Adapted from work by Ken Howell
# Poll Interworx for Bandwidth Quota usage and print to the screen
# Shows the top 20 bandwidth users by percentage use of their quota
if [[ -z $1 ]]; then linecount=20; else linecount=$1; fi
printf "\n%-40s %11s %11s %11s\n" " Domain" "Used(%)" "Used(G)" "Total(G)"; echo $(dash 80);
nodeworx -unc Siteworx -a listBandwidthAndStorage\
| awk '($4 !~ /999999999/) {printf "%-40s %10.3f%% %10.2fG %10.1fG\n"," "$2,(($3/1000)/$4*100),($3/1000),$4}'\
| sort -rnk2 | head -$linecount;
echo