Add TODO for controller k/v API
[khatus.git] / README.md
CommitLineData
756b9d5a
SK
1khatus
2======
a9038fad 3![mascot](mascot.jpg)
756b9d5a 4
a9038fad 5Experimental, system monitor and status (bar) reporter I use with
61c33dc2 6[dwm](https://dwm.suckless.org/) on GNU/Linux.
756b9d5a
SK
7
8![screenshot](screenshot.jpg)
55407653
SK
9
10
11Design
12------
13
14```
43e49903
SK
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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55407653 54```
7daecd24 55
ec80b440 56### Actuator
43e49903
SK
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
ec80b440
SK
64desired - it needs to be manually attached when starting `khatus`. For example,
65in my `.xinitrc` I have:
66
67```sh
68$BIN/khatus \
43e49903
SK
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) \
ec80b440
SK
74&
75```
43e49903 76(where `twrap` is a simple script which prefixes a timestamp to each line)
ec80b440 77
43e49903
SK
78The idea is to give maximum flexibility for what to do with the controller
79output, say, for instance:
ec80b440
SK
80
81```sh
82$BIN/khatus \
83| tee \
43e49903 84... \
ec80b440
SK
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)
43e49903 90...
ec80b440 91```
43e49903 92... and so on, for any other such fun you might imagine.
ec80b440
SK
93
94### Errors
7daecd24
SK
95Any errors encountered by any sensor are propagated as alerts by the
96controller, which are in turn actualized as desktop notifications by the
43e49903 97`khatus_actuate_alert_to_notify_send` actuator:
ec80b440 98
7daecd24 99![screenshot-self-error-propagation](screenshot-self-error-propagation.jpg)
1341dc96
SK
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
0fc5e61f 112- more-structured controller API: a sensor submits a list of k/v pairs
7917538c
SK
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.029969 seconds and 4 git commands to generate.