include the kitchen services and current ip

main
vitrinekast 9 months ago
parent 6eb2d5d3e0
commit 933143bb12

@ -13,10 +13,8 @@
<meta name="author" content="">
<meta name="description" content="">
<meta name="keywords" content="">
<meta property="og:type" content="">
<meta property="og:title" content="">
<meta property="og:image" content="">
<meta property="og:description" content="">
<meta property="og:url" content="">
@ -25,17 +23,15 @@
</head>
<body>
<header>
<h1>TL;DR</h1>
<h2>too log didn't read</h2>
<p>This log was generated on 2024-03-18 16:18:13.903913, the next will be available after 2024-03-18 19:18:13.903913</p>
<small>Some temp debug info: This log was generated on 2024-03-18 20:31:58.328818, the next will be available after 2024-03-18 23:31:58.328818. I now have 18 logs generated! </small>
</header>
<nav class="slider slider--top">
<label for="time">time</label>
<input type="range" min="0" max="100" id="time">
</nav>
<nav class="slider slider--left">
<label for="annotation">annotations</label>
<input class="vertical" type="range" value="0" min="0" max="400" id="annotation">
@ -47,6 +43,19 @@
<div class="main__inner">
<article>
<h2>What happened today?</h2>
<pre>sudo journalctl -S today -u kitchen-stove.service -u kitchen-bin.service -u kitchen-fridge.service -r -n</pre>
<p>Mar 18 17:39:13 chopchop systemd[1]: Started kitchen-fridge.service - Kitchen Fridge Service.
Mar 18 17:39:07 chopchop python3[10827]: lp: No file in print request.
Mar 18 17:39:07 chopchop python3[10812]: request id is hp-color-laserjet-cp5225-16 (1 file(s))
Mar 18 17:39:06 chopchop systemd[1]: Started kitchen-stove.service - Kitchen Stove Service.
Mar 18 17:38:33 chopchop systemd[1]: Started kitchen-bin.service - Kitchen Bin Service.
</p>
end0:
-s
addressq
ip addr show eth0 | awk '$1 == "inet" {gsub(/\/.*$/, "", $2); print $2}'
<pre>uptime -s</pre>
<p>2024-03-18 07:51:34</p>
@ -58,19 +67,18 @@
an image.
</span>
<p>the ones below do not have the "right" annotation levels</p>
<pre>last_user_added</pre>
<pre>sudo journalctl _COMM=useradd -r -n 1 --output-fields=MESSAGE</pre>
<p>Feb 29 15:08:48 chopchop useradd[8744]: new user: name=colord, UID=118, GID=130, home=/var/lib/colord, shell=/usr/sbin/nologin, from=/dev/pts/4
<span class="annotation fn-annotatation" level="1">
A level 1 annotation for last_user_added
</span>
</p>
<span class="annotation fn-annotatation" level="2">
Users will be trusted with not just the keys and passwords to the "house" which is the server, but with a
portion of responsibility to keep it afloat and contribute to what makes it a community of practices (and
network of knowledge and dependence).
</span>
<hr />
<pre>users_created_today</pre>
<p>-- No entries --
@ -79,7 +87,6 @@
A level 1 annotation for users_created_today
</span>
<pre>list_active_services</pre>
<p> [ - ] alsa-utils
[ - ] apparmor
@ -124,7 +131,6 @@
A level 1 annotation for list_active_services
</span>
<pre>list_groups</pre>
<p>root:x:0:
daemon:x:1:
@ -229,8 +235,6 @@ colord:x:130:
A level 1 annotation for list_groups
</span>
<pre>list_package_installs</pre>
<p>2024-03-10 15:16:14 install libtk8.6:armhf <none> 8.6.13-2
2024-03-10 15:16:14 status half-installed libtk8.6:armhf 8.6.13-2
@ -276,7 +280,6 @@ colord:x:130:
A level 1 annotation for list_package_installs
</span>
<pre>list_package_upgrade</pre>
<p>
@ -284,7 +287,6 @@ colord:x:130:
A level 1 annotation for list_package_upgrade
</span>
<pre>list_package_remove</pre>
<p>2024-03-15 09:55:52 startup packages remove
2024-03-15 09:55:52 remove bat:armhf 0.22.1-4 <none>
@ -294,7 +296,6 @@ colord:x:130:
A level 1 annotation for list_package_remove
</span>
<pre>device_info</pre>
<p>Raspberry Pi 4 Model B Rev 1.4
@ -302,7 +303,6 @@ colord:x:130:
A level 1 annotation for device_info
</span>
<pre>debian_version</pre>
<p>12.1
@ -311,7 +311,6 @@ colord:x:130:
A level 1 annotation for debian_version
</span>
<pre>kernel_version</pre>
<p>Linux chopchop 6.1.65-v8+ #1703 SMP PREEMPT Tue Dec 5 16:25:41 GMT 2023 aarch64 GNU/Linux
@ -320,25 +319,19 @@ colord:x:130:
A level 1 annotation for kernel_version
</span>
</article>
</div>
</main>
<aside>
<h3>whoami: Raspberry Pi 4 Model B Rev 1.4</h3>
</aside>
<footer>
<h3> current residency 127.0.1.1
</h3>
<h3> current residency 145.24.139.169</h3>
</footer>
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript">
window.addEventListener("DOMContentLoaded", function () {
var nextDate = new Date("2024-03-18 19:18:13.903913");
var nextDate = new Date("2024-03-18 23:31:58.328818");
var now = new Date();
var ms = nextDate - now;
console.log("start a timeout in , ", ms);
@ -351,8 +344,6 @@ colord:x:130:
}, ms + 10000);
}
});
</script>
</body>

@ -1,11 +1,17 @@
from jinja2 import Environment, FileSystemLoader
import subprocess
from datetime import datetime, timedelta
import os
import fnmatch
amount_of_logs = len(fnmatch.filter(os.listdir("./logs"), '*.html'))
now = datetime.today()
next_report = now + timedelta(hours=3)
last_user_added = subprocess.run(["sudo", "journalctl","_COMM=useradd","-r","-n", "1" , "--output-fields=MESSAGE"], capture_output=True).stdout.decode('UTF-8')
last_user_added = subprocess.run(["sudo", "journalctl","_COMM=useradd","-r","-n", "1" , "--output-fields=MESSAGE"], capture_output=True)
last_user_added_name = subprocess.run(['grep', '-Po', "(?<=name)\W*\K[^ ]*"], input=last_user_added.stdout, capture_output=True).stdout.decode('UTF-8').strip()
users_created_today = subprocess.run(["sudo", "journalctl", "-S","today","_COMM=useradd","-r","-n","1","--output-fields=MESSAGE"], capture_output=True).stdout.decode('UTF-8')
list_active_services = subprocess.run(["sudo", "service", "--status-all"], capture_output=True).stdout.decode('UTF-8')
list_groups = subprocess.run(["getent","group"], capture_output=True).stdout.decode('UTF-8')
@ -17,10 +23,16 @@ list_package_upgrade = subprocess.run(["grep", 'upgrade', "/var/log/dpkg.log"],
list_package_remove = subprocess.run(["grep", 'remove', "/var/log/dpkg.log"], capture_output=True).stdout.decode('UTF-8')
device_info_grab = subprocess.run(["grep", 'Model' , "/proc/cpuinfo"], check=True, capture_output=True)
device_info = subprocess.run(['awk', '-F:', '{ print $2}'], input=device_info_grab.stdout, capture_output=True).stdout.decode('utf-8').strip()
ip_address_show = subprocess.run(["ip", "addr", "show", "end0"], check=True, capture_output=True)
ip_address = subprocess.run(['awk', '$1 == "inet" {gsub(/\/.*$/, "", $2); print $2}' ], input=ip_address_show.stdout, capture_output=True).stdout.decode('utf-8').strip()
debian_version = subprocess.run(["cat", "/etc/debian_version"], capture_output=True).stdout.decode('UTF-8')
kernel_version = subprocess.run(["uname","-a"], capture_output=True).stdout.decode('UTF-8')
hostname = subprocess.run(["hostname","-i"], capture_output=True).stdout.decode('UTF-8')
kitchen_services = subprocess.run(["sudo", "journalctl", "-S", "today", "-u", "kitchen-stove.service", "-u", "kitchen-bin.service", "-u", "kitchen-fridge.service", "-r", "-n"], capture_output=True).stdout.decode('UTF-8')
# loading the environment
env = Environment(loader=FileSystemLoader("templates"))
@ -31,7 +43,9 @@ template = env.get_template("template.jinja")
output = template.render(
now = now,
next_report = next_report,
last_user_added=last_user_added,
amount_of_logs = amount_of_logs,
last_user_added=last_user_added.stdout.decode('UTF-8'),
last_user_added_name=last_user_added_name,
users_created_today=users_created_today,
list_active_services=list_active_services,
list_groups=list_groups,
@ -43,7 +57,9 @@ output = template.render(
debian_version=debian_version,
kernel_version=kernel_version,
hostname=hostname,
days_since_last_boot = time_since_last_boot.days
days_since_last_boot = time_since_last_boot.days,
kitchen_services = kitchen_services,
ip_address = ip_address
)
log_file_name = "logs/log_" + now.strftime("%Y-%m-%d_%H:%M:%S") + ".html"

@ -189,6 +189,10 @@ h3 {
color: var(--text-color-lighter);
}
hr {
width: 100%;
margin: 2rem auto;
}
input[type="range"] {
-webkit-appearance: none;
appearance: none;

@ -13,10 +13,8 @@
<meta name="author" content="">
<meta name="description" content="">
<meta name="keywords" content="">
<meta property="og:type" content="">
<meta property="og:title" content="">
<meta property="og:image" content="">
<meta property="og:description" content="">
<meta property="og:url" content="">
@ -25,17 +23,15 @@
</head>
<body>
<header>
<h1>TL;DR</h1>
<h2>too log didn't read</h2>
<p>This log was generated on {{ now }}, the next will be available after {{ next_report }}</p>
<small>Some temp debug info: This log was generated on {{ now }}, the next will be available after {{ next_report }}. I now have {{ amount_of_logs }} logs generated! </small>
</header>
<nav class="slider slider--top">
<label for="time">time</label>
<input type="range" min="0" max="100" id="time">
</nav>
<nav class="slider slider--left">
<label for="annotation">annotations</label>
<input class="vertical" type="range" value="0" min="0" max="400" id="annotation">
@ -47,6 +43,14 @@
<div class="main__inner">
<article>
<h2>What happened today?</h2>
<pre>sudo journalctl -S today -u kitchen-stove.service -u kitchen-bin.service -u kitchen-fridge.service -r -n</pre>
<p>{{kitchen_services}}</p>
end0:
-s
addressq
ip addr show eth0 | awk '$1 == "inet" {gsub(/\/.*$/, "", $2); print $2}'
<pre>uptime -s</pre>
<p>{{ since_last_boot }}</p>
@ -58,20 +62,21 @@
an image.{% endif %}
</span>
{% endif %}
<p>the ones below do not have the "right" annotation levels</p>
<pre>last_user_added</pre>
<p>{{last_user_added}}
{% if last_user_added is defined %}
<span class="annotation fn-annotatation" level="1">
A level 1 annotation for last_user_added
</span>
{% else %}
(no input)
{% endif %}
<pre>sudo journalctl _COMM=useradd -r -n 1 --output-fields=MESSAGE</pre>
<p>{{last_user_added}}</p>
{% if last_user_name is defined %}
<span class="annotation fn-annotatation" level="1">
{{ last_user_name}} user/s was/were added [] days ago, and the network of trust grew ever so slightly.
</span>
{% endif %}
{% if last_user_added is defined %}
<span class="annotation fn-annotatation" level="2">
Users will be trusted with not just the keys and passwords to the "house" which is the server, but with a
portion of responsibility to keep it afloat and contribute to what makes it a community of practices (and
network of knowledge and dependence).
</span>
{% endif %}
<hr />
<pre>users_created_today</pre>
<p>{{users_created_today}}
{% if users_created_today is defined %}
@ -81,7 +86,6 @@
{% else %}
(no input)
{% endif %}
<pre>list_active_services</pre>
<p>{{list_active_services}}
{% if list_active_services is defined %}
@ -91,7 +95,6 @@
{% else %}
(no input)
{% endif %}
<pre>list_groups</pre>
<p>{{list_groups}}
{% if list_groups is defined %}
@ -101,8 +104,6 @@
{% else %}
(no input)
{% endif %}
<pre>list_package_installs</pre>
<p>{{list_package_installs}}
{% if list_package_installs is defined %}
@ -112,7 +113,6 @@
{% else %}
(no input)
{% endif %}
<pre>list_package_upgrade</pre>
<p>{{list_package_upgrade}}
{% if list_package_upgrade is defined %}
@ -122,7 +122,6 @@
{% else %}
(no input)
{% endif %}
<pre>list_package_remove</pre>
<p>{{list_package_remove}}
{% if list_package_remove is defined %}
@ -132,7 +131,6 @@
{% else %}
(no input)
{% endif %}
<pre>device_info</pre>
<p>{{device_info}}
{% if device_info is defined %}
@ -142,7 +140,6 @@
{% else %}
(no input)
{% endif %}
<pre>debian_version</pre>
<p>{{debian_version}}
{% if debian_version is defined %}
@ -152,7 +149,6 @@
{% else %}
(no input)
{% endif %}
<pre>kernel_version</pre>
<p>{{kernel_version}}
{% if kernel_version is defined %}
@ -162,20 +158,15 @@
{% else %}
(no input)
{% endif %}
</article>
</div>
</main>
<aside>
<h3>whoami: {{device_info}}</h3>
</aside>
<footer>
<h3> current residency {{hostname}}</h3>
<h3> current residency {{ip_address}}</h3>
</footer>
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript">
window.addEventListener("DOMContentLoaded", function () {
@ -192,8 +183,6 @@
}, ms + 10000);
}
});
</script>
</body>

Loading…
Cancel
Save