api.delete_monitor() does nothing #35

Closed
opened 2023-05-15 14:38:38 +02:00 by infinisean · 2 comments
infinisean commented 2023-05-15 14:38:38 +02:00 (Migrated from github.com)

api.delete_monitor(id) reports {'msg': 'Deleted Successfully.'} with valid (or invalid) ID, but does nothing.
(add_monitor works fine, so it is not an issue with the installation, kuma instance, login creds, etc.)

Kuma 1.21.3
API 0.13.0
Python 3.8.13

myuser@MyServer:/home/MyPath/kuma# ./kapi-add.py
{'msg': 'Added Successfully.', 'monitorID': 13}

myuser@MyServer:/home/MyPath/kuma# ./kapi-get.py 13
{'id': 13, 'name': 'newmonitor', 'description': None, 'url': 'HTTPS://newmon.domain.com', 'method': 'GET', .......

myuser@MyServer:/home/MyPath/kuma# ./kapi-del.py 13
{'msg': 'Deleted Successfully.'}
myuser@MyServer:/home/MyPath/kuma# ./kapi-del.py 13
{'msg': 'Deleted Successfully.'}
myuser@MyServer:/home/MyPath/kuma# ./kapi-del.py 13
{'msg': 'Deleted Successfully.'}
myuser@MyServer:/home/MyPath/kuma# ./kapi-del.py 13345345345314531453145134531245
{'msg': 'Deleted Successfully.'}

myuser@MyServer:/home/MyPath/kuma# ./kapi-get.py 13
{'id': 13, 'name': 'newmonitor', 'description': None, 'url': 'HTTPS://newmon.domain.com', 'method': 'GET', ............

api.delete_monitor(id) reports {'msg': 'Deleted Successfully.'} with valid (or invalid) ID, but does nothing. (add_monitor works fine, so it is not an issue with the installation, kuma instance, login creds, etc.) Kuma 1.21.3 API 0.13.0 Python 3.8.13 myuser@MyServer:/home/MyPath/kuma# ./kapi-add.py {'msg': 'Added Successfully.', 'monitorID': 13} myuser@MyServer:/home/MyPath/kuma# ./kapi-get.py 13 {'id': 13, 'name': 'newmonitor', 'description': None, 'url': 'HTTPS://newmon.domain.com', 'method': 'GET', ....... myuser@MyServer:/home/MyPath/kuma# ./kapi-del.py 13 {'msg': 'Deleted Successfully.'} myuser@MyServer:/home/MyPath/kuma# ./kapi-del.py 13 {'msg': 'Deleted Successfully.'} myuser@MyServer:/home/MyPath/kuma# ./kapi-del.py 13 {'msg': 'Deleted Successfully.'} myuser@MyServer:/home/MyPath/kuma# ./kapi-del.py 13345345345314531453145134531245 {'msg': 'Deleted Successfully.'} myuser@MyServer:/home/MyPath/kuma# ./kapi-get.py 13 {'id': 13, 'name': 'newmonitor', 'description': None, 'url': 'HTTPS://newmon.domain.com', 'method': 'GET', ............
lucasheld commented 2023-05-19 13:04:33 +02:00 (Migrated from github.com)

That is strange. I can reproduce the behavior. But the problem cannot be caused by this Python module. The code for deleting a monitor is the same as for deleting a proxy. When deleting a non-existing proxy, Uptime Kuma sends an error message and for monitors it does not.

I should probably check if the item even exists before deleting it and not rely on the error message from Uptime Kuma.

Edit:
To be clear: The deletion itself works. Just the return value is not correct.

That is strange. I can reproduce the behavior. But the problem cannot be caused by this Python module. The code for deleting a monitor is the same as for deleting a proxy. When deleting a non-existing proxy, Uptime Kuma sends an error message and for monitors it does not. I should probably check if the item even exists before deleting it and not rely on the error message from Uptime Kuma. Edit: To be clear: The deletion itself works. Just the return value is not correct.
lucasheld commented 2023-05-26 11:49:18 +02:00 (Migrated from github.com)

It's included in release 1.0.1

It's included in release 1.0.1
Sign in to join this conversation.
No description provided.