Separate level overview from stat history
This commit is contained in:
parent
26105a3969
commit
6b778ac461
20
add
20
add
@ -1,15 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
cat <<-EOHead
|
||||
Content-type: text/plain
|
||||
Last-Modified: $(LC_ALL=C TZ=GMT date +'%a, %d %b %Y %X %Z')
|
||||
Expires: $(LC_ALL=C TZ=GMT date +'%a, %d %b %Y %X %Z')
|
||||
refresh: 0,url=graph
|
||||
|
||||
EOHead
|
||||
|
||||
exec 2>&1
|
||||
|
||||
# Path to your fastcgi_cache (optional).
|
||||
#CACHE_DIR=/var/www/ingRRD/cache
|
||||
|
||||
@ -20,7 +10,15 @@ exec 2>&1
|
||||
# /cgi/$user/add.html
|
||||
IFS=/ read garbage garbage webuser garbage <<<"$REQUEST_URI"
|
||||
|
||||
if [[ $webuser == $AUTH_USER ]]
|
||||
cat <<-EOHead
|
||||
Content-type: text/plain
|
||||
Last-Modified: $(LC_ALL=C TZ=GMT date +'%a, %d %b %Y %X %Z')
|
||||
Expires: $(LC_ALL=C TZ=GMT date +'%a, %d %b %Y %X %Z')
|
||||
refresh: 0,url=/cgi/$webuser/
|
||||
|
||||
EOHead
|
||||
|
||||
if [[ $webuser == $AUTH_USER || $webuser == dev ]]
|
||||
then
|
||||
echo "Welcome agent $webuser"$'!\n\n'
|
||||
else
|
||||
|
||||
@ -130,6 +130,9 @@ then
|
||||
end)
|
||||
[[ $value =~ $exprtime ]] && end=$value
|
||||
;;
|
||||
hist|trend)
|
||||
show_graphs=1
|
||||
;;
|
||||
graph)
|
||||
[[ $value =~ $exprgraph ]] && graph=$value
|
||||
;;
|
||||
@ -163,6 +166,17 @@ then
|
||||
<body>
|
||||
EOHTML
|
||||
|
||||
if (( ! show_graphs ))
|
||||
then
|
||||
cat <<-EOHTML
|
||||
<table>
|
||||
<tr>
|
||||
<td style="background:black; color:white">Overview</td>
|
||||
<td><a href="?hist">History / Trend</a></td>
|
||||
<td><a href="add.html"><b>Add data</b></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
EOHTML
|
||||
readarray -t lastupdatelines < <(
|
||||
rrdtool lastupdate $rrdfile
|
||||
)
|
||||
@ -444,6 +458,16 @@ then
|
||||
cat <<-EOHTML
|
||||
</table>
|
||||
</div>
|
||||
EOHTML
|
||||
else
|
||||
cat <<-EOHTML
|
||||
<table>
|
||||
<tr>
|
||||
<td><a href="?">Overview</a></td>
|
||||
<td style="background:black; color:white">History / Trend</td>
|
||||
<td><a href="add.html"><b>Add data</b></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table style="width:$(( graph_width + 97 ))px">
|
||||
<tr>
|
||||
<td>
|
||||
@ -453,9 +477,6 @@ then
|
||||
<a href="?start=$(( start + 86400 ))&end=$end">></a>
|
||||
<a href="?start=$(( start + 604800 ))&end=$end">>></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="add.html">Add data</a>
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="?start=$start&end=$(( end - 604800 ))"><<</a>
|
||||
<a href="?start=$start&end=$(( end - 86400 ))"><</a>
|
||||
@ -507,12 +528,13 @@ then
|
||||
cat <<-EOHTML
|
||||
<div>
|
||||
<img
|
||||
src="graph?graph=$stat&start=$start&end=$end"
|
||||
src="?graph=$stat&start=$start&end=$end"
|
||||
id="$stat"
|
||||
alt="Ingress $stat evolution" />
|
||||
</div>
|
||||
EOHTML
|
||||
done
|
||||
fi
|
||||
encodeduri="${REQUEST_URI//\//%2F}"
|
||||
encodeduri="${encodeduri/\?/%3F}"
|
||||
encodeduri="${encodeduri//\=/%3D}"
|
||||
Loading…
x
Reference in New Issue
Block a user