-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9fa71de
commit 629bf96
Showing
57 changed files
with
694 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
source "$BR2_EXTERNAL_UNIPI_PATH/package/unipi_kernel/Config.in" | ||
source "$BR2_EXTERNAL_UNIPI_PATH/package/unipi_tools/Config.in" | ||
source "$BR2_EXTERNAL_UNIPI_PATH/package/python-asyncio-mqtt/Config.in" | ||
source "$BR2_EXTERNAL_UNIPI_PATH/package/python-rich/Config.in" | ||
source "$BR2_EXTERNAL_UNIPI_PATH/package/unipi-control/Config.in" | ||
source "$BR2_EXTERNAL_UNIPI_PATH/package/unipi-kernel/Config.in" | ||
source "$BR2_EXTERNAL_UNIPI_PATH/package/unipi-tools/Config.in" | ||
source "$BR2_EXTERNAL_UNIPI_PATH/package/zsh-autosuggestions/Config.in" | ||
source "$BR2_EXTERNAL_UNIPI_PATH/package/zsh-history-substring-search/Config.in" | ||
source "$BR2_EXTERNAL_UNIPI_PATH/package/zsh-syntax-highlighting/Config.in" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# <name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count> | ||
/bin/telegram-send-message f 755 0 0 - - - - - | ||
/etc/monit/monitrc f 700 0 0 - - - - - | ||
/root/id_ed25519_github f 600 0 0 - - - - - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh | ||
|
||
[ -f /etc/default/telegram ] && . /etc/default/telegram | ||
|
||
if [ -z "$TOKEN" ] ; then | ||
echo "TOKEN is not set, please set it in /etc/default/telegram" >&2 | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$CHAT_ID" ] ; then | ||
echo "CHAT_ID is not set, please set it in /etc/default/telegram" >&2 | ||
exit 1 | ||
fi | ||
|
||
SEND_MESSAGE="https://api.telegram.org/bot$TOKEN/sendMessage" | ||
|
||
if [ $# -lt 2 ] ; then | ||
echo "Usage: $0 -s <text>" | ||
exit 1 | ||
fi | ||
|
||
case $1 in | ||
-s) | ||
curl -s -X POST "$SEND_MESSAGE" -d parse_mode=Markdown -d chat_id="$CHAT_ID" -d text="$2" > /dev/null 2>&1 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Bot token | ||
TOKEN="" | ||
|
||
# User chat id | ||
CHAT_ID="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
check process avahi with pidfile /var/run/avahi-daemon/pid | ||
group avahi | ||
|
||
start program = "/bin/systemctl start avahi-daemon.service" with timeout 60 seconds | ||
stop program = "/bin/systemctl stop avahi-daemon.service" | ||
|
||
if failed host 0.0.0.0 port 5353 type udp then exec "/bin/telegram-send-message -s '*[unipi]* Avahi unavailable'" | ||
if 5 restarts within 5 cycles then timeout |
8 changes: 8 additions & 0 deletions
8
board/common/rootfs_overlay/etc/monit/conf-available/mosquitto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
check program mosquitto.service with path "/bin/systemctl --quiet is-active mosquitto" | ||
group unipi | ||
|
||
start program = "/bin/systemctl start mosquitto.service" with timeout 60 seconds | ||
stop program = "/bin/systemctl stop mosquitto.service" | ||
|
||
if status != 0 then exec "/bin/telegram-send-message -s '*[unipi]* Mosquitto unavailable!'" | ||
if 5 restarts within 5 cycles then timeout |
9 changes: 9 additions & 0 deletions
9
board/common/rootfs_overlay/etc/monit/conf-available/openssh-server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
check process sshd with pidfile /var/run/sshd.pid | ||
group system | ||
group sshd | ||
|
||
start program = "/bin/systemctl start ssh" with timeout 60 seconds | ||
stop program = "/bin/systemctl start ssh" | ||
|
||
if failed host 0.0.0.0 port 22 with protocol ssh then exec "/bin/telegram-send-message -s '*[unipi]* OpenSSH unavailable'" | ||
if 5 restarts with 5 cycles then timeout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
check program owhttpd.service with path "/bin/systemctl --quiet is-active owhttpd.service" | ||
group unipi | ||
|
||
start program = "/bin/systemctl start owhttpd.service" with timeout 60 seconds | ||
stop program = "/bin/systemctl stop owhttpd.service" | ||
|
||
if status != 0 then exec "/bin/telegram-send-message -s '*[unipi]* 1-Wire Webserver unavailable!'" | ||
if 5 restarts within 5 cycles then timeout | ||
|
||
check program owserver.service with path "/bin/systemctl --quiet is-active owserver.service" | ||
group unipi | ||
|
||
start program = "/bin/systemctl start owserver.service" with timeout 60 seconds | ||
stop program = "/bin/systemctl stop owserver.service" | ||
|
||
if status != 0 then exec "/bin/telegram-send-message -s '*[unipi]* 1-Wire Backend Server unavailable!'" | ||
if 5 restarts within 5 cycles then timeout | ||
|
||
check program owfs.service with path "/bin/systemctl --quiet is-active owfs.service" | ||
group unipi | ||
|
||
start program = "/bin/systemctl start owfs.service" with timeout 60 seconds | ||
stop program = "/bin/systemctl stop owfs.service" | ||
|
||
if status != 0 then exec "/bin/telegram-send-message -s '*[unipi]* 1-Wire Filesystem unavailable!'" | ||
if 5 restarts within 5 cycles then timeout |
19 changes: 19 additions & 0 deletions
19
board/common/rootfs_overlay/etc/monit/conf-available/system
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
check system $HOST | ||
if loadavg (5min) > 3 then exec "/bin/telegram-send-message -s '*[unipi]* Load 5min greater then 3'" | ||
if loadavg (15min) > 3 then exec "/bin/telegram-send-messag -s '*[unipi]* Load 15min greater then 3'" | ||
if memory usage > 80% for 4 cycles then exec "/bin/telegram-send-messag -s '*[unipi]* Memory usage greater then 80 %'" | ||
if swap usage > 20% for 4 cycles then exec "/bin/telegram-send-message -s '*[unipi]* Swap usage greater then 20 %'" | ||
|
||
# Test the user part of CPU usage | ||
if cpu usage (user) > 95% for 2 cycles then exec "/bin/telegram-send-message -s '*[unipi]* CPU (User) greater then 95 %'" | ||
|
||
# Test the system part of CPU usage | ||
if cpu usage (system) > 80% for 2 cycles then exec "/bin/telegram-send-message -s '*[unipi]* CPU (System) greater then 80 %'" | ||
|
||
# Test the i/o wait part of CPU usage | ||
if cpu usage (wait) > 80% for 2 cycles then exec "/bin/telegram-send-message -s '*[unipi]* CPU (Wait) greater then 80 %'" | ||
|
||
# Test CPU usage including user, system and wait. Note that | ||
# multi-core systems can generate 100 % per core | ||
# so total CPU usage can be more than 100 % | ||
if cpu usage > 200% for 4 cycles then exec "/bin/telegram-send-message -s '*[unipi]* CPU greater then 200 %'" |
8 changes: 8 additions & 0 deletions
8
board/common/rootfs_overlay/etc/monit/conf-available/systemd-timers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
check program om-telegram-alert.timer with path "/bin/systemctl --quiet is-active om-telegram-alert.timer" | ||
group timers | ||
|
||
start program = "/bin/systemctl start om-telegram-alert.timer" with timeout 60 seconds | ||
stop program = "/bin/systemctl stop om-telegram-alert.timer" | ||
|
||
if status != 0 then exec "/bin/telegram-send-message -s '*[unipi]* om-telegram-alert.timer unavailable!'" | ||
if 5 restarts within 5 cycles then timeout |
26 changes: 26 additions & 0 deletions
26
board/common/rootfs_overlay/etc/monit/conf-available/unipi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
check program unipitcp.service with path "/bin/systemctl --quiet is-active unipitcp.service" | ||
group unipi | ||
|
||
start program = "/bin/systemctl start unipitcp.service" with timeout 60 seconds | ||
stop program = "/bin/systemctl stop unipitcp.service" | ||
|
||
if status != 0 then exec "/bin/telegram-send-message -s '*[unipi]* Unipi TCP unavailable!'" | ||
if 5 restarts within 5 cycles then timeout | ||
|
||
check program unipicheck.service with path "/bin/systemctl --quiet is-active unipicheck.service" | ||
group unipi | ||
|
||
start program = "/bin/systemctl start unipicheck.service" with timeout 60 seconds | ||
stop program = "/bin/systemctl stop unipicheck.service" | ||
|
||
if status != 0 then exec "/bin/telegram-send-message -s '*[unipi]* Unipi Check unavailable!'" | ||
if 5 restarts within 5 cycles then timeout | ||
|
||
check program unipi-control.service with path "/bin/systemctl --quiet is-active unipi-control.service" | ||
group unipi | ||
|
||
start program = "/bin/systemctl start unipi-control.service" with timeout 60 seconds | ||
stop program = "/bin/systemctl stop unipi-control.service" | ||
|
||
if status != 0 then exec "/bin/telegram-send-message -s '*[unipi]* Unipi Control unavailable!'" | ||
if 5 restarts within 5 cycles then timeout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../conf-available/avahi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../conf-available/mosquitto |
1 change: 1 addition & 0 deletions
1
board/common/rootfs_overlay/etc/monit/conf-enabled/openssh-server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../conf-available/openssh-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../conf-available/owfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../conf-available/system |
1 change: 1 addition & 0 deletions
1
board/common/rootfs_overlay/etc/monit/conf-enabled/systemd-timers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../conf-available/systemd-timers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../conf-available/unipi |
Oops, something went wrong.