| 1 | khatus |
| 2 | ====== |
| 3 | ![mascot](mascot.jpg) |
| 4 | |
| 5 | Experimental, 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 | |
| 11 | Design |
| 12 | ------ |
| 13 | |
| 14 | ``` |
| 15 | parallel +----------+ +----------+ +----------+ |
| 16 | stateless | sensor_1 | | sensor_2 | ... | sensor_n | |
| 17 | collectors +----------+ +----------+ +----------+ |
| 18 | | | | |
| 19 | data data data |
| 20 | | | | |
| 21 | V V V |
| 22 | serial +-----------------------------------------+ |
| 23 | stateful | controller | |
| 24 | observer +-----------------------------------------+ |
| 25 | | |
| 26 | decisions |
| 27 | | |
| 28 | V |
| 29 | serial +-----------------------------------------+ |
| 30 | stateless | actuator | |
| 31 | executor +-----------------------------------------+ |
| 32 | | |
| 33 | system commands |
| 34 | | |
| 35 | V |
| 36 | ~~~~~~ |
| 37 | ~ OS ~ |
| 38 | ~~~~~~ |
| 39 | ``` |
| 40 | |
| 41 | ### Actuator |
| 42 | By default, actuator is left disconnected from the controller's output, so if |
| 43 | desired - it needs to be manually attached when starting `khatus`. For example, |
| 44 | in my `.xinitrc` I have: |
| 45 | |
| 46 | ```sh |
| 47 | $BIN/khatus \ |
| 48 | 2> >($BIN/twrap.sh >> $HOME/var/log/khatus.log) \ |
| 49 | | $BIN/khatus_actuator \ |
| 50 | -v pid="$$" \ |
| 51 | -v display=":0" \ |
| 52 | 2> >($BIN/twrap.sh >> $HOME/var/log/khatus-actuator.log) \ |
| 53 | & |
| 54 | ``` |
| 55 | |
| 56 | (`twrap.sh` is a simple script which prefixes a timestamp to each line) |
| 57 | |
| 58 | The idea is to later have multiple, (some more-general and some more-specific) |
| 59 | actuators which can be selected as needed, say for example: |
| 60 | |
| 61 | ```sh |
| 62 | $BIN/khatus \ |
| 63 | | tee \ |
| 64 | >(awk '/^STATUS_BAR/ {sub("^" $1 " *", ""); system("xsetroot -name \" " $0 " \"")}') \ |
| 65 | >(grep '^REPORT' | actuate_report_to_email) \ |
| 66 | >(grep '^ALERT' | grep mpd | actuate_alert_to_email) \ |
| 67 | >(grep '^ALERT' | grep IntrusionAttempt | actuate_intruder_to_iptables_drop) \ |
| 68 | >(grep '^ALERT' | grep NewDevice | actuate_alert_to_notify_send) |
| 69 | >(grep '^ALERT' | grep DiskError | actuate_call_mom) |
| 70 | ``` |
| 71 | |
| 72 | ... and/or any other such fun you might imagine. |
| 73 | |
| 74 | ### Errors |
| 75 | Any errors encountered by any sensor are propagated as alerts by the |
| 76 | controller, which are in turn actualized as desktop notifications by the |
| 77 | actuator: |
| 78 | |
| 79 | ![screenshot-self-error-propagation](screenshot-self-error-propagation.jpg) |