about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgennyble <gen@nyble.dev>2025-02-16 10:18:07 -0600
committergennyble <gen@nyble.dev>2025-02-16 10:18:07 -0600
commit73be1f6de87f6cb6b4337bbc837033ec446d8306 (patch)
tree6c896a8745f30f5d15715d0e58a41de8f21edcdf
parent4a49c0127de438cc6c15250d9bb44a0b806add2a (diff)
download∞-73be1f6de87f6cb6b4337bbc837033ec446d8306.tar.gz
∞-73be1f6de87f6cb6b4337bbc837033ec446d8306.zip
statistics page start
-rw-r--r--served/statistics.html42
-rw-r--r--served/styles/statistics.css23
2 files changed, 65 insertions, 0 deletions
diff --git a/served/statistics.html b/served/statistics.html
new file mode 100644
index 0000000..32ba2bc
--- /dev/null
+++ b/served/statistics.html
@@ -0,0 +1,42 @@
+---
+template=post
+title=Starlight Statistics
+style=/styles/post.css
+style=/styles/statistics.css
+
+use-template=
+system-stats=
+---
+
+starlight is the server that runs my website, and thus my webserver.
+I've been wanting to build a little monitoring/system stats thing
+for awhile, and I can't think of a reason I care about to not make
+it public. Maybe you'll find it interesting, anyways.
+
+Graphs are unanimated GIFs and, currently, have no concept of time.
+Samples are taken every minute and graphs are generated every fifteen,
+so data should be reasonably current.
+
+[@paragraphs off]
+<section id="stats">
+	<section class="stat">
+		<h2>Memory</h2>
+		<img src="/api/stats/current_hostmeminfo.gif" id="hostmeminfo">
+		<p>
+			parsed from <code>/proc/meminfo</code>
+		</p>
+		<p>
+			total: {stats.mem.total}MB<br />
+			usage: {stats.mem.usage}MB<br />
+		</p>
+	</section>
+
+	<section class="stat">
+		<h2>Network</h2>
+		<img src="/api/stats/current_hostnetinfo.gif" id="hostnetinfo">
+		<p>
+			parsed from <code>/proc/net/dev</code><br />
+			receive in blue, transmit in green
+		</p>
+	</section>
+</section>
\ No newline at end of file
diff --git a/served/styles/statistics.css b/served/styles/statistics.css
new file mode 100644
index 0000000..2b9bb61
--- /dev/null
+++ b/served/styles/statistics.css
@@ -0,0 +1,23 @@
+#hostmeminfo,
+#hostnetinfo {
+	width: 256px;
+	height: 160px;
+	image-rendering: pixelated;
+	border: 1px solid var(--text);
+}
+
+.stat {
+	h2 {
+		margin: 0;
+	}
+
+	p:first-of-type {
+		margin-top: 0;
+	}
+}
+
+#stats {
+	display: grid;
+	grid-template-columns: 1fr 1fr;
+	column-gap: 0.5rem;
+}
\ No newline at end of file