include the kitchen services and current ip

main
vitrinekast 8 months ago
parent 6eb2d5d3e0
commit 933143bb12

@ -13,10 +13,8 @@
<meta name="author" content=""> <meta name="author" content="">
<meta name="description" content=""> <meta name="description" content="">
<meta name="keywords" content=""> <meta name="keywords" content="">
<meta property="og:type" content=""> <meta property="og:type" content="">
<meta property="og:title" content=""> <meta property="og:title" content="">
<meta property="og:image" content=""> <meta property="og:image" content="">
<meta property="og:description" content=""> <meta property="og:description" content="">
<meta property="og:url" content=""> <meta property="og:url" content="">
@ -25,17 +23,15 @@
</head> </head>
<body> <body>
<header> <header>
<h1>TL;DR</h1> <h1>TL;DR</h1>
<h2>too log didn't read</h2> <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> </header>
<nav class="slider slider--top"> <nav class="slider slider--top">
<label for="time">time</label> <label for="time">time</label>
<input type="range" min="0" max="100" id="time"> <input type="range" min="0" max="100" id="time">
</nav> </nav>
<nav class="slider slider--left"> <nav class="slider slider--left">
<label for="annotation">annotations</label> <label for="annotation">annotations</label>
<input class="vertical" type="range" value="0" min="0" max="400" id="annotation"> <input class="vertical" type="range" value="0" min="0" max="400" id="annotation">
@ -47,6 +43,19 @@
<div class="main__inner"> <div class="main__inner">
<article> <article>
<h2>What happened today?</h2> <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> <pre>uptime -s</pre>
<p>2024-03-18 07:51:34</p> <p>2024-03-18 07:51:34</p>
@ -58,19 +67,18 @@
an image. an image.
</span> </span>
<pre>sudo journalctl _COMM=useradd -r -n 1 --output-fields=MESSAGE</pre>
<p>the ones below do not have the "right" annotation levels</p>
<pre>last_user_added</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 <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
</p>
<span class="annotation fn-annotatation" level="1">
A level 1 annotation for last_user_added <span class="annotation fn-annotatation" level="2">
</span> 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> <pre>users_created_today</pre>
<p>-- No entries -- <p>-- No entries --
@ -79,7 +87,6 @@
A level 1 annotation for users_created_today A level 1 annotation for users_created_today
</span> </span>
<pre>list_active_services</pre> <pre>list_active_services</pre>
<p> [ - ] alsa-utils <p> [ - ] alsa-utils
[ - ] apparmor [ - ] apparmor
@ -124,7 +131,6 @@
A level 1 annotation for list_active_services A level 1 annotation for list_active_services
</span> </span>
<pre>list_groups</pre> <pre>list_groups</pre>
<p>root:x:0: <p>root:x:0:
daemon:x:1: daemon:x:1:
@ -229,8 +235,6 @@ colord:x:130:
A level 1 annotation for list_groups A level 1 annotation for list_groups
</span> </span>
<pre>list_package_installs</pre> <pre>list_package_installs</pre>
<p>2024-03-10 15:16:14 install libtk8.6:armhf <none> 8.6.13-2 <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 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 A level 1 annotation for list_package_installs
</span> </span>
<pre>list_package_upgrade</pre> <pre>list_package_upgrade</pre>
<p> <p>
@ -284,7 +287,6 @@ colord:x:130:
A level 1 annotation for list_package_upgrade A level 1 annotation for list_package_upgrade
</span> </span>
<pre>list_package_remove</pre> <pre>list_package_remove</pre>
<p>2024-03-15 09:55:52 startup packages remove <p>2024-03-15 09:55:52 startup packages remove
2024-03-15 09:55:52 remove bat:armhf 0.22.1-4 <none> 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 A level 1 annotation for list_package_remove
</span> </span>
<pre>device_info</pre> <pre>device_info</pre>
<p>Raspberry Pi 4 Model B Rev 1.4 <p>Raspberry Pi 4 Model B Rev 1.4
@ -302,7 +303,6 @@ colord:x:130:
A level 1 annotation for device_info A level 1 annotation for device_info
</span> </span>
<pre>debian_version</pre> <pre>debian_version</pre>
<p>12.1 <p>12.1
@ -311,7 +311,6 @@ colord:x:130:
A level 1 annotation for debian_version A level 1 annotation for debian_version
</span> </span>
<pre>kernel_version</pre> <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 <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 A level 1 annotation for kernel_version
</span> </span>
</article> </article>
</div> </div>
</main> </main>
<aside> <aside>
<h3>whoami: Raspberry Pi 4 Model B Rev 1.4</h3> <h3>whoami: Raspberry Pi 4 Model B Rev 1.4</h3>
</aside> </aside>
<footer> <footer>
<h3> current residency 127.0.1.1 <h3> current residency 145.24.139.169</h3>
</h3>
</footer> </footer>
<script type="text/javascript" src="script.js"></script> <script type="text/javascript" src="script.js"></script>
<script type="text/javascript"> <script type="text/javascript">
window.addEventListener("DOMContentLoaded", function () { 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 now = new Date();
var ms = nextDate - now; var ms = nextDate - now;
console.log("start a timeout in , ", ms); console.log("start a timeout in , ", ms);
@ -351,8 +344,6 @@ colord:x:130:
}, ms + 10000); }, ms + 10000);
} }
}); });
</script> </script>
</body> </body>

@ -1,11 +1,17 @@
from jinja2 import Environment, FileSystemLoader from jinja2 import Environment, FileSystemLoader
import subprocess import subprocess
from datetime import datetime, timedelta from datetime import datetime, timedelta
import os
import fnmatch
amount_of_logs = len(fnmatch.filter(os.listdir("./logs"), '*.html'))
now = datetime.today() now = datetime.today()
next_report = now + timedelta(hours=3) 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') 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_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') 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') 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_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() 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') 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') 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') 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 # loading the environment
env = Environment(loader=FileSystemLoader("templates")) env = Environment(loader=FileSystemLoader("templates"))
@ -31,7 +43,9 @@ template = env.get_template("template.jinja")
output = template.render( output = template.render(
now = now, now = now,
next_report = next_report, 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, users_created_today=users_created_today,
list_active_services=list_active_services, list_active_services=list_active_services,
list_groups=list_groups, list_groups=list_groups,
@ -43,7 +57,9 @@ output = template.render(
debian_version=debian_version, debian_version=debian_version,
kernel_version=kernel_version, kernel_version=kernel_version,
hostname=hostname, 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" log_file_name = "logs/log_" + now.strftime("%Y-%m-%d_%H:%M:%S") + ".html"

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

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

Loading…
Cancel
Save