summaryrefslogtreecommitdiff
path: root/vnstat-gen-dir
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2013-08-05 16:36:19 +0200
committerPeter Wu <lekensteyn@gmail.com>2013-08-05 16:36:19 +0200
commiteeb5f89ba0000edf6a5480a38ff6fca958c4ef32 (patch)
treed868eb3f7f24459e30f27a82cb47ae97c65be1bc /vnstat-gen-dir
parent0c2df7e8b5f1322b3a7fbde89940b4d3bc37475d (diff)
downloadscripts-eeb5f89ba0000edf6a5480a38ff6fca958c4ef32.tar.gz
vnstats-gen-dir: add vnstats helper
Diffstat (limited to 'vnstat-gen-dir')
-rwxr-xr-xvnstat-gen-dir39
1 files changed, 39 insertions, 0 deletions
diff --git a/vnstat-gen-dir b/vnstat-gen-dir
new file mode 100755
index 0000000..baa4efe
--- /dev/null
+++ b/vnstat-gen-dir
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+outputdir="${1:-/tmp}"
+outputdir+=/vnstats
+: ${IFACES:=wlan0+he6 wlan0 he6}
+
+mkdir -p "$outputdir"
+
+cat <<HTML >"$outputdir/index.html"
+<!doctype html>
+<head>
+<meta charset="utf-8">
+<meta name="robots" content="noindex, nofollow">
+<title>vnstati</title>
+</head>
+<body>
+HTML
+
+for iface in $IFACES; do
+ base="vnstat-$iface"
+ for i in s h d t m; do
+ vnstati -i "$iface" -$i -o "$outputdir/${base}_$i.png"
+ done
+cat <<HTML >>"$outputdir/index.html"
+<table border="0"><tr><td>
+<img src="${base}_s.png" border="0" alt="summary"></td><td>
+<img src="${base}_h.png" border="0" alt="hourly"></td></tr><tr><td valign="top">
+<img src="${base}_d.png" border="0" alt="daily"></td><td valign="top">
+<img src="${base}_t.png" border="0" alt="top 10"><br>
+<img src="${base}_m.png" border="0" alt="monthly" vspace="4"></td></tr>
+</table>
+<hr>
+HTML
+done
+
+cat <<HTML >>"$outputdir/index.html"
+</body>
+</html>
+HTML