Do not attach anything to the sensor output stream by default
[khatus.git] / README.md
... / ...
CommitLineData
1khatus
2======
3![mascot](mascot.jpg)
4
5Experimental, system monitor and status (bar) reporter I use with
6[dwm](https://dwm.suckless.org/) on GNU/Linux.
7
8![screenshot](screenshot.jpg)
9
10
11Design
12------
13
14```
15parallel +----------+ +----------+ +----------+
16stateless | sensor_1 | | sensor_2 | ... | sensor_n |
17collectors +----------+ +----------+ +----------+
18 | | | |
19 data data data data
20 | | | |
21 V V V V
22serial +----------------------------------------------+
23stateful | controller |
24observer +----------------------------------------------+
25 |
26 decision messages
27decision |
28messages |
29copied to |
30any number |
31of interested |
32filter/actuator |
33combinations |
34 |
35 V
36 +-------------+-+---------+---------+
37 | | | |
38 V V V V
39parallel +------------+ +------------+ +------------+
40stateless | filter_1 | | filter_2 | ... | filter_n |
41filters +------------+ +------------+ +------------+
42 | | | |
43 V V V V
44parallel +------------+ +------------+ +------------+
45stateless | actuator_1 | | actuator_2 | ... | actuator_n |
46executors +------------+ +------------+ +------------+
47 | | | |
48 commands commands commands commands
49 | | | |
50 V V V V
51 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52 ~~~~~~~~~~~~~ operating system ~~~~~~~~~~~~~~~~~
53 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
54```
55
56### Actuator
57Actuator is anything that takes action upon controller messages. A few generic
58ones are included:
59
60- `khatus_actuate_alert_to_notify_send`
61- `khatus_actuate_status_bar_to_xsetroot_name`
62
63and, by default, are left disconnected from the controller's output, so if
64desired - it needs to be manually attached when starting `khatus`. For example,
65in my `.xinitrc` I have:
66
67```sh
68$BIN/khatus \
692> >($BIN/twrap >> $HOME/var/log/khatus.log) \
70| tee \
71 >($BIN/khatus_actuate_status_bar_to_xsetroot_name) \
72 >(grep -v MpdNowPlaying | $BIN/khatus_actuate_alert_to_notify_send) \
732> >($BIN/twrap >> $HOME/var/log/khatus-actuators.log) \
74&
75```
76(where `twrap` is a simple script which prefixes a timestamp to each line)
77
78The idea is to give maximum flexibility for what to do with the controller
79output, say, for instance:
80
81```sh
82$BIN/khatus \
83| tee \
84... \
85>(grep '^REPORT' | actuate_report_to_email) \
86>(grep '^ALERT' | grep mpd | actuate_alert_to_email) \
87>(grep '^ALERT' | grep IntrusionAttempt | actuate_intruder_to_iptables_drop) \
88>(grep '^ALERT' | grep NewDevice | actuate_alert_to_notify_send)
89>(grep '^ALERT' | grep DiskError | actuate_call_mom)
90...
91```
92... and so on, for any other such fun you might imagine.
93
94### Errors
95Any errors encountered by any sensor are propagated as alerts by the
96controller, which are in turn actualized as desktop notifications by the
97`khatus_actuate_alert_to_notify_send` actuator:
98
99![screenshot-self-error-propagation](screenshot-self-error-propagation.jpg)
100
101TODO
102----
103
104- retry/cache for sensors fetching flaky remote resources (such as weather)
105- throttling of broken sensors (constantly returns errors)
106- alert specification language
107 - trigger threshold
108 - above/bellow/equal to threshold value
109 - priority
110 - snooze time (if already alerted, when to re-alert?)
111 - text: subject/body
112- more-structured controller API: a sensor submits a list of k/v pairs
113
114Redesign notes
115--------------
116
117- controller should not do formatting
118- need in-memory db for diskless feedback/throttling and cache
This page took 0.017699 seconds and 4 git commands to generate.