mirror of
https://github.com/unixtensor/proxmox-ntfy.git
synced 2025-06-28 08:28:05 +00:00
--cpu-temp-disabled
flag
This commit is contained in:
11
src/cli.py
11
src/cli.py
@ -6,14 +6,17 @@ from typing import Optional
|
|||||||
_ntfy_configure_prompt = """\033[4mPlease configure an ntfy url before starting.\033[0m
|
_ntfy_configure_prompt = """\033[4mPlease configure an ntfy url before starting.\033[0m
|
||||||
Examples:
|
Examples:
|
||||||
\033[32mpython3 main.py 10.0.13.37:42069
|
\033[32mpython3 main.py 10.0.13.37:42069
|
||||||
python3 main.py ntfy.domain.com\033[0m"""
|
python3 main.py ntfy.domain.com\033[0m
|
||||||
|
|
||||||
|
Use \033[32m-h\033[0m or \033[32m--help\033[0m for a full list of options."""
|
||||||
|
|
||||||
class Interface:
|
class Interface:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.parser = argparse.ArgumentParser()
|
self.parser = argparse.ArgumentParser()
|
||||||
self.parser.add_argument("--cpu-temp-critical", type=int, default=80, help="cpu tempature crtitical. default = 80")
|
self.parser.add_argument("--cpu-temp-disabled", action="store_true", help="Disable notifications for CPU tempature.")
|
||||||
self.parser.add_argument("--cpu-temp-warning", type=int, default=70, help="cpu tempature warning. default = 70")
|
self.parser.add_argument("--cpu-temp-critical", type=int, default=80, help="CPU tempature for the crtitical alert. default = 80")
|
||||||
self.parser.add_argument("--update-rate", type=int, default=1, help="how often updates happen in seconds. default = 1")
|
self.parser.add_argument("--cpu-temp-warning", type=int, default=70, help="CPU tempature for the warning alert. default = 70")
|
||||||
|
self.parser.add_argument("--update-rate", type=int, default=1, help="How often updates happen in seconds. default = 1")
|
||||||
|
|
||||||
def parsed_args(self):
|
def parsed_args(self):
|
||||||
return self.parser.parse_args()
|
return self.parser.parse_args()
|
||||||
|
@ -7,6 +7,7 @@ import cpu
|
|||||||
from ntfy import Ntfy
|
from ntfy import Ntfy
|
||||||
|
|
||||||
def start(
|
def start(
|
||||||
|
cpu_temp_checking: bool,
|
||||||
cpu_critical_temp: int,
|
cpu_critical_temp: int,
|
||||||
cpu_warning_temp: int,
|
cpu_warning_temp: int,
|
||||||
ntfy_server: str,
|
ntfy_server: str,
|
||||||
@ -19,16 +20,18 @@ def start(
|
|||||||
print("Ntfy monitoring software is now listening.")
|
print("Ntfy monitoring software is now listening.")
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
if not cpu_temp_checking:
|
||||||
ntfy_cpu_temp_monitor.ntfy_check()
|
ntfy_cpu_temp_monitor.ntfy_check()
|
||||||
time.sleep(interval)
|
time.sleep(interval)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if package.installed("lm-sensors"):
|
if package.installed("lm-sensors"):
|
||||||
cli_args = cli.Interface()
|
cli_args = cli.Interface()
|
||||||
parsed = cli_args.parsed_args()
|
|
||||||
ntfy_server = cli_args.argv_1()
|
ntfy_server = cli_args.argv_1()
|
||||||
|
parsed = cli_args.parsed_args()
|
||||||
if ntfy_server:
|
if ntfy_server:
|
||||||
start(
|
start(
|
||||||
|
parsed.cpu_temp_checking,
|
||||||
parsed.cpu_temp_critical,
|
parsed.cpu_temp_critical,
|
||||||
parsed.cpu_temp_warning,
|
parsed.cpu_temp_warning,
|
||||||
ntfy_server,
|
ntfy_server,
|
||||||
|
Reference in New Issue
Block a user