push-status: More fixes
This commit is contained in:
parent
5421e3bd99
commit
8bd80a8a34
3 changed files with 8 additions and 7 deletions
|
@ -54,7 +54,4 @@ def get_systemd(url, username, password, host, unit) -> Optional[dict]:
|
|||
if unit != u or host != h:
|
||||
continue
|
||||
|
||||
return UnitMonitor(
|
||||
name=monitor.get('name'),
|
||||
token=monitor.get('pushToken'),
|
||||
)
|
||||
monitor
|
||||
|
|
|
@ -33,6 +33,7 @@ def main():
|
|||
default_host = socket.getfqdn()
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--clear-cache', '-c', action='store_true', help='Clear cache')
|
||||
parser.add_argument('--username', '-u', type=str, required=True)
|
||||
|
||||
password = parser.add_mutually_exclusive_group(required=True)
|
||||
|
@ -44,6 +45,9 @@ def main():
|
|||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.clear_cache:
|
||||
monitors.cache.clear()
|
||||
|
||||
if args.password_file is not None:
|
||||
with open(args.password_file) as f:
|
||||
password = f.readline().strip()
|
||||
|
@ -76,9 +80,9 @@ def main():
|
|||
logging.error("No monitor found for: %s/%s", host, unit)
|
||||
sys.exit(1)
|
||||
|
||||
logging.info("Monitor: %s", monitor.name)
|
||||
logging.info("Monitor: %s", monitor.get('name'))
|
||||
|
||||
push(args.url, monitor.token, state, msg, duration*1e3)
|
||||
push(args.url, monitor.get('pushToken'), state, msg, duration*1e3)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "push-status"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
description = "Push status of systemd units to Uptime-Kuma"
|
||||
authors = ["Steffen Vogel <post@steffenvogel.de>"]
|
||||
license = "Apache-2.0"
|
||||
|
|
Loading…
Add table
Reference in a new issue