Merge remote-tracking branch 'origin/master' into prod
* origin/master: Ignore ingress.rrd Create RRD nicer table
This commit is contained in:
commit
1d9cba737e
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
ingress.rrd
|
||||
2
add
2
add
@ -18,7 +18,7 @@
|
||||
|
||||
. settings
|
||||
|
||||
if [[ $REQUEST_METHOD != POST ]]
|
||||
if [[ $REQUEST_METHOD != POST ]] || [ ! -w "$rrdfile" ]
|
||||
then
|
||||
cat <<-EOHead
|
||||
Content-type: text/plain
|
||||
|
||||
47
add.html
47
add.html
@ -80,6 +80,53 @@ Expires: $(LC_ALL=C TZ=GMT date +'%a, %d %b %Y %X %Z')
|
||||
<td style="background:black; color:white">Add data</td>
|
||||
</tr>
|
||||
</table>
|
||||
EOHTML
|
||||
if ! [ -w "$rrdfile" ]
|
||||
then
|
||||
rrdtool create ingress.rrd -s $((60*60)) \
|
||||
DS:AP:GAUGE:$((2*24*60*60)):0:NaN \
|
||||
DS:Explorer:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:Seer:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:XM:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:Hacker:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:Builder:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:Connector:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:Mind_Controller:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:MU:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:Longest_Link:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:Largest_Field:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:Recharger:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:Liberator:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:Pioneer:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:Purifier:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:Neutralized:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:Links_Destroyed:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:Fields_Destroyed:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:Walked:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:Guardian:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:Link_Maintained:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:Link_Length_x_Days:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:Field_Held:GAUGE:$((48*60*60)):0:NaN \
|
||||
DS:Field_x_Days:GAUGE:$((48*60*60)):0:NaN \
|
||||
RRA:HWPREDICT:8760:8e-1:8e-1:$((24)) \
|
||||
RRA:AVERAGE:99e-2:1:$((24*15)) \
|
||||
RRA:MAX:99e-2:1:$((24*15)) \
|
||||
RRA:AVERAGE:99e-2:4:$((24*180)) \
|
||||
RRA:MAX:99e-2:4:$((24*180)) \
|
||||
RRA:AVERAGE:99e-2:24:$(((4*365)+1)) \
|
||||
RRA:MAX:99e-2:24:$(((4*365)+1)) \
|
||||
RRA:AVERAGE:99e-2:$((24*30)):$(((32*365)+8)) \
|
||||
RRA:MAX:99e-2:$((24*30)):$(((32*365)+8)) \
|
||||
|| {
|
||||
cat <<-EOHTML
|
||||
<h1 style="color:red">Cannot create $rrdfile</h1>
|
||||
</body>
|
||||
</html>
|
||||
EOHTML
|
||||
exit
|
||||
}
|
||||
fi
|
||||
cat <<-EOHTML
|
||||
<form method="post" action="add">
|
||||
<ul>
|
||||
EOHTML
|
||||
|
||||
45
index
45
index
@ -17,6 +17,17 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. settings
|
||||
if [ ! -w "$rrdfile" ]
|
||||
then
|
||||
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/add.html
|
||||
|
||||
EOHead
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -n "$QUERY_STRING" ]
|
||||
then
|
||||
@ -148,12 +159,12 @@ then
|
||||
<div>
|
||||
<table style="width:840px">
|
||||
<tr>
|
||||
<td>Level</td>
|
||||
<td>AP</td>
|
||||
<td style="width:170px">Silver</td>
|
||||
<td style="width:170px">Gold</td>
|
||||
<td style="width:170px">Platinum</td>
|
||||
<td style="width:170px">Black</td>
|
||||
<th>Level</th>
|
||||
<th>AP</th>
|
||||
<th style="width:170px">Silver</th>
|
||||
<th style="width:170px">Gold</th>
|
||||
<th style="width:170px">Platinum</th>
|
||||
<th style="width:170px">Black</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
@ -242,23 +253,23 @@ then
|
||||
EOHTML
|
||||
for level in {1..16}
|
||||
do
|
||||
echo "<tr><td>$level</td>"
|
||||
echo "<tr><th style=\"text-align:right\">$level</th>"
|
||||
if (( last["AP"] >= lvl[level] ))
|
||||
then
|
||||
echo '<td style="background:lightgreen">'
|
||||
echo '<td style="text-align:right; background:lightgreen">'
|
||||
printf "%'li" ${lvl[level]}
|
||||
echo '</td>'
|
||||
else
|
||||
readable=$(printf "%'li" ${lvl[level]})
|
||||
echo '<td style="background:lightgrey">'"${readable// / }"
|
||||
echo '<td style="text-align:right; background:lightgrey">'"${readable// / }"
|
||||
readable=$(printf "%'li" $(( last["AP"] - lvl[level] )))
|
||||
echo "<br />(<span style=\"color:#FF2020;font-weight:bold\">${readable// / }</span>)</td>"
|
||||
fi
|
||||
if (( silvercount >= lvlsilver[level] ))
|
||||
then
|
||||
echo '<td style="background:lightgreen">'${lvlsilver[level]}'</td>'
|
||||
echo '<td style="text-align:center; background:lightgreen">'${lvlsilver[level]}'</td>'
|
||||
else
|
||||
echo "<td style=\"background:lightgrey\">${lvlsilver[level]} (<span style=\"color:#FF2020;font-weight:bold\">$(( silvercount - lvlsilver[level] ))</span>)<br />"
|
||||
echo "<td style=\"text-align:center; background:lightgrey\">${lvlsilver[level]} (<span style=\"color:#FF2020;font-weight:bold\">$(( silvercount - lvlsilver[level] ))</span>)<br />"
|
||||
for id in {100..0}
|
||||
do
|
||||
[ -z "${upsilver[id]}" ] && continue
|
||||
@ -285,9 +296,9 @@ then
|
||||
fi
|
||||
if (( goldcount >= lvlgold[level] ))
|
||||
then
|
||||
echo '<td style="background:lightgreen">'${lvlgold[level]}'</td>'
|
||||
echo '<td style="text-align:center; background:lightgreen">'${lvlgold[level]}'</td>'
|
||||
else
|
||||
echo "<td style=\"background:lightgrey\">${lvlgold[level]} (<span style=\"color:#FF2020;font-weight:bold\">$(( goldcount - lvlgold[level] ))</span>)<br />"
|
||||
echo "<td style=\"text-align:center; background:lightgrey\">${lvlgold[level]} (<span style=\"color:#FF2020;font-weight:bold\">$(( goldcount - lvlgold[level] ))</span>)<br />"
|
||||
for id in {100..0}
|
||||
do
|
||||
[ -z "${upgold[id]}" ] && continue
|
||||
@ -314,9 +325,9 @@ then
|
||||
fi
|
||||
if (( platinumcount >= lvlplatinum[level] ))
|
||||
then
|
||||
echo '<td style="background:lightgreen">'${lvlplatinum[level]}'</td>'
|
||||
echo '<td style="text-align:center; background:lightgreen">'${lvlplatinum[level]}'</td>'
|
||||
else
|
||||
echo "<td style=\"background:lightgrey\">${lvlplatinum[level]} (<span style=\"color:#FF2020;font-weight:bold\">$(( platinumcount - lvlplatinum[level] ))</span>)<br />"
|
||||
echo "<td style=\"text-align:center; background:lightgrey\">${lvlplatinum[level]} (<span style=\"color:#FF2020;font-weight:bold\">$(( platinumcount - lvlplatinum[level] ))</span>)<br />"
|
||||
for id in {100..0}
|
||||
do
|
||||
[ -z "${upplatinum[id]}" ] && continue
|
||||
@ -343,9 +354,9 @@ then
|
||||
fi
|
||||
if (( blackcount >= lvlblack[level] ))
|
||||
then
|
||||
echo '<td style="background:lightgreen">'${lvlblack[level]}'</td>'
|
||||
echo '<td style="text-align:center; background:lightgreen">'${lvlblack[level]}'</td>'
|
||||
else
|
||||
echo "<td style=\"background:lightgrey\">${lvlblack[level]} (<span style=\"color:#FF2020;font-weight:bold\">$(( blackcount - lvlblack[level] ))</span>)<br />"
|
||||
echo "<td style=\"text-align:center; background:lightgrey\">${lvlblack[level]} (<span style=\"color:#FF2020;font-weight:bold\">$(( blackcount - lvlblack[level] ))</span>)<br />"
|
||||
for id in {100..0}
|
||||
do
|
||||
[ -z "${upblack[id]}" ] && continue
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user