home/bin/stats.sh

43 lines
1.3 KiB
Bash
Raw Normal View History

2019-01-17 23:54:30 +01:00
#!/bin/sh
2022-11-08 22:19:30 +01:00
output="/var/www/systemchaos.org/www/htdocs/stats/"
2024-03-13 17:57:07 +01:00
outputhanez="/var/www/hanez.org/www/_site/statistics/"
2019-01-17 23:54:30 +01:00
nic="eth0"
2019-01-18 21:50:34 +01:00
name=$(hostname)
2019-01-17 23:54:30 +01:00
generate_index() {
cat <<-EOF
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="cache-control" content=no-cache">
<meta http-equiv="refresh" content="3000">
<meta name="viewport" content="width=device-width, initial-scale=1">
2019-01-18 21:50:34 +01:00
<title>$name: $nic network statistics</title>
2019-01-17 23:54:30 +01:00
</head>
<body style="background-color:#444">
<div style="text-align:center">
<div><img src="summary.png" alt="summary"></div>
2020-03-17 22:59:55 +01:00
<div><img src="fiveminutes.png" alt="summary"></div>
2020-03-16 23:50:32 +01:00
<div><img src="hours.png" alt="hours"></div>
2020-03-17 22:59:55 +01:00
<div><img src="hoursgraph.png" alt="hours"></div>
2019-01-17 23:54:30 +01:00
<div><img src="days.png" alt="days"></div>
2020-03-17 22:59:55 +01:00
<div><img src="top.png" alt="days"></div>
2019-01-17 23:54:30 +01:00
<div><img src="months.png" alt="months"></div>
2020-03-17 22:59:55 +01:00
<div><img src="years.png" alt="months"></div>
2019-01-17 23:54:30 +01:00
</div>
</body>
</html>
EOF
}
2019-01-18 21:50:34 +01:00
#if [ ! -f "$output"/index.html ]; then
2023-01-19 06:15:56 +01:00
# mkdir -p $output
# generate_index > "$output"/index.html
2019-01-18 21:50:34 +01:00
#fi
2019-01-17 23:54:30 +01:00
2020-03-17 22:59:55 +01:00
for type in fiveminutes hours hoursgraph days top months years summary hsummary vsummary; do
2023-01-19 06:15:56 +01:00
#vnstati --${type} -i $nic -o $output/${type}.png
vnstati --${type} -i $nic -ne -o $outputhanez/${type}.png
2019-01-17 23:54:30 +01:00
done