-
Notifications
You must be signed in to change notification settings - Fork 0
Configuring
The default path for ntfy-resources-usage configuration file is located in /usr/bin/ntfy-resources-usage.
If it does not exist there, try to reinstall ntfy-resources-usage or create a new config file manually with the parameters below.
Ultimately, you can also try to edit the script itself, which path is by default /usr/bin/ntfy-resources-usage. If not there, you can also locate it by executing whereis ntfy-resources-usage.
Note that editing the script is not recommended and /etc/ntfy-resources-usage/ntfy-resources-usage.conf will overwrite the parameters.
Editing requires root access, which can be achieved by appending sudo or doas at the start of the editing command or logging as root.
DEVICE_NAME is a variable containing the name of your computer which will be sent in the title of the notification. By default, it contains the hostname of your device using the hostname command, $(hostname).
DEVICE_NAME="DEVICE"NTFY_TOPIC is a variable containing the URI to the ntfy server. By default it comes with the official ntfy.sh server domain, but with no topic. Putting a topic is required to send notifications. See how to create a topic in the usage page.
NTFY_TOPIC="ntfy.sh/notification_topic"NTFY_AUTH_FILE is a variable containing the auth file path. This file should have just a username and a password in the username:password form. Notice the colon that separates the username and the password. It's very important to note that you should never put a colon in the username, or else everything after the colon will be treated as the password.
It's also very recommended to set the permissions of this file to be only read by the root user (600), otherwise you might risk exposing your credentials to other users.
By default it comes commented. If you need/want use user authentication for ntfy, remove the '#' character, create a new file with 600 permissions for root, type the username and password in the username:password form and set the path of the new auth file in NTFY_AUTH_FILE.
NTFY_AUTH_FILE="/etc/ntfy-resources-usage/auth"NTFY_PRIORITY is a variable containing the priority level the notifications will be sent. The user can set the app to not get disturbed at a sepecific priority. A lower priority may not distrub the user while a higher level will do.
Levels:
| CODENAME | min |
low |
default |
high |
urgent/max
|
|---|---|---|---|---|---|
| DETAIL | Lowest | Low | Medium | High | Highest |
Lowest level is min and highest is urgent or max.
NTFY_PRIORITY="low"DELAY_TIME is a variable containing the delay time between resources checks. A higher value means a higher wait time between checks and if too high, the plugin may not report at a convenient time. A lower time means a lower wait time between checks and if too low, the plugin may report too much notifications, leading to ping spam and server abuse.
The time is calculated in seconds, but with the power of math, typing only the minutes can be easily approached.
Either your choice, don't forget to comment and uncomment the necessary variables or else you may end up rewriting unwanted values to the variables. Comments are lines starting with '#'. Removing the '#' is considered uncommenting.
=======
DELAY_TIME="$((5 * 60))" # for minutes
## minutes----^ ^---1 minute in seconds #
## 5 times 60 equals 300
#DELAY_TIME="300" # use only seconds
## seconds-^ #DEBUG is a variable containing a true/false boolean for whether to print debug info or not.
By default it comes commented. If you want to print debug info, uncomment by removing the '#' before 'DEBUG'
DEBUG="true"CHECK_RAM is a boolean variable defining whether or not to check for remaining free memory. You can set this to either true or false.
By default this variable is set to true.
CHECK_RAM="true"CHECK_DISK is a boolean variable defining whether or not to check for remaining disk space. You can set this to either true or false.
By default this variable is set to true.
CHECK_DISK="true"CHECK_BATTERY is a boolean variable defining whether or not to check for remaining battery capacity. You can set this to either true or false.
By default this variable is set to false.
CHECK_DISK="false"RAM_TITLE is a variable containing the title ntfy-resources-usage should send to ntfy.sh when running out of memory. By default, it contains the name of the device and a "Running out of memory" message.
RAM_TITLE="$DEVICE_NAME: Running out of memory"DISK_TITLE is a variable containing the title ntfy-resources-usage should send to ntfy.sh when running out of storage. By default, it contains the name of the device and a "Running out of memory" message.
DISK_TITLE="$DEVICE_NAME: Running out of storage"BATTERY_TITLE is a variable containing the title ntfy-resources-usage should send to ntfy.sh when running out of battery. By default, it contains the name of the device and a "Running out of battery" message.
BATTERY_TITLE="$DEVICE_NAME: Running out of battery"RAM_MSG is a variable containing the message ntfy-resources-usage should send to ntfy.sh when running out of memory. By default, it contains the name of the device and a "is running out of memory: " which will be folowed by "[free memory] out of [total memory]"
RAM_MSG="$DEVICE_NAME is running out of memory: "DISK_MSG is a variable containing the message ntfy-resources-usage should send to ntfy.sh when running out of storage. By default, it contains the name of the device and a "is running out of storage: " which will be folowed by "[free storage] out of [total storage]"
DISK_MSG="$DEVICE_NAME is running out of storage: "BATTERY_MSG is a variable containing the message ntfy-resources-usage should send to ntfy.sh when running out of battery. By default, it contains the name of the device and a "is running out of battery: " which will be folowed by "[battery percentage]%"
BATTERY_MSG="$DEVICE_NAME: Running out of battery: "MIN_RAM_RATIO is a variable containing the minimum ratio of free memory out of total memory ntfy-resources-usage needs to send a notification. When the ratio ntfy-resources-usage calculated is lower then MIN_RAM_RATIO, ntfy-resources-usage will send a warning.
The ratio value can be set between 1 and 100.
MIN_RAM_RATIO="20"MIN_DISK_RATIO is a variable containing the minimum ratio of free storage out of total storage ntfy-resources-usage needs to send a notification. When the ratio ntfy-resources-usage calculated is lower then MIN_DISK_RATIO, ntfy-resources-usage will send a warning.
The ratio value can be set between 1 and 100.
MIN_DISK_RATIO="20"MIN_BATTERY_RATIO is a variable containing the minimum percentage of remaining battery capacity ntfy-resources-usage needs to send a notification. When the percentage is lower then MIN_BATTERY_RATIO, ntfy-resources-usage will send a warning.
The ratio value can be set between 1 and 100.
MIN_BATTERY_RATIO="20"For details on how to use ntfy-resources-usage, see the usage wiki page.