Commit | Line | Data |
---|---|---|
756b9d5a SK |
1 | khatus |
2 | ====== | |
a9038fad | 3 | ![mascot](mascot.jpg) |
756b9d5a | 4 | |
a9038fad | 5 | Experimental, 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 | ||
11 | Design | |
12 | ------ | |
13 | ||
14 | ``` | |
43e49903 SK |
15 | parallel +----------+ +----------+ +----------+ |
16 | stateless | sensor_1 | | sensor_2 | ... | sensor_n | | |
17 | collectors +----------+ +----------+ +----------+ | |
18 | | | | | | |
19 | data data data data | |
20 | | | | | | |
21 | V V V V | |
22 | serial +----------------------------------------------+ | |
23 | stateful | controller | | |
24 | observer +----------------------------------------------+ | |
25 | | | |
26 | decision messages | |
27 | decision | | |
28 | messages | | |
29 | copied to | | |
30 | any number | | |
31 | of interested | | |
32 | filter/actuator | | |
33 | combinations | | |
34 | | | |
35 | V | |
36 | +-------------+-+---------+---------+ | |
37 | | | | | | |
38 | V V V V | |
39 | parallel +------------+ +------------+ +------------+ | |
40 | stateless | filter_1 | | filter_2 | ... | filter_n | | |
41 | filters +------------+ +------------+ +------------+ | |
42 | | | | | | |
43 | V V V V | |
44 | parallel +------------+ +------------+ +------------+ | |
45 | stateless | actuator_1 | | actuator_2 | ... | actuator_n | | |
46 | executors +------------+ +------------+ +------------+ | |
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 |
57 | Actuator is anything that takes action upon controller messages. A few generic |
58 | ones are included: | |
59 | ||
60 | - `khatus_actuate_alert_to_notify_send` | |
61 | - `khatus_actuate_status_bar_to_xsetroot_name` | |
62 | ||
63 | and, by default, are left disconnected from the controller's output, so if | |
ec80b440 SK |
64 | desired - it needs to be manually attached when starting `khatus`. For example, |
65 | in my `.xinitrc` I have: | |
66 | ||
67 | ```sh | |
68 | $BIN/khatus \ | |
43e49903 SK |
69 | 2> >($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) \ | |
73 | 2> >($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 |
78 | The idea is to give maximum flexibility for what to do with the controller |
79 | output, 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 |
95 | Any errors encountered by any sensor are propagated as alerts by the |
96 | controller, 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 | |
101 | TODO | |
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 |