feat: add support for uptime kuma 1.23.0 and 1.23.1
This commit is contained in:
parent
0d49e97fe5
commit
7902213ddb
15 changed files with 534 additions and 171 deletions
|
@ -5,7 +5,7 @@ if [ $version ]
|
||||||
then
|
then
|
||||||
versions=("$version")
|
versions=("$version")
|
||||||
else
|
else
|
||||||
versions=(1.22.1 1.22.0 1.21.3)
|
versions=(1.23.1 1.23.0 1.22.1 1.22.0 1.21.3)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for version in ${versions[*]}
|
for version in ${versions[*]}
|
||||||
|
@ -23,6 +23,7 @@ do
|
||||||
|
|
||||||
echo "Stopping uptime kuma..."
|
echo "Stopping uptime kuma..."
|
||||||
docker stop uptimekuma > /dev/null
|
docker stop uptimekuma > /dev/null
|
||||||
|
sleep 1
|
||||||
|
|
||||||
echo ''
|
echo ''
|
||||||
done
|
done
|
||||||
|
|
|
@ -1,37 +1,57 @@
|
||||||
import glob
|
import glob
|
||||||
import re
|
import re
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
from utils import deduplicate_list, parse_vue_template
|
from utils import deduplicate_list, parse_vue_template, diff, type_html_to_py
|
||||||
|
|
||||||
|
|
||||||
ROOT = "uptime-kuma"
|
input_ignores = {
|
||||||
|
"settings": [
|
||||||
|
"$root.styleElapsedTime"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def parse_model_keys(content, object_name):
|
def parse_model_keys(content, object_name):
|
||||||
match = re.findall(object_name + r"\.[0-9a-zA-Z_$]+", content)
|
soup = BeautifulSoup(content, "html.parser")
|
||||||
keys = []
|
|
||||||
for m in match:
|
soup_inputs = soup.find_all(attrs={"v-model": True})
|
||||||
key = m.replace(object_name + ".", "")
|
inputs = []
|
||||||
keys.append(key)
|
for soup_input in soup_inputs:
|
||||||
keys = deduplicate_list(keys)
|
key = soup_input["v-model"]
|
||||||
return keys
|
if key in input_ignores.get(object_name, []):
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
key = re.sub(r'^' + object_name + r'\.', "", key)
|
||||||
|
type_ = soup_input.get("type", "text")
|
||||||
|
type_ = type_html_to_py(type_)
|
||||||
|
if type_ == "bool":
|
||||||
|
value = True if soup_input.get("checked") else False
|
||||||
|
else:
|
||||||
|
value = soup_input.get("value")
|
||||||
|
inputs.append({
|
||||||
|
"key": key,
|
||||||
|
"type": type_,
|
||||||
|
"default": value,
|
||||||
|
})
|
||||||
|
return inputs
|
||||||
|
|
||||||
|
|
||||||
def parse_proxy_keys():
|
def parse_proxy_keys(root):
|
||||||
content = parse_vue_template(f"{ROOT}/src/components/ProxyDialog.vue")
|
content = parse_vue_template(f"{root}/src/components/ProxyDialog.vue")
|
||||||
keys = parse_model_keys(content, "proxy")
|
keys = parse_model_keys(content, "proxy")
|
||||||
return keys
|
return keys
|
||||||
|
|
||||||
|
|
||||||
def parse_notification_keys():
|
def parse_notification_keys(root):
|
||||||
content = parse_vue_template(f"{ROOT}/src/components/NotificationDialog.vue")
|
content = parse_vue_template(f"{root}/src/components/NotificationDialog.vue")
|
||||||
keys = parse_model_keys(content, "notification")
|
keys = parse_model_keys(content, "notification")
|
||||||
return keys
|
return keys
|
||||||
|
|
||||||
|
|
||||||
def parse_settings_keys():
|
def parse_settings_keys(root):
|
||||||
all_keys = []
|
all_keys = []
|
||||||
for path in glob.glob('uptime-kuma/src/components/settings/*'):
|
for path in glob.glob(f'{root}/src/components/settings/*'):
|
||||||
content = parse_vue_template(path)
|
content = parse_vue_template(path)
|
||||||
keys = parse_model_keys(content, "settings")
|
keys = parse_model_keys(content, "settings")
|
||||||
all_keys.extend(keys)
|
all_keys.extend(keys)
|
||||||
|
@ -39,20 +59,20 @@ def parse_settings_keys():
|
||||||
return all_keys
|
return all_keys
|
||||||
|
|
||||||
|
|
||||||
def parse_monitor_keys():
|
def parse_monitor_keys(root):
|
||||||
content = parse_vue_template(f"{ROOT}/src/pages/EditMonitor.vue")
|
content = parse_vue_template(f"{root}/src/pages/EditMonitor.vue")
|
||||||
keys = parse_model_keys(content, "monitor")
|
keys = parse_model_keys(content, "monitor")
|
||||||
return keys
|
return keys
|
||||||
|
|
||||||
|
|
||||||
def parse_status_page_keys():
|
def parse_status_page_keys(root):
|
||||||
all_keys = ["id"]
|
all_keys = ["id"]
|
||||||
|
|
||||||
content = parse_vue_template(f"{ROOT}/src/pages/StatusPage.vue")
|
content = parse_vue_template(f"{root}/src/pages/StatusPage.vue")
|
||||||
keys = parse_model_keys(content, "config")
|
keys = parse_model_keys(content, "config")
|
||||||
all_keys.extend(keys)
|
all_keys.extend(keys)
|
||||||
|
|
||||||
content = parse_vue_template(f"{ROOT}/src/pages/ManageStatusPage.vue")
|
content = parse_vue_template(f"{root}/src/pages/ManageStatusPage.vue")
|
||||||
keys = parse_model_keys(content, "statusPage")
|
keys = parse_model_keys(content, "statusPage")
|
||||||
all_keys.extend(keys)
|
all_keys.extend(keys)
|
||||||
|
|
||||||
|
@ -60,30 +80,28 @@ def parse_status_page_keys():
|
||||||
return all_keys
|
return all_keys
|
||||||
|
|
||||||
|
|
||||||
def parse_maintenance_keys():
|
def parse_maintenance_keys(root):
|
||||||
content = parse_vue_template(f"{ROOT}/src/pages/EditMaintenance.vue")
|
content = parse_vue_template(f"{root}/src/pages/EditMaintenance.vue")
|
||||||
keys = parse_model_keys(content, "maintenance")
|
keys = parse_model_keys(content, "maintenance")
|
||||||
return keys
|
return keys
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
proxy_keys = parse_proxy_keys()
|
root_old = "uptime-kuma-old"
|
||||||
print("proxy:", proxy_keys)
|
root_new = "uptime-kuma"
|
||||||
|
|
||||||
notification_keys = parse_notification_keys()
|
for name, func in [
|
||||||
print("notification:", notification_keys)
|
["proxy", parse_proxy_keys],
|
||||||
|
["notification", parse_notification_keys],
|
||||||
settings_keys = parse_settings_keys()
|
["settings", parse_settings_keys],
|
||||||
print("settings:", settings_keys)
|
["monitor", parse_monitor_keys],
|
||||||
|
["status_page", parse_status_page_keys],
|
||||||
monitor_keys = parse_monitor_keys()
|
["maintenance", parse_maintenance_keys],
|
||||||
print("monitor:", monitor_keys)
|
]:
|
||||||
|
keys_old = func(root_old)
|
||||||
status_page_keys = parse_status_page_keys()
|
keys_new = func(root_new)
|
||||||
print("status_page:", status_page_keys)
|
print(f"{name}:")
|
||||||
|
diff(keys_old, keys_new)
|
||||||
maintenance_keys = parse_maintenance_keys()
|
|
||||||
print("maintenance:", maintenance_keys)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
import re
|
import re
|
||||||
from pprint import pprint
|
|
||||||
|
|
||||||
from utils import deduplicate_list
|
from utils import deduplicate_list, diff
|
||||||
|
|
||||||
|
|
||||||
ROOT = "uptime-kuma"
|
|
||||||
|
|
||||||
|
|
||||||
def parse_json_keys(data):
|
def parse_json_keys(data):
|
||||||
|
@ -22,17 +18,8 @@ def parse_json_keys(data):
|
||||||
return keys
|
return keys
|
||||||
|
|
||||||
|
|
||||||
# def parse_object_keys(code, object_name):
|
def parse_heartbeat(root):
|
||||||
# match = re.findall(object_name + r'\.[0-9a-zA-Z_$]+', code)
|
with open(f'{root}/server/model/heartbeat.js') as f:
|
||||||
# keys = []
|
|
||||||
# for m in match:
|
|
||||||
# key = m.replace(object_name + ".", "")
|
|
||||||
# keys.append(key)
|
|
||||||
# return list(set(keys))
|
|
||||||
|
|
||||||
|
|
||||||
def parse_heartbeat():
|
|
||||||
with open(f'{ROOT}/server/model/heartbeat.js') as f:
|
|
||||||
content = f.read()
|
content = f.read()
|
||||||
all_keys = []
|
all_keys = []
|
||||||
match = re.search(r'toJSON\(\) {\s+return.*{([^}]+)}', content)
|
match = re.search(r'toJSON\(\) {\s+return.*{([^}]+)}', content)
|
||||||
|
@ -47,8 +34,8 @@ def parse_heartbeat():
|
||||||
return all_keys
|
return all_keys
|
||||||
|
|
||||||
|
|
||||||
def parse_incident():
|
def parse_incident(root):
|
||||||
with open(f'{ROOT}/server/model/incident.js') as f:
|
with open(f'{root}/server/model/incident.js') as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
match = re.search(r'toPublicJSON\(\) {\s+return.*{([^}]+)}', content)
|
match = re.search(r'toPublicJSON\(\) {\s+return.*{([^}]+)}', content)
|
||||||
data = match.group(1)
|
data = match.group(1)
|
||||||
|
@ -56,9 +43,9 @@ def parse_incident():
|
||||||
return keys
|
return keys
|
||||||
|
|
||||||
|
|
||||||
def parse_monitor():
|
def parse_monitor(root):
|
||||||
# todo: toPublicJSON ???
|
# todo: toPublicJSON ???
|
||||||
with open(f'{ROOT}/server/model/monitor.js') as f:
|
with open(f'{root}/server/model/monitor.js') as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
matches = re.findall(r'data = {([^}]+)}', content)
|
matches = re.findall(r'data = {([^}]+)}', content)
|
||||||
all_keys = []
|
all_keys = []
|
||||||
|
@ -70,8 +57,8 @@ def parse_monitor():
|
||||||
return all_keys
|
return all_keys
|
||||||
|
|
||||||
|
|
||||||
def parse_proxy():
|
def parse_proxy(root):
|
||||||
with open(f'{ROOT}/server/model/proxy.js') as f:
|
with open(f'{root}/server/model/proxy.js') as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
match = re.search(r'toJSON\(\) {\s+return.*{([^}]+)}', content)
|
match = re.search(r'toJSON\(\) {\s+return.*{([^}]+)}', content)
|
||||||
data = match.group(1)
|
data = match.group(1)
|
||||||
|
@ -102,7 +89,7 @@ def parse_proxy():
|
||||||
|
|
||||||
# # input (add, edit proxy)
|
# # input (add, edit proxy)
|
||||||
# def parse_proxy2():
|
# def parse_proxy2():
|
||||||
# with open(f'{ROOT}/server/proxy.js') as f:
|
# with open(f'{root}/server/proxy.js') as f:
|
||||||
# content = f.read()
|
# content = f.read()
|
||||||
#
|
#
|
||||||
# code = parse_function(r'async save\([^)]+\) ', content)
|
# code = parse_function(r'async save\([^)]+\) ', content)
|
||||||
|
@ -110,8 +97,8 @@ def parse_proxy():
|
||||||
# return keys
|
# return keys
|
||||||
|
|
||||||
|
|
||||||
def parse_status_page():
|
def parse_status_page(root):
|
||||||
with open(f'{ROOT}/server/model/status_page.js') as f:
|
with open(f'{root}/server/model/status_page.js') as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
all_keys = []
|
all_keys = []
|
||||||
match = re.search(r'toJSON\(\) {\s+return.*{([^}]+)}', content)
|
match = re.search(r'toJSON\(\) {\s+return.*{([^}]+)}', content)
|
||||||
|
@ -126,8 +113,8 @@ def parse_status_page():
|
||||||
return all_keys
|
return all_keys
|
||||||
|
|
||||||
|
|
||||||
def parse_tag():
|
def parse_tag(root):
|
||||||
with open(f'{ROOT}/server/model/tag.js') as f:
|
with open(f'{root}/server/model/tag.js') as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
match = re.search(r'toJSON\(\) {\s+return.*{([^}]+)}', content)
|
match = re.search(r'toJSON\(\) {\s+return.*{([^}]+)}', content)
|
||||||
data = match.group(1)
|
data = match.group(1)
|
||||||
|
@ -135,33 +122,22 @@ def parse_tag():
|
||||||
return keys
|
return keys
|
||||||
|
|
||||||
|
|
||||||
print("heartbeat")
|
if __name__ == "__main__":
|
||||||
pprint(parse_heartbeat())
|
root_old = "uptime-kuma-old"
|
||||||
print("")
|
root_new = "uptime-kuma"
|
||||||
|
|
||||||
print("incident")
|
for name, func in [
|
||||||
pprint(parse_incident())
|
["heartbeat", parse_heartbeat],
|
||||||
print("")
|
["incident", parse_incident],
|
||||||
|
["monitor", parse_monitor],
|
||||||
print("monitor")
|
["proxy", parse_proxy],
|
||||||
pprint(parse_monitor())
|
["status page", parse_status_page],
|
||||||
print("")
|
["tag", parse_tag],
|
||||||
|
]:
|
||||||
print("proxy")
|
keys_old = func(root_old)
|
||||||
pprint(parse_proxy())
|
keys_new = func(root_new)
|
||||||
print("")
|
print(f"{name}:")
|
||||||
|
diff(keys_old, keys_new)
|
||||||
# print("prox2")
|
|
||||||
# pprint(parse_proxy2())
|
|
||||||
# print("")
|
|
||||||
|
|
||||||
print("status page")
|
|
||||||
pprint(parse_status_page())
|
|
||||||
print("")
|
|
||||||
|
|
||||||
print("tag")
|
|
||||||
pprint(parse_tag())
|
|
||||||
print("")
|
|
||||||
|
|
||||||
|
|
||||||
# TODO:
|
# TODO:
|
||||||
|
|
|
@ -3,6 +3,32 @@ from bs4 import BeautifulSoup
|
||||||
from utils import parse_vue_template, write_to_file
|
from utils import parse_vue_template, write_to_file
|
||||||
|
|
||||||
|
|
||||||
|
titles = {
|
||||||
|
"http": "HTTP(s)",
|
||||||
|
"port": "TCP Port",
|
||||||
|
"ping": "Ping",
|
||||||
|
"keyword": "HTTP(s) - Keyword",
|
||||||
|
"grpc-keyword": "gRPC(s) - Keyword",
|
||||||
|
"dns": "DNS",
|
||||||
|
"docker": "Docker Container",
|
||||||
|
"push": "Push",
|
||||||
|
"steam": "Steam Game Server",
|
||||||
|
"gamedig": "GameDig",
|
||||||
|
"mqtt": "MQTT",
|
||||||
|
"sqlserver": "Microsoft SQL Server",
|
||||||
|
"postgres": "PostgreSQL",
|
||||||
|
"mysql": "MySQL/MariaDB",
|
||||||
|
"mongodb": "MongoDB",
|
||||||
|
"radius": "Radius",
|
||||||
|
"redis": "Redis",
|
||||||
|
"group": "Group",
|
||||||
|
"json-query": "HTTP(s) - Json Query",
|
||||||
|
"real-browser": "HTTP(s) - Browser Engine (Chrome/Chromium)",
|
||||||
|
"kafka-producer": "Kafka Producer",
|
||||||
|
"tailscale-ping": "Tailscale Ping"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def parse_monitor_types():
|
def parse_monitor_types():
|
||||||
content = parse_vue_template("uptime-kuma/src/pages/EditMonitor.vue")
|
content = parse_vue_template("uptime-kuma/src/pages/EditMonitor.vue")
|
||||||
|
|
||||||
|
@ -10,10 +36,13 @@ def parse_monitor_types():
|
||||||
select = soup.find("select", id="type")
|
select = soup.find("select", id="type")
|
||||||
options = select.find_all("option")
|
options = select.find_all("option")
|
||||||
|
|
||||||
types = []
|
types = {}
|
||||||
for o in options:
|
for o in options:
|
||||||
type_ = o.attrs["value"]
|
type_ = o.attrs["value"]
|
||||||
types.append(type_)
|
types[type_] = {
|
||||||
|
"value": type_,
|
||||||
|
"title": titles[type_]
|
||||||
|
}
|
||||||
return types
|
return types
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import re
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
from utils import deduplicate_list, write_to_file
|
from utils import deduplicate_list, write_to_file, type_html_to_py
|
||||||
|
|
||||||
|
|
||||||
# deprecated or wrong inputs
|
# deprecated or wrong inputs
|
||||||
|
@ -26,6 +26,10 @@ ignored_inputs = {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input_overwrites = {
|
||||||
|
"showAdditionalHeadersField": "webhookAdditionalHeaders"
|
||||||
|
}
|
||||||
|
|
||||||
titles = {
|
titles = {
|
||||||
"alerta": "Alerta",
|
"alerta": "Alerta",
|
||||||
"AlertNow": "AlertNow",
|
"AlertNow": "AlertNow",
|
||||||
|
@ -48,6 +52,7 @@ titles = {
|
||||||
"OneBot": "OneBot",
|
"OneBot": "OneBot",
|
||||||
"Opsgenie": "Opsgenie",
|
"Opsgenie": "Opsgenie",
|
||||||
"PagerDuty": "PagerDuty",
|
"PagerDuty": "PagerDuty",
|
||||||
|
"PagerTree": "PagerTree",
|
||||||
"pushbullet": "Pushbullet",
|
"pushbullet": "Pushbullet",
|
||||||
"PushByTechulus": "Push by Techulus",
|
"PushByTechulus": "Push by Techulus",
|
||||||
"pushover": "Pushover",
|
"pushover": "Pushover",
|
||||||
|
@ -76,10 +81,14 @@ titles = {
|
||||||
"SMSManager": "SmsManager (smsmanager.cz)",
|
"SMSManager": "SmsManager (smsmanager.cz)",
|
||||||
"WeCom": "WeCom",
|
"WeCom": "WeCom",
|
||||||
"ServerChan": "ServerChan",
|
"ServerChan": "ServerChan",
|
||||||
|
"nostr": "Nostr",
|
||||||
|
"FlashDuty": "FlashDuty",
|
||||||
|
"smsc": "SMSC",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def build_notification_providers(root):
|
def build_notification_providers():
|
||||||
|
root = "uptime-kuma"
|
||||||
providers = {}
|
providers = {}
|
||||||
|
|
||||||
# get providers and input names
|
# get providers and input names
|
||||||
|
@ -96,7 +105,7 @@ def build_notification_providers(root):
|
||||||
inputs = [i.strip() for i in inputs]
|
inputs = [i.strip() for i in inputs]
|
||||||
|
|
||||||
providers[name] = {
|
providers[name] = {
|
||||||
"title": titles.get(name, name),
|
"title": titles[name],
|
||||||
"inputs": {},
|
"inputs": {},
|
||||||
}
|
}
|
||||||
for input_ in inputs:
|
for input_ in inputs:
|
||||||
|
@ -117,15 +126,15 @@ def build_notification_providers(root):
|
||||||
conditions = {}
|
conditions = {}
|
||||||
attrs = input_.attrs
|
attrs = input_.attrs
|
||||||
v_model = attrs.get("v-model")
|
v_model = attrs.get("v-model")
|
||||||
|
|
||||||
|
v_model_overwrite = input_overwrites.get(v_model)
|
||||||
|
if v_model_overwrite:
|
||||||
|
param_name = v_model_overwrite
|
||||||
|
else:
|
||||||
param_name = re.match(r'\$parent.notification.(.*)$', v_model).group(1)
|
param_name = re.match(r'\$parent.notification.(.*)$', v_model).group(1)
|
||||||
|
|
||||||
type_ = attrs.get("type")
|
type_ = attrs.get("type")
|
||||||
if type_ == "number":
|
type_ = type_html_to_py(type_)
|
||||||
type_ = "int"
|
|
||||||
elif type_ == "checkbox":
|
|
||||||
type_ = "bool"
|
|
||||||
else:
|
|
||||||
type_ = "str"
|
|
||||||
|
|
||||||
required_true_values = ['', 'true']
|
required_true_values = ['', 'true']
|
||||||
if attrs.get("required") in required_true_values or attrs.get(":required") in required_true_values:
|
if attrs.get("required") in required_true_values or attrs.get(":required") in required_true_values:
|
||||||
|
@ -157,17 +166,7 @@ def build_notification_providers(root):
|
||||||
return providers
|
return providers
|
||||||
|
|
||||||
|
|
||||||
def diff(old, new):
|
notification_providers = build_notification_providers()
|
||||||
for i in new:
|
|
||||||
if i not in old:
|
|
||||||
print("+", i)
|
|
||||||
for i in old:
|
|
||||||
if i not in new:
|
|
||||||
print("-", i)
|
|
||||||
print("")
|
|
||||||
|
|
||||||
|
|
||||||
notification_providers = build_notification_providers("uptime-kuma")
|
|
||||||
|
|
||||||
notification_provider_conditions = {}
|
notification_provider_conditions = {}
|
||||||
for notification_provider in notification_providers:
|
for notification_provider in notification_providers:
|
||||||
|
@ -181,11 +180,3 @@ write_to_file(
|
||||||
notification_providers=notification_providers,
|
notification_providers=notification_providers,
|
||||||
notification_provider_conditions=notification_provider_conditions
|
notification_provider_conditions=notification_provider_conditions
|
||||||
)
|
)
|
||||||
|
|
||||||
# notification_providers_old = build_notification_providers("uptime-kuma-old")
|
|
||||||
# notification_providers_new = build_notification_providers("uptime-kuma")
|
|
||||||
# diff(notification_providers_old, notification_providers_new)
|
|
||||||
#
|
|
||||||
# notification_provider_conditions_old = build_notification_provider_conditions("uptime-kuma-old")
|
|
||||||
# notification_provider_conditions_new = build_notification_provider_conditions("uptime-kuma")
|
|
||||||
# diff(notification_provider_conditions_old, notification_provider_conditions_new)
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
notification = [
|
|
||||||
"type",
|
|
||||||
"isDefault",
|
|
||||||
"userId",
|
|
||||||
"applyExisting",
|
|
||||||
]
|
|
|
@ -2,7 +2,10 @@ from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
class MonitorType(str, Enum):
|
class MonitorType(str, Enum):
|
||||||
{%- for name in monitor_types %}
|
"""Enumerate monitor types."""
|
||||||
{{ name.upper() }} = "{{ name }}"
|
{{""}}
|
||||||
{%- endfor %}
|
{%- for type_ in monitor_types.values() %}
|
||||||
|
{{ type_["value"].upper().replace("-", "_") }} = "{{ type_["value"] }}"
|
||||||
|
"""{{ type_["title"] }}"""
|
||||||
|
{% endfor -%}
|
||||||
|
|
||||||
|
|
|
@ -24,3 +24,23 @@ def write_to_file(template, destination, **kwargs):
|
||||||
rendered = template.render(**kwargs)
|
rendered = template.render(**kwargs)
|
||||||
with open(destination, "w") as f:
|
with open(destination, "w") as f:
|
||||||
f.write(rendered)
|
f.write(rendered)
|
||||||
|
|
||||||
|
|
||||||
|
def diff(old, new):
|
||||||
|
for i in new:
|
||||||
|
if i not in old:
|
||||||
|
print("+", i)
|
||||||
|
for i in old:
|
||||||
|
if i not in new:
|
||||||
|
print("-", i)
|
||||||
|
print("")
|
||||||
|
|
||||||
|
|
||||||
|
def type_html_to_py(type_):
|
||||||
|
if type_ == "number":
|
||||||
|
type_ = "int"
|
||||||
|
elif type_ == "checkbox":
|
||||||
|
type_ = "bool"
|
||||||
|
else:
|
||||||
|
type_ = "str"
|
||||||
|
return type_
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import unittest
|
import unittest
|
||||||
|
from packaging.version import parse as parse_version
|
||||||
|
|
||||||
from uptime_kuma_api import DockerType, UptimeKumaException
|
from uptime_kuma_api import DockerType, UptimeKumaException
|
||||||
from uptime_kuma_test_case import UptimeKumaTestCase
|
from uptime_kuma_test_case import UptimeKumaTestCase
|
||||||
|
@ -16,6 +17,8 @@ class TestDockerHost(UptimeKumaTestCase):
|
||||||
}
|
}
|
||||||
|
|
||||||
# test docker host
|
# test docker host
|
||||||
|
if parse_version(self.api.version) != parse_version("1.23.0"):
|
||||||
|
# test_docker_host does not work in 1.23.0 (https://github.com/louislam/uptime-kuma/issues/3605)
|
||||||
with self.assertRaisesRegex(UptimeKumaException, r'connect ENOENT /var/run/docker.sock'):
|
with self.assertRaisesRegex(UptimeKumaException, r'connect ENOENT /var/run/docker.sock'):
|
||||||
self.api.test_docker_host(**expected_docker_host)
|
self.api.test_docker_host(**expected_docker_host)
|
||||||
|
|
||||||
|
|
|
@ -324,6 +324,53 @@ class TestMonitor(UptimeKumaTestCase):
|
||||||
}
|
}
|
||||||
self.do_test_monitor_type(expected_monitor)
|
self.do_test_monitor_type(expected_monitor)
|
||||||
|
|
||||||
|
def test_monitor_type_json_query(self):
|
||||||
|
if parse_version(self.api.version) < parse_version("1.23"):
|
||||||
|
self.skipTest("Unsupported in this Uptime Kuma version")
|
||||||
|
|
||||||
|
expected_monitor = {
|
||||||
|
"type": MonitorType.JSON_QUERY,
|
||||||
|
"name": "monitor 1",
|
||||||
|
"url": "http://127.0.0.1",
|
||||||
|
"jsonPath": "address.country",
|
||||||
|
"expectedValue": "germany",
|
||||||
|
}
|
||||||
|
self.do_test_monitor_type(expected_monitor)
|
||||||
|
|
||||||
|
def test_monitor_type_real_browser(self):
|
||||||
|
if parse_version(self.api.version) < parse_version("1.23"):
|
||||||
|
self.skipTest("Unsupported in this Uptime Kuma version")
|
||||||
|
|
||||||
|
expected_monitor = {
|
||||||
|
"type": MonitorType.REAL_BROWSER,
|
||||||
|
"name": "monitor 1",
|
||||||
|
"url": "http://127.0.0.1",
|
||||||
|
}
|
||||||
|
self.do_test_monitor_type(expected_monitor)
|
||||||
|
|
||||||
|
def test_monitor_type_kafka_producer(self):
|
||||||
|
if parse_version(self.api.version) < parse_version("1.23"):
|
||||||
|
self.skipTest("Unsupported in this Uptime Kuma version")
|
||||||
|
|
||||||
|
expected_monitor = {
|
||||||
|
"type": MonitorType.KAFKA_PRODUCER,
|
||||||
|
"name": "monitor 1",
|
||||||
|
"kafkaProducerTopic": "topic",
|
||||||
|
"kafkaProducerMessage": "message",
|
||||||
|
}
|
||||||
|
self.do_test_monitor_type(expected_monitor)
|
||||||
|
|
||||||
|
def test_monitor_type_tailscale_ping(self):
|
||||||
|
if parse_version(self.api.version) < parse_version("1.23"):
|
||||||
|
self.skipTest("Unsupported in this Uptime Kuma version")
|
||||||
|
|
||||||
|
expected_monitor = {
|
||||||
|
"type": MonitorType.TAILSCALE_PING,
|
||||||
|
"name": "monitor 1",
|
||||||
|
"hostname": "127.0.0.1"
|
||||||
|
}
|
||||||
|
self.do_test_monitor_type(expected_monitor)
|
||||||
|
|
||||||
def test_delete_not_existing_monitor(self):
|
def test_delete_not_existing_monitor(self):
|
||||||
with self.assertRaises(UptimeKumaException):
|
with self.assertRaises(UptimeKumaException):
|
||||||
self.api.delete_monitor(42)
|
self.api.delete_monitor(42)
|
||||||
|
|
|
@ -278,7 +278,11 @@ def _check_arguments_monitor(kwargs) -> None:
|
||||||
MonitorType.MONGODB: [],
|
MonitorType.MONGODB: [],
|
||||||
MonitorType.RADIUS: ["radiusUsername", "radiusPassword", "radiusSecret", "radiusCalledStationId", "radiusCallingStationId"],
|
MonitorType.RADIUS: ["radiusUsername", "radiusPassword", "radiusSecret", "radiusCalledStationId", "radiusCallingStationId"],
|
||||||
MonitorType.REDIS: [],
|
MonitorType.REDIS: [],
|
||||||
MonitorType.GROUP: []
|
MonitorType.GROUP: [],
|
||||||
|
MonitorType.JSON_QUERY: ["url", "jsonPath", "expectedValue"],
|
||||||
|
MonitorType.REAL_BROWSER: ["url"],
|
||||||
|
MonitorType.KAFKA_PRODUCER: ["kafkaProducerTopic", "kafkaProducerMessage"],
|
||||||
|
MonitorType.TAILSCALE_PING: ["hostname"],
|
||||||
}
|
}
|
||||||
type_ = kwargs["type"]
|
type_ = kwargs["type"]
|
||||||
required_args = required_args_by_type[type_]
|
required_args = required_args_by_type[type_]
|
||||||
|
@ -304,8 +308,45 @@ def _check_arguments_monitor(kwargs) -> None:
|
||||||
)
|
)
|
||||||
_check_argument_conditions(conditions, kwargs)
|
_check_argument_conditions(conditions, kwargs)
|
||||||
|
|
||||||
if kwargs["accepted_statuscodes"] and not all([type(i) == str for i in kwargs["accepted_statuscodes"]]):
|
allowed_accepted_statuscodes = [
|
||||||
raise TypeError("Accepted status codes are not all strings")
|
"100-199",
|
||||||
|
"200-299",
|
||||||
|
"300-399",
|
||||||
|
"400-499",
|
||||||
|
"500-599",
|
||||||
|
] + [
|
||||||
|
str(i) for i in range(100, 999 + 1)
|
||||||
|
]
|
||||||
|
accepted_statuscodes = kwargs["accepted_statuscodes"]
|
||||||
|
for accepted_statuscode in accepted_statuscodes:
|
||||||
|
if accepted_statuscode not in allowed_accepted_statuscodes:
|
||||||
|
raise ValueError(f"Unknown accepted_statuscodes value: {allowed_accepted_statuscodes}")
|
||||||
|
|
||||||
|
dns_resolve_type = kwargs["dns_resolve_type"]
|
||||||
|
if dns_resolve_type not in [
|
||||||
|
"A",
|
||||||
|
"AAAA",
|
||||||
|
"CAA",
|
||||||
|
"CNAME",
|
||||||
|
"MX",
|
||||||
|
"NS",
|
||||||
|
"PTR",
|
||||||
|
"SOA",
|
||||||
|
"SRV",
|
||||||
|
"TXT",
|
||||||
|
]:
|
||||||
|
raise ValueError(f"Unknown dns_resolve_type value: {dns_resolve_type}")
|
||||||
|
|
||||||
|
if type_ == MonitorType.KAFKA_PRODUCER:
|
||||||
|
kafkaProducerSaslOptions_mechanism = kwargs["kafkaProducerSaslOptions"]["mechanism"]
|
||||||
|
if kafkaProducerSaslOptions_mechanism not in [
|
||||||
|
"None",
|
||||||
|
"plain",
|
||||||
|
"scram-sha-256",
|
||||||
|
"scram-sha-512",
|
||||||
|
"aws",
|
||||||
|
]:
|
||||||
|
raise ValueError(f"Unknown kafkaProducerSaslOptions[\"mechanism\"] value: {kafkaProducerSaslOptions_mechanism}")
|
||||||
|
|
||||||
|
|
||||||
def _check_arguments_notification(kwargs) -> None:
|
def _check_arguments_notification(kwargs) -> None:
|
||||||
|
@ -653,12 +694,16 @@ class UptimeKumaApi(object):
|
||||||
notificationIDList: list = None,
|
notificationIDList: list = None,
|
||||||
httpBodyEncoding: str = "json",
|
httpBodyEncoding: str = "json",
|
||||||
|
|
||||||
# HTTP, KEYWORD
|
# HTTP, KEYWORD, JSON_QUERY, REAL_BROWSER
|
||||||
url: str = None,
|
url: str = None,
|
||||||
|
|
||||||
|
# HTTP, KEYWORD, GRPC_KEYWORD
|
||||||
|
maxredirects: int = 10,
|
||||||
|
accepted_statuscodes: list[str] = None,
|
||||||
|
|
||||||
|
# HTTP, KEYWORD, JSON_QUERY
|
||||||
expiryNotification: bool = False,
|
expiryNotification: bool = False,
|
||||||
ignoreTls: bool = False,
|
ignoreTls: bool = False,
|
||||||
maxredirects: int = 10,
|
|
||||||
accepted_statuscodes: list = None,
|
|
||||||
proxyId: int = None,
|
proxyId: int = None,
|
||||||
method: str = "GET",
|
method: str = "GET",
|
||||||
body: str = None,
|
body: str = None,
|
||||||
|
@ -671,9 +716,16 @@ class UptimeKumaApi(object):
|
||||||
basic_auth_pass: str = None,
|
basic_auth_pass: str = None,
|
||||||
authDomain: str = None,
|
authDomain: str = None,
|
||||||
authWorkstation: str = None,
|
authWorkstation: str = None,
|
||||||
|
oauth_auth_method: str = "client_secret_basic",
|
||||||
|
oauth_token_url: str = None,
|
||||||
|
oauth_client_id: str = None,
|
||||||
|
oauth_client_secret: str = None,
|
||||||
|
oauth_scopes: str = None,
|
||||||
|
timeout: int = 48,
|
||||||
|
|
||||||
# KEYWORD
|
# KEYWORD
|
||||||
keyword: str = None,
|
keyword: str = None,
|
||||||
|
invertKeyword: bool = False,
|
||||||
|
|
||||||
# GRPC_KEYWORD
|
# GRPC_KEYWORD
|
||||||
grpcUrl: str = None,
|
grpcUrl: str = None,
|
||||||
|
@ -684,13 +736,13 @@ class UptimeKumaApi(object):
|
||||||
grpcBody: str = None,
|
grpcBody: str = None,
|
||||||
grpcMetadata: str = None,
|
grpcMetadata: str = None,
|
||||||
|
|
||||||
# DNS, PING, STEAM, MQTT
|
# PORT, PING, DNS, STEAM, MQTT, RADIUS, TAILSCALE_PING
|
||||||
hostname: str = None,
|
hostname: str = None,
|
||||||
|
|
||||||
# PING
|
# PING
|
||||||
packetSize: int = 56,
|
packetSize: int = 56,
|
||||||
|
|
||||||
# DNS, STEAM, MQTT, RADIUS
|
# PORT, DNS, STEAM, MQTT, RADIUS
|
||||||
port: int = None,
|
port: int = None,
|
||||||
|
|
||||||
# DNS
|
# DNS
|
||||||
|
@ -698,10 +750,10 @@ class UptimeKumaApi(object):
|
||||||
dns_resolve_type: str = "A",
|
dns_resolve_type: str = "A",
|
||||||
|
|
||||||
# MQTT
|
# MQTT
|
||||||
mqttUsername: str = None,
|
mqttUsername: str = "",
|
||||||
mqttPassword: str = None,
|
mqttPassword: str = "",
|
||||||
mqttTopic: str = None,
|
mqttTopic: str = "",
|
||||||
mqttSuccessMessage: str = None,
|
mqttSuccessMessage: str = "",
|
||||||
|
|
||||||
# SQLSERVER, POSTGRES, MYSQL, MONGODB, REDIS
|
# SQLSERVER, POSTGRES, MYSQL, MONGODB, REDIS
|
||||||
databaseConnectionString: str = None,
|
databaseConnectionString: str = None,
|
||||||
|
@ -721,8 +773,27 @@ class UptimeKumaApi(object):
|
||||||
radiusCallingStationId: str = None,
|
radiusCallingStationId: str = None,
|
||||||
|
|
||||||
# GAMEDIG
|
# GAMEDIG
|
||||||
game: str = None
|
game: str = None,
|
||||||
|
gamedigGivenPortOnly: bool = True,
|
||||||
|
|
||||||
|
# JSON_QUERY
|
||||||
|
jsonPath: str = None,
|
||||||
|
expectedValue: str = None,
|
||||||
|
|
||||||
|
# KAFKA_PRODUCER
|
||||||
|
kafkaProducerBrokers: list[str] = None,
|
||||||
|
kafkaProducerTopic: str = None,
|
||||||
|
kafkaProducerMessage: str = None,
|
||||||
|
kafkaProducerSsl: bool = False,
|
||||||
|
kafkaProducerAllowAutoTopicCreation: bool = False,
|
||||||
|
kafkaProducerSaslOptions: dict = None,
|
||||||
) -> dict:
|
) -> dict:
|
||||||
|
if accepted_statuscodes is None:
|
||||||
|
accepted_statuscodes = ["200-299"]
|
||||||
|
|
||||||
|
if notificationIDList is None:
|
||||||
|
notificationIDList = {}
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
"type": type,
|
"type": type,
|
||||||
"name": name,
|
"name": name,
|
||||||
|
@ -733,26 +804,37 @@ class UptimeKumaApi(object):
|
||||||
"upsideDown": upsideDown,
|
"upsideDown": upsideDown,
|
||||||
"resendInterval": resendInterval,
|
"resendInterval": resendInterval,
|
||||||
"description": description,
|
"description": description,
|
||||||
"httpBodyEncoding": httpBodyEncoding
|
"httpBodyEncoding": httpBodyEncoding,
|
||||||
}
|
}
|
||||||
|
|
||||||
if parse_version(self.version) >= parse_version("1.22"):
|
if parse_version(self.version) >= parse_version("1.22"):
|
||||||
data.update({
|
data.update({
|
||||||
"parent": parent
|
"parent": parent,
|
||||||
})
|
})
|
||||||
|
|
||||||
if type in [MonitorType.KEYWORD, MonitorType.GRPC_KEYWORD]:
|
if type in [MonitorType.KEYWORD, MonitorType.GRPC_KEYWORD]:
|
||||||
data.update({
|
data.update({
|
||||||
"keyword": keyword,
|
"keyword": keyword,
|
||||||
})
|
})
|
||||||
|
if parse_version(self.version) >= parse_version("1.23"):
|
||||||
|
data.update({
|
||||||
|
"invertKeyword": invertKeyword,
|
||||||
|
})
|
||||||
|
|
||||||
# HTTP, KEYWORD
|
# HTTP, KEYWORD, JSON_QUERY, REAL_BROWSER
|
||||||
data.update({
|
data.update({
|
||||||
"url": url,
|
"url": url,
|
||||||
"expiryNotification": expiryNotification,
|
})
|
||||||
"ignoreTls": ignoreTls,
|
|
||||||
|
# HTTP, KEYWORD, GRPC_KEYWORD
|
||||||
|
data.update({
|
||||||
"maxredirects": maxredirects,
|
"maxredirects": maxredirects,
|
||||||
"accepted_statuscodes": accepted_statuscodes,
|
"accepted_statuscodes": accepted_statuscodes,
|
||||||
|
})
|
||||||
|
|
||||||
|
data.update({
|
||||||
|
"expiryNotification": expiryNotification,
|
||||||
|
"ignoreTls": ignoreTls,
|
||||||
"proxyId": proxyId,
|
"proxyId": proxyId,
|
||||||
"method": method,
|
"method": method,
|
||||||
"body": body,
|
"body": body,
|
||||||
|
@ -760,6 +842,11 @@ class UptimeKumaApi(object):
|
||||||
"authMethod": authMethod,
|
"authMethod": authMethod,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if parse_version(self.version) >= parse_version("1.23"):
|
||||||
|
data.update({
|
||||||
|
"timeout": timeout,
|
||||||
|
})
|
||||||
|
|
||||||
if authMethod in [AuthMethod.HTTP_BASIC, AuthMethod.NTLM]:
|
if authMethod in [AuthMethod.HTTP_BASIC, AuthMethod.NTLM]:
|
||||||
data.update({
|
data.update({
|
||||||
"basic_auth_user": basic_auth_user,
|
"basic_auth_user": basic_auth_user,
|
||||||
|
@ -779,6 +866,15 @@ class UptimeKumaApi(object):
|
||||||
"tlsCa": tlsCa,
|
"tlsCa": tlsCa,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if authMethod == AuthMethod.OAUTH2_CC:
|
||||||
|
data.update({
|
||||||
|
"oauth_auth_method": oauth_auth_method,
|
||||||
|
"oauth_token_url": oauth_token_url,
|
||||||
|
"oauth_client_id": oauth_client_id,
|
||||||
|
"oauth_client_secret": oauth_client_secret,
|
||||||
|
"oauth_scopes": oauth_scopes,
|
||||||
|
})
|
||||||
|
|
||||||
# GRPC_KEYWORD
|
# GRPC_KEYWORD
|
||||||
if type == MonitorType.GRPC_KEYWORD:
|
if type == MonitorType.GRPC_KEYWORD:
|
||||||
data.update({
|
data.update({
|
||||||
|
@ -791,7 +887,7 @@ class UptimeKumaApi(object):
|
||||||
"grpcMetadata": grpcMetadata,
|
"grpcMetadata": grpcMetadata,
|
||||||
})
|
})
|
||||||
|
|
||||||
# PORT, PING, DNS, STEAM, MQTT
|
# PORT, PING, DNS, STEAM, MQTT, RADIUS, TAILSCALE_PING
|
||||||
data.update({
|
data.update({
|
||||||
"hostname": hostname,
|
"hostname": hostname,
|
||||||
})
|
})
|
||||||
|
@ -840,7 +936,7 @@ class UptimeKumaApi(object):
|
||||||
if type == MonitorType.DOCKER:
|
if type == MonitorType.DOCKER:
|
||||||
data.update({
|
data.update({
|
||||||
"docker_container": docker_container,
|
"docker_container": docker_container,
|
||||||
"docker_host": docker_host
|
"docker_host": docker_host,
|
||||||
})
|
})
|
||||||
|
|
||||||
# RADIUS
|
# RADIUS
|
||||||
|
@ -850,15 +946,42 @@ class UptimeKumaApi(object):
|
||||||
"radiusPassword": radiusPassword,
|
"radiusPassword": radiusPassword,
|
||||||
"radiusSecret": radiusSecret,
|
"radiusSecret": radiusSecret,
|
||||||
"radiusCalledStationId": radiusCalledStationId,
|
"radiusCalledStationId": radiusCalledStationId,
|
||||||
"radiusCallingStationId": radiusCallingStationId
|
"radiusCallingStationId": radiusCallingStationId,
|
||||||
})
|
})
|
||||||
|
|
||||||
# GAMEDIG
|
# GAMEDIG
|
||||||
if type == MonitorType.GAMEDIG:
|
if type == MonitorType.GAMEDIG:
|
||||||
data.update({
|
data.update({
|
||||||
"game": game
|
"game": game,
|
||||||
|
})
|
||||||
|
if parse_version(self.version) >= parse_version("1.23"):
|
||||||
|
data.update({
|
||||||
|
"gamedigGivenPortOnly": gamedigGivenPortOnly,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# JSON_QUERY
|
||||||
|
if type == MonitorType.JSON_QUERY:
|
||||||
|
data.update({
|
||||||
|
"jsonPath": jsonPath,
|
||||||
|
"expectedValue": expectedValue,
|
||||||
|
})
|
||||||
|
|
||||||
|
# KAFKA_PRODUCER
|
||||||
|
if type == MonitorType.KAFKA_PRODUCER:
|
||||||
|
if kafkaProducerBrokers is None:
|
||||||
|
kafkaProducerBrokers = []
|
||||||
|
if not kafkaProducerSaslOptions:
|
||||||
|
kafkaProducerSaslOptions = {
|
||||||
|
"mechanism": "None",
|
||||||
|
}
|
||||||
|
data.update({
|
||||||
|
"kafkaProducerBrokers": kafkaProducerBrokers,
|
||||||
|
"kafkaProducerTopic": kafkaProducerTopic,
|
||||||
|
"kafkaProducerMessage": kafkaProducerMessage,
|
||||||
|
"kafkaProducerSsl": kafkaProducerSsl,
|
||||||
|
"kafkaProducerAllowAutoTopicCreation": kafkaProducerAllowAutoTopicCreation,
|
||||||
|
"kafkaProducerSaslOptions": kafkaProducerSaslOptions,
|
||||||
|
})
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def _build_maintenance_data(
|
def _build_maintenance_data(
|
||||||
|
@ -926,6 +1049,7 @@ class UptimeKumaApi(object):
|
||||||
customCSS: str = "",
|
customCSS: str = "",
|
||||||
footerText: str = None,
|
footerText: str = None,
|
||||||
showPoweredBy: bool = True,
|
showPoweredBy: bool = True,
|
||||||
|
showCertificateExpiry: bool = False,
|
||||||
|
|
||||||
icon: str = "/icon.svg",
|
icon: str = "/icon.svg",
|
||||||
publicGroupList: list = None
|
publicGroupList: list = None
|
||||||
|
@ -954,8 +1078,12 @@ class UptimeKumaApi(object):
|
||||||
"googleAnalyticsId": googleAnalyticsId,
|
"googleAnalyticsId": googleAnalyticsId,
|
||||||
"customCSS": customCSS,
|
"customCSS": customCSS,
|
||||||
"footerText": footerText,
|
"footerText": footerText,
|
||||||
"showPoweredBy": showPoweredBy
|
"showPoweredBy": showPoweredBy,
|
||||||
}
|
}
|
||||||
|
if parse_version(self.version) >= parse_version("1.23"):
|
||||||
|
config.update({
|
||||||
|
"showCertificateExpiry": showCertificateExpiry,
|
||||||
|
})
|
||||||
return slug, config, icon, publicGroupList
|
return slug, config, icon, publicGroupList
|
||||||
|
|
||||||
# monitor
|
# monitor
|
||||||
|
@ -1082,9 +1210,11 @@ class UptimeKumaApi(object):
|
||||||
'dns_resolve_type': 'A',
|
'dns_resolve_type': 'A',
|
||||||
'docker_container': None,
|
'docker_container': None,
|
||||||
'docker_host': None,
|
'docker_host': None,
|
||||||
|
'expectedValue': None,
|
||||||
'expiryNotification': False,
|
'expiryNotification': False,
|
||||||
'forceInactive': False,
|
'forceInactive': False,
|
||||||
'game': None,
|
'game': None,
|
||||||
|
'gamedigGivenPortOnly': True,
|
||||||
'grpcBody': None,
|
'grpcBody': None,
|
||||||
'grpcEnableTls': False,
|
'grpcEnableTls': False,
|
||||||
'grpcMetadata': None,
|
'grpcMetadata': None,
|
||||||
|
@ -1099,17 +1229,30 @@ class UptimeKumaApi(object):
|
||||||
'ignoreTls': False,
|
'ignoreTls': False,
|
||||||
'includeSensitiveData': True,
|
'includeSensitiveData': True,
|
||||||
'interval': 60,
|
'interval': 60,
|
||||||
|
'invertKeyword': False,
|
||||||
|
'jsonPath': None,
|
||||||
|
'kafkaProducerAllowAutoTopicCreation': False,
|
||||||
|
'kafkaProducerBrokers': None,
|
||||||
|
'kafkaProducerMessage': None,
|
||||||
|
'kafkaProducerSaslOptions': None,
|
||||||
|
'kafkaProducerSsl': False,
|
||||||
|
'kafkaProducerTopic': None,
|
||||||
'keyword': None,
|
'keyword': None,
|
||||||
'maintenance': False,
|
'maintenance': False,
|
||||||
'maxredirects': 10,
|
'maxredirects': 10,
|
||||||
'maxretries': 0,
|
'maxretries': 0,
|
||||||
'method': 'GET',
|
'method': 'GET',
|
||||||
'mqttPassword': None,
|
'mqttPassword': '',
|
||||||
'mqttSuccessMessage': None,
|
'mqttSuccessMessage': '',
|
||||||
'mqttTopic': None,
|
'mqttTopic': '',
|
||||||
'mqttUsername': None,
|
'mqttUsername': '',
|
||||||
'name': 'monitor 1',
|
'name': 'monitor 1',
|
||||||
'notificationIDList': [1, 2],
|
'notificationIDList': [1, 2],
|
||||||
|
'oauth_auth_method': None,
|
||||||
|
'oauth_client_id': None,
|
||||||
|
'oauth_client_secret': None,
|
||||||
|
'oauth_scopes': None,
|
||||||
|
'oauth_token_url': None,
|
||||||
'packetSize': 56,
|
'packetSize': 56,
|
||||||
'parent': None,
|
'parent': None,
|
||||||
'pathName': 'monitor 1',
|
'pathName': 'monitor 1',
|
||||||
|
@ -1123,7 +1266,9 @@ class UptimeKumaApi(object):
|
||||||
'radiusUsername': None,
|
'radiusUsername': None,
|
||||||
'resendInterval': 0,
|
'resendInterval': 0,
|
||||||
'retryInterval': 60,
|
'retryInterval': 60,
|
||||||
|
'screenshot': None,
|
||||||
'tags': [],
|
'tags': [],
|
||||||
|
'timeout': 48,
|
||||||
'tlsCa': None,
|
'tlsCa': None,
|
||||||
'tlsCert': None,
|
'tlsCert': None,
|
||||||
'tlsKey': None,
|
'tlsKey': None,
|
||||||
|
@ -1279,6 +1424,23 @@ class UptimeKumaApi(object):
|
||||||
r = self._call('getGameList')
|
r = self._call('getGameList')
|
||||||
return r.get("gameList")
|
return r.get("gameList")
|
||||||
|
|
||||||
|
def test_chrome(self, executable) -> dict:
|
||||||
|
"""
|
||||||
|
Test if the chrome executable is valid and return the version.
|
||||||
|
|
||||||
|
:return: The server response.
|
||||||
|
:rtype: dict
|
||||||
|
:raises UptimeKumaException: If the server returns an error.
|
||||||
|
|
||||||
|
Example::
|
||||||
|
|
||||||
|
>>> api.test_chrome("/usr/bin/chromium")
|
||||||
|
{
|
||||||
|
'msg': 'Found Chromium/Chrome. Version: 90.0.4430.212'
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
return self._call('testChrome', executable)
|
||||||
|
|
||||||
@append_docstring(monitor_docstring("add"))
|
@append_docstring(monitor_docstring("add"))
|
||||||
def add_monitor(self, **kwargs) -> dict:
|
def add_monitor(self, **kwargs) -> dict:
|
||||||
"""
|
"""
|
||||||
|
@ -1799,8 +1961,8 @@ class UptimeKumaApi(object):
|
||||||
'description': 'description 1',
|
'description': 'description 1',
|
||||||
'domainNameList': [],
|
'domainNameList': [],
|
||||||
'footerText': None,
|
'footerText': None,
|
||||||
'icon': '/icon.svg',
|
|
||||||
'googleAnalyticsId': '',
|
'googleAnalyticsId': '',
|
||||||
|
'icon': '/icon.svg',
|
||||||
'id': 1,
|
'id': 1,
|
||||||
'incident': {
|
'incident': {
|
||||||
'content': 'content 1',
|
'content': 'content 1',
|
||||||
|
@ -1819,7 +1981,8 @@ class UptimeKumaApi(object):
|
||||||
{
|
{
|
||||||
'id': 1,
|
'id': 1,
|
||||||
'name': 'monitor 1',
|
'name': 'monitor 1',
|
||||||
'sendUrl': False
|
'sendUrl': False,
|
||||||
|
'type': 'http'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'name': 'Services',
|
'name': 'Services',
|
||||||
|
@ -1827,6 +1990,7 @@ class UptimeKumaApi(object):
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'published': True,
|
'published': True,
|
||||||
|
'showCertificateExpiry': False,
|
||||||
'showPoweredBy': False,
|
'showPoweredBy': False,
|
||||||
'showTags': False,
|
'showTags': False,
|
||||||
'slug': 'slug1',
|
'slug': 'slug1',
|
||||||
|
@ -1919,6 +2083,7 @@ class UptimeKumaApi(object):
|
||||||
:param str, optional customCSS: Custom CSS, defaults to ""
|
:param str, optional customCSS: Custom CSS, defaults to ""
|
||||||
:param str, optional footerText: Custom Footer, defaults to None
|
:param str, optional footerText: Custom Footer, defaults to None
|
||||||
:param bool, optional showPoweredBy: Show Powered By, defaults to True
|
:param bool, optional showPoweredBy: Show Powered By, defaults to True
|
||||||
|
:param bool, optional showCertificateExpiry: Show Certificate Expiry, defaults to False
|
||||||
:param str, optional icon: Icon, defaults to "/icon.svg"
|
:param str, optional icon: Icon, defaults to "/icon.svg"
|
||||||
:param list, optional publicGroupList: Public Group List, defaults to None
|
:param list, optional publicGroupList: Public Group List, defaults to None
|
||||||
:return: The server response.
|
:return: The server response.
|
||||||
|
@ -2327,11 +2492,12 @@ class UptimeKumaApi(object):
|
||||||
|
|
||||||
>>> api.info()
|
>>> api.info()
|
||||||
{
|
{
|
||||||
'version': '1.19.2',
|
'isContainer': True,
|
||||||
'latestVersion': '1.19.2',
|
'latestVersion': '1.23.1',
|
||||||
'primaryBaseURL': None,
|
'primaryBaseURL': '',
|
||||||
'serverTimezone': 'Europe/Berlin',
|
'serverTimezone': 'Europe/Berlin',
|
||||||
'serverTimezoneOffset': '+01:00'
|
'serverTimezoneOffset': '+02:00',
|
||||||
|
'version': '1.23.1'
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
r = self._get_event_data(Event.INFO)
|
r = self._get_event_data(Event.INFO)
|
||||||
|
@ -2525,10 +2691,12 @@ class UptimeKumaApi(object):
|
||||||
{
|
{
|
||||||
'checkBeta': False,
|
'checkBeta': False,
|
||||||
'checkUpdate': False,
|
'checkUpdate': False,
|
||||||
|
'chromeExecutable': '',
|
||||||
'disableAuth': False,
|
'disableAuth': False,
|
||||||
'dnsCache': True,
|
'dnsCache': True,
|
||||||
'entryPage': 'dashboard',
|
'entryPage': 'dashboard',
|
||||||
'keepDataPeriodDays': 180,
|
'keepDataPeriodDays': 180,
|
||||||
|
'nscd': False,
|
||||||
'primaryBaseURL': '',
|
'primaryBaseURL': '',
|
||||||
'searchEngineIndex': False,
|
'searchEngineIndex': False,
|
||||||
'serverTimezone': 'Europe/Berlin',
|
'serverTimezone': 'Europe/Berlin',
|
||||||
|
@ -2561,7 +2729,9 @@ class UptimeKumaApi(object):
|
||||||
searchEngineIndex: bool = False,
|
searchEngineIndex: bool = False,
|
||||||
primaryBaseURL: str = "",
|
primaryBaseURL: str = "",
|
||||||
steamAPIKey: str = "",
|
steamAPIKey: str = "",
|
||||||
|
nscd: bool = False,
|
||||||
dnsCache: bool = False,
|
dnsCache: bool = False,
|
||||||
|
chromeExecutable: str = "",
|
||||||
|
|
||||||
# notifications
|
# notifications
|
||||||
tlsExpiryNotifyDays: list = None,
|
tlsExpiryNotifyDays: list = None,
|
||||||
|
@ -2584,7 +2754,9 @@ class UptimeKumaApi(object):
|
||||||
:param bool, optional searchEngineIndex: Search Engine Visibility, defaults to False
|
:param bool, optional searchEngineIndex: Search Engine Visibility, defaults to False
|
||||||
:param str, optional primaryBaseURL: Primary Base URL, defaults to ""
|
:param str, optional primaryBaseURL: Primary Base URL, defaults to ""
|
||||||
:param str, optional steamAPIKey: Steam API Key. For monitoring a Steam Game Server you need a Steam Web-API key., defaults to ""
|
:param str, optional steamAPIKey: Steam API Key. For monitoring a Steam Game Server you need a Steam Web-API key., defaults to ""
|
||||||
|
:param bool, optional nscd: Enable NSCD (Name Service Cache Daemon) for caching all DNS requests, defaults to False
|
||||||
:param bool, optional dnsCache: True to enable DNS Cache. It may be not working in some IPv6 environments, disable it if you encounter any issues., defaults to False
|
:param bool, optional dnsCache: True to enable DNS Cache. It may be not working in some IPv6 environments, disable it if you encounter any issues., defaults to False
|
||||||
|
:param str, optional chromeExecutable: Chrome/Chromium Executable, defaults to ""
|
||||||
:param list, optional tlsExpiryNotifyDays: TLS Certificate Expiry. HTTPS Monitors trigger notification when TLS certificate expires in., defaults to None
|
:param list, optional tlsExpiryNotifyDays: TLS Certificate Expiry. HTTPS Monitors trigger notification when TLS certificate expires in., defaults to None
|
||||||
:param bool, optional disableAuth: Disable Authentication, defaults to False
|
:param bool, optional disableAuth: Disable Authentication, defaults to False
|
||||||
:param bool, optional trustProxy: Trust Proxy. Trust 'X-Forwarded-\*' headers. If you want to get the correct client IP and your Uptime Kuma is behind such as Nginx or Apache, you should enable this., defaults to False
|
:param bool, optional trustProxy: Trust Proxy. Trust 'X-Forwarded-\*' headers. If you want to get the correct client IP and your Uptime Kuma is behind such as Nginx or Apache, you should enable this., defaults to False
|
||||||
|
@ -2634,6 +2806,16 @@ class UptimeKumaApi(object):
|
||||||
"disableAuth": disableAuth,
|
"disableAuth": disableAuth,
|
||||||
"trustProxy": trustProxy
|
"trustProxy": trustProxy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if parse_version(self.version) >= parse_version("1.23"):
|
||||||
|
data.update({
|
||||||
|
"chromeExecutable": chromeExecutable,
|
||||||
|
})
|
||||||
|
if parse_version(self.version) >= parse_version("1.23.1"):
|
||||||
|
data.update({
|
||||||
|
"nscd": nscd,
|
||||||
|
})
|
||||||
|
|
||||||
return self._call('setSettings', (data, password))
|
return self._call('setSettings', (data, password))
|
||||||
|
|
||||||
def change_password(self, old_password: str, new_password: str) -> dict:
|
def change_password(self, old_password: str, new_password: str) -> dict:
|
||||||
|
@ -2688,7 +2870,7 @@ class UptimeKumaApi(object):
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
if import_handle not in ["overwrite", "skip", "keep"]:
|
if import_handle not in ["overwrite", "skip", "keep"]:
|
||||||
raise ValueError()
|
raise ValueError(f"Unknown import_handle value: {import_handle}")
|
||||||
return self._call('uploadBackup', (json_data, import_handle))
|
return self._call('uploadBackup', (json_data, import_handle))
|
||||||
|
|
||||||
# 2FA
|
# 2FA
|
||||||
|
|
|
@ -15,3 +15,6 @@ class AuthMethod(str, Enum):
|
||||||
|
|
||||||
MTLS = "mtls"
|
MTLS = "mtls"
|
||||||
"""mTLS Authentication."""
|
"""mTLS Authentication."""
|
||||||
|
|
||||||
|
OAUTH2_CC = "oauth2-cc"
|
||||||
|
"""OAuth2: Client Credentials"""
|
||||||
|
|
|
@ -44,12 +44,30 @@ def monitor_docstring(mode) -> str:
|
||||||
:param str, optional basic_auth_pass: Password for ``authMethod`` :attr:`~.AuthMethod.HTTP_BASIC` and :attr:`~.AuthMethod.NTLM`, defaults to None
|
:param str, optional basic_auth_pass: Password for ``authMethod`` :attr:`~.AuthMethod.HTTP_BASIC` and :attr:`~.AuthMethod.NTLM`, defaults to None
|
||||||
:param str, optional authDomain: Domain for ``authMethod`` :attr:`~.AuthMethod.NTLM`, defaults to None
|
:param str, optional authDomain: Domain for ``authMethod`` :attr:`~.AuthMethod.NTLM`, defaults to None
|
||||||
:param str, optional authWorkstation: Workstation for ``authMethod`` :attr:`~.AuthMethod.NTLM`, defaults to None
|
:param str, optional authWorkstation: Workstation for ``authMethod`` :attr:`~.AuthMethod.NTLM`, defaults to None
|
||||||
|
:param str, optional oauth_auth_method: Authentication Method, defaults to None
|
||||||
|
:param str, optional oauth_token_url: OAuth Token URL, defaults to None
|
||||||
|
:param str, optional oauth_client_id: Client ID, defaults to None
|
||||||
|
:param str, optional oauth_client_secret: Client Secret, defaults to None
|
||||||
|
:param str, optional oauth_scopes: OAuth Scope, defaults to None
|
||||||
|
:param int, optional timeout: Request Timeout, defaults to None
|
||||||
:param str, optional keyword: Keyword. Search keyword in plain HTML or JSON response. The search is case-sensitive., defaults to None
|
:param str, optional keyword: Keyword. Search keyword in plain HTML or JSON response. The search is case-sensitive., defaults to None
|
||||||
|
:param bool, optional invertKeyword: Invert Keyword. Look for the keyword to be absent rather than present., defaults to False
|
||||||
:param str, optional hostname: Hostname, defaults to None
|
:param str, optional hostname: Hostname, defaults to None
|
||||||
:param int, optional packetSize: Packet Size, defaults to None
|
:param int, optional packetSize: Packet Size, defaults to None
|
||||||
:param int, optional port: Port, ``type`` :attr:`~.MonitorType.DNS` defaults to ``53`` and ``type`` :attr:`~.MonitorType.RADIUS` defaults to ``1812``
|
:param int, optional port: Port, ``type`` :attr:`~.MonitorType.DNS` defaults to ``53`` and ``type`` :attr:`~.MonitorType.RADIUS` defaults to ``1812``
|
||||||
:param str, optional dns_resolve_server: Resolver Server, defaults to "1.1.1.1"
|
:param str, optional dns_resolve_server: Resolver Server, defaults to "1.1.1.1"
|
||||||
:param str, optional dns_resolve_type: Resource Record Type, defaults to "A"
|
:param str, optional dns_resolve_type: Resource Record Type, defaults to "A". Available values are:
|
||||||
|
|
||||||
|
- "A"
|
||||||
|
- "AAAA"
|
||||||
|
- "CAA"
|
||||||
|
- "CNAME"
|
||||||
|
- "MX"
|
||||||
|
- "NS"
|
||||||
|
- "PTR"
|
||||||
|
- "SOA"
|
||||||
|
- "SRV"
|
||||||
|
- "TXT"
|
||||||
:param str, optional mqttUsername: MQTT Username, defaults to None
|
:param str, optional mqttUsername: MQTT Username, defaults to None
|
||||||
:param str, optional mqttPassword: MQTT Password, defaults to None
|
:param str, optional mqttPassword: MQTT Password, defaults to None
|
||||||
:param str, optional mqttTopic: MQTT Topic, defaults to None
|
:param str, optional mqttTopic: MQTT Topic, defaults to None
|
||||||
|
@ -64,6 +82,29 @@ def monitor_docstring(mode) -> str:
|
||||||
:param str, optional radiusCalledStationId: Called Station Id. Identifier of the called device., defaults to None
|
:param str, optional radiusCalledStationId: Called Station Id. Identifier of the called device., defaults to None
|
||||||
:param str, optional radiusCallingStationId: Calling Station Id. Identifier of the calling device., defaults to None
|
:param str, optional radiusCallingStationId: Calling Station Id. Identifier of the calling device., defaults to None
|
||||||
:param str, optional game: Game, defaults to None
|
:param str, optional game: Game, defaults to None
|
||||||
|
:param bool, optional gamedigGivenPortOnly: Gamedig: Guess Port. The port used by Valve Server Query Protocol may be different from the client port. Try this if the monitor cannot connect to your server., defaults to False
|
||||||
|
:param str, optional jsonPath: Json Query, defaults to None
|
||||||
|
:param str, optional expectedValue: Expected Value, defaults to None
|
||||||
|
:param str, optional kafkaProducerBrokers: Kafka Broker list, defaults to None
|
||||||
|
:param str, optional kafkaProducerTopic: Kafka Topic Name, defaults to None
|
||||||
|
:param str, optional kafkaProducerMessage: Kafka Producer Message, defaults to None
|
||||||
|
:param bool, optional kafkaProducerSsl: Enable Kafka SSL, defaults to False
|
||||||
|
:param bool, optional kafkaProducerAllowAutoTopicCreation: Enable Kafka Producer Auto Topic Creation, defaults to False
|
||||||
|
:param dict, optional kafkaProducerSaslOptions: Kafka SASL Options
|
||||||
|
|
||||||
|
- **mechanism** (*str*, *optional*): Mechanism, defaults to "None". Available values are:
|
||||||
|
|
||||||
|
- "None"
|
||||||
|
- "plain"
|
||||||
|
- "scram-sha-256"
|
||||||
|
- "scram-sha-512"
|
||||||
|
- "aws"
|
||||||
|
- **username** (*str*, *optional*): Username, defaults to None
|
||||||
|
- **password** (*str*, *optional*): Password, defaults to None
|
||||||
|
- **authorizationIdentity** (*str*, *optional*): Authorization Identity, defaults to None
|
||||||
|
- **accessKeyId** (*str*, *optional*): AccessKey Id, defaults to None
|
||||||
|
- **secretAccessKey** (*str*, *optional*): Secret AccessKey, defaults to None
|
||||||
|
- **sessionToken** (*str*, *optional*): Session Token, defaults to None
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,6 +141,8 @@ def notification_docstring(mode) -> str:
|
||||||
:param str, optional discordWebhookUrl: Notification option for ``type`` :attr:`~.NotificationType.DISCORD`.
|
:param str, optional discordWebhookUrl: Notification option for ``type`` :attr:`~.NotificationType.DISCORD`.
|
||||||
:param str discordPrefixMessage: Notification option for ``type`` :attr:`~.NotificationType.DISCORD`.
|
:param str discordPrefixMessage: Notification option for ``type`` :attr:`~.NotificationType.DISCORD`.
|
||||||
:param str, optional feishuWebHookUrl: Notification option for ``type`` :attr:`~.NotificationType.FEISHU`.
|
:param str, optional feishuWebHookUrl: Notification option for ``type`` :attr:`~.NotificationType.FEISHU`.
|
||||||
|
:param str, optional flashdutySeverity: Notification option for ``type`` :attr:`~.NotificationType.FLASHDUTY`.
|
||||||
|
:param str flashdutyIntegrationKey: Notification option for ``type`` :attr:`~.NotificationType.FLASHDUTY`.
|
||||||
:param str, optional freemobileUser: Notification option for ``type`` :attr:`~.NotificationType.FREEMOBILE`.
|
:param str, optional freemobileUser: Notification option for ``type`` :attr:`~.NotificationType.FREEMOBILE`.
|
||||||
:param str, optional freemobilePass: Notification option for ``type`` :attr:`~.NotificationType.FREEMOBILE`.
|
:param str, optional freemobilePass: Notification option for ``type`` :attr:`~.NotificationType.FREEMOBILE`.
|
||||||
:param str, optional goAlertBaseURL: Notification option for ``type`` :attr:`~.NotificationType.GOALERT`.
|
:param str, optional goAlertBaseURL: Notification option for ``type`` :attr:`~.NotificationType.GOALERT`.
|
||||||
|
@ -134,6 +177,9 @@ def notification_docstring(mode) -> str:
|
||||||
:param str mattermostchannel: Notification option for ``type`` :attr:`~.NotificationType.MATTERMOST`.
|
:param str mattermostchannel: Notification option for ``type`` :attr:`~.NotificationType.MATTERMOST`.
|
||||||
:param str mattermosticonemo: Notification option for ``type`` :attr:`~.NotificationType.MATTERMOST`.
|
:param str mattermosticonemo: Notification option for ``type`` :attr:`~.NotificationType.MATTERMOST`.
|
||||||
:param str mattermosticonurl: Notification option for ``type`` :attr:`~.NotificationType.MATTERMOST`.
|
:param str mattermosticonurl: Notification option for ``type`` :attr:`~.NotificationType.MATTERMOST`.
|
||||||
|
:param str, optional sender: Notification option for ``type`` :attr:`~.NotificationType.NOSTR`.
|
||||||
|
:param str, optional recipients: Notification option for ``type`` :attr:`~.NotificationType.NOSTR`.
|
||||||
|
:param str, optional relays: Notification option for ``type`` :attr:`~.NotificationType.NOSTR`.
|
||||||
:param str ntfyAuthenticationMethod: Notification option for ``type`` :attr:`~.NotificationType.NTFY`. Authentication Method.
|
:param str ntfyAuthenticationMethod: Notification option for ``type`` :attr:`~.NotificationType.NTFY`. Authentication Method.
|
||||||
:param str ntfyusername: Notification option for ``type`` :attr:`~.NotificationType.NTFY`.
|
:param str ntfyusername: Notification option for ``type`` :attr:`~.NotificationType.NTFY`.
|
||||||
:param str ntfypassword: Notification option for ``type`` :attr:`~.NotificationType.NTFY`.
|
:param str ntfypassword: Notification option for ``type`` :attr:`~.NotificationType.NTFY`.
|
||||||
|
@ -192,6 +238,7 @@ def notification_docstring(mode) -> str:
|
||||||
- ``4``: SMS SPEED - Highest priority in system. Very quick and reliable but costly (about twice of SMS FULL price).
|
- ``4``: SMS SPEED - Highest priority in system. Very quick and reliable but costly (about twice of SMS FULL price).
|
||||||
:param str promosmsSenderName: Notification option for ``type`` :attr:`~.NotificationType.PROMOSMS`.
|
:param str promosmsSenderName: Notification option for ``type`` :attr:`~.NotificationType.PROMOSMS`.
|
||||||
:param str, optional pushbulletAccessToken: Notification option for ``type`` :attr:`~.NotificationType.PUSHBULLET`.
|
:param str, optional pushbulletAccessToken: Notification option for ``type`` :attr:`~.NotificationType.PUSHBULLET`.
|
||||||
|
:param str pushdeerServer: Notification option for ``type`` :attr:`~.NotificationType.PUSHDEER`.
|
||||||
:param str, optional pushdeerKey: Notification option for ``type`` :attr:`~.NotificationType.PUSHDEER`.
|
:param str, optional pushdeerKey: Notification option for ``type`` :attr:`~.NotificationType.PUSHDEER`.
|
||||||
:param str, optional pushoveruserkey: Notification option for ``type`` :attr:`~.NotificationType.PUSHOVER`.
|
:param str, optional pushoveruserkey: Notification option for ``type`` :attr:`~.NotificationType.PUSHOVER`.
|
||||||
:param str, optional pushoverapptoken: Notification option for ``type`` :attr:`~.NotificationType.PUSHOVER`.
|
:param str, optional pushoverapptoken: Notification option for ``type`` :attr:`~.NotificationType.PUSHOVER`.
|
||||||
|
@ -214,10 +261,16 @@ def notification_docstring(mode) -> str:
|
||||||
:param str, optional signalNumber: Notification option for ``type`` :attr:`~.NotificationType.SIGNAL`.
|
:param str, optional signalNumber: Notification option for ``type`` :attr:`~.NotificationType.SIGNAL`.
|
||||||
:param str, optional signalRecipients: Notification option for ``type`` :attr:`~.NotificationType.SIGNAL`.
|
:param str, optional signalRecipients: Notification option for ``type`` :attr:`~.NotificationType.SIGNAL`.
|
||||||
:param str, optional signalURL: Notification option for ``type`` :attr:`~.NotificationType.SIGNAL`.
|
:param str, optional signalURL: Notification option for ``type`` :attr:`~.NotificationType.SIGNAL`.
|
||||||
|
:param bool slackchannelnotify: Notification option for ``type`` :attr:`~.NotificationType.SLACK`.
|
||||||
:param str slackchannel: Notification option for ``type`` :attr:`~.NotificationType.SLACK`.
|
:param str slackchannel: Notification option for ``type`` :attr:`~.NotificationType.SLACK`.
|
||||||
:param str slackusername: Notification option for ``type`` :attr:`~.NotificationType.SLACK`.
|
:param str slackusername: Notification option for ``type`` :attr:`~.NotificationType.SLACK`.
|
||||||
:param str slackiconemo: Notification option for ``type`` :attr:`~.NotificationType.SLACK`.
|
:param str slackiconemo: Notification option for ``type`` :attr:`~.NotificationType.SLACK`.
|
||||||
:param str, optional slackwebhookURL: Notification option for ``type`` :attr:`~.NotificationType.SLACK`.
|
:param str, optional slackwebhookURL: Notification option for ``type`` :attr:`~.NotificationType.SLACK`.
|
||||||
|
:param str smscTranslit: Notification option for ``type`` :attr:`~.NotificationType.SMSC`.
|
||||||
|
:param str, optional smscLogin: Notification option for ``type`` :attr:`~.NotificationType.SMSC`.
|
||||||
|
:param str, optional smscPassword: Notification option for ``type`` :attr:`~.NotificationType.SMSC`.
|
||||||
|
:param str, optional smscToNumber: Notification option for ``type`` :attr:`~.NotificationType.SMSC`.
|
||||||
|
:param str smscSenderName: Notification option for ``type`` :attr:`~.NotificationType.SMSC`.
|
||||||
:param bool smseagleEncoding: Notification option for ``type`` :attr:`~.NotificationType.SMSEAGLE`. True to send messages in unicode.
|
:param bool smseagleEncoding: Notification option for ``type`` :attr:`~.NotificationType.SMSEAGLE`. True to send messages in unicode.
|
||||||
:param int smseaglePriority: Notification option for ``type`` :attr:`~.NotificationType.SMSEAGLE`. Message priority (0-9, default = 0).
|
:param int smseaglePriority: Notification option for ``type`` :attr:`~.NotificationType.SMSEAGLE`. Message priority (0-9, default = 0).
|
||||||
:param str smseagleRecipientType: Notification option for ``type`` :attr:`~.NotificationType.SMSEAGLE`. Recipient type.
|
:param str smseagleRecipientType: Notification option for ``type`` :attr:`~.NotificationType.SMSEAGLE`. Recipient type.
|
||||||
|
@ -275,10 +328,12 @@ def notification_docstring(mode) -> str:
|
||||||
:param str telegramMessageThreadID: Notification option for ``type`` :attr:`~.NotificationType.TELEGRAM`.
|
:param str telegramMessageThreadID: Notification option for ``type`` :attr:`~.NotificationType.TELEGRAM`.
|
||||||
:param str, optional telegramBotToken: Notification option for ``type`` :attr:`~.NotificationType.TELEGRAM`.
|
:param str, optional telegramBotToken: Notification option for ``type`` :attr:`~.NotificationType.TELEGRAM`.
|
||||||
:param str, optional twilioAccountSID: Notification option for ``type`` :attr:`~.NotificationType.TWILIO`. Account SID.
|
:param str, optional twilioAccountSID: Notification option for ``type`` :attr:`~.NotificationType.TWILIO`. Account SID.
|
||||||
|
:param str twilioApiKey: Notification option for ``type`` :attr:`~.NotificationType.TWILIO`.
|
||||||
:param str, optional twilioAuthToken: Notification option for ``type`` :attr:`~.NotificationType.TWILIO`. Auth Token.
|
:param str, optional twilioAuthToken: Notification option for ``type`` :attr:`~.NotificationType.TWILIO`. Auth Token.
|
||||||
:param str, optional twilioToNumber: Notification option for ``type`` :attr:`~.NotificationType.TWILIO`. To Number.
|
:param str, optional twilioToNumber: Notification option for ``type`` :attr:`~.NotificationType.TWILIO`. To Number.
|
||||||
:param str, optional twilioFromNumber: Notification option for ``type`` :attr:`~.NotificationType.TWILIO`. From Number.
|
:param str, optional twilioFromNumber: Notification option for ``type`` :attr:`~.NotificationType.TWILIO`. From Number.
|
||||||
:param str, optional webhookContentType: Notification option for ``type`` :attr:`~.NotificationType.WEBHOOK`.
|
:param str, optional webhookContentType: Notification option for ``type`` :attr:`~.NotificationType.WEBHOOK`.
|
||||||
|
:param str webhookCustomBody: Notification option for ``type`` :attr:`~.NotificationType.WEBHOOK`.
|
||||||
:param str webhookAdditionalHeaders: Notification option for ``type`` :attr:`~.NotificationType.WEBHOOK`.
|
:param str webhookAdditionalHeaders: Notification option for ``type`` :attr:`~.NotificationType.WEBHOOK`.
|
||||||
:param str, optional webhookURL: Notification option for ``type`` :attr:`~.NotificationType.WEBHOOK`.
|
:param str, optional webhookURL: Notification option for ``type`` :attr:`~.NotificationType.WEBHOOK`.
|
||||||
:param str, optional weComBotKey: Notification option for ``type`` :attr:`~.NotificationType.WECOM`.
|
:param str, optional weComBotKey: Notification option for ``type`` :attr:`~.NotificationType.WECOM`.
|
||||||
|
|
|
@ -4,6 +4,9 @@ from enum import Enum
|
||||||
class MonitorType(str, Enum):
|
class MonitorType(str, Enum):
|
||||||
"""Enumerate monitor types."""
|
"""Enumerate monitor types."""
|
||||||
|
|
||||||
|
GROUP = "group"
|
||||||
|
"""Group"""
|
||||||
|
|
||||||
HTTP = "http"
|
HTTP = "http"
|
||||||
"""HTTP(s)"""
|
"""HTTP(s)"""
|
||||||
|
|
||||||
|
@ -16,6 +19,9 @@ class MonitorType(str, Enum):
|
||||||
KEYWORD = "keyword"
|
KEYWORD = "keyword"
|
||||||
"""HTTP(s) - Keyword"""
|
"""HTTP(s) - Keyword"""
|
||||||
|
|
||||||
|
JSON_QUERY = "json-query"
|
||||||
|
"""HTTP(s) - Json Query"""
|
||||||
|
|
||||||
GRPC_KEYWORD = "grpc-keyword"
|
GRPC_KEYWORD = "grpc-keyword"
|
||||||
"""gRPC(s) - Keyword"""
|
"""gRPC(s) - Keyword"""
|
||||||
|
|
||||||
|
@ -25,6 +31,9 @@ class MonitorType(str, Enum):
|
||||||
DOCKER = "docker"
|
DOCKER = "docker"
|
||||||
"""Docker Container"""
|
"""Docker Container"""
|
||||||
|
|
||||||
|
REAL_BROWSER = "real-browser"
|
||||||
|
"""HTTP(s) - Browser Engine (Chrome/Chromium)"""
|
||||||
|
|
||||||
PUSH = "push"
|
PUSH = "push"
|
||||||
"""Push"""
|
"""Push"""
|
||||||
|
|
||||||
|
@ -37,6 +46,9 @@ class MonitorType(str, Enum):
|
||||||
MQTT = "mqtt"
|
MQTT = "mqtt"
|
||||||
"""MQTT"""
|
"""MQTT"""
|
||||||
|
|
||||||
|
KAFKA_PRODUCER = "kafka-producer"
|
||||||
|
"""Kafka Producer"""
|
||||||
|
|
||||||
SQLSERVER = "sqlserver"
|
SQLSERVER = "sqlserver"
|
||||||
"""Microsoft SQL Server"""
|
"""Microsoft SQL Server"""
|
||||||
|
|
||||||
|
@ -55,5 +67,5 @@ class MonitorType(str, Enum):
|
||||||
REDIS = "redis"
|
REDIS = "redis"
|
||||||
"""Redis"""
|
"""Redis"""
|
||||||
|
|
||||||
GROUP = "group"
|
TAILSCALE_PING = "tailscale-ping"
|
||||||
"""Group"""
|
"""Tailscale Ping"""
|
||||||
|
|
|
@ -31,6 +31,9 @@ class NotificationType(str, Enum):
|
||||||
FEISHU = "Feishu"
|
FEISHU = "Feishu"
|
||||||
"""Feishu"""
|
"""Feishu"""
|
||||||
|
|
||||||
|
FLASHDUTY = "FlashDuty"
|
||||||
|
"""FlashDuty"""
|
||||||
|
|
||||||
FREEMOBILE = "FreeMobile"
|
FREEMOBILE = "FreeMobile"
|
||||||
"""FreeMobile (mobile.free.fr)"""
|
"""FreeMobile (mobile.free.fr)"""
|
||||||
|
|
||||||
|
@ -67,6 +70,9 @@ class NotificationType(str, Enum):
|
||||||
MATTERMOST = "mattermost"
|
MATTERMOST = "mattermost"
|
||||||
"""Mattermost"""
|
"""Mattermost"""
|
||||||
|
|
||||||
|
NOSTR = "nostr"
|
||||||
|
"""Nostr"""
|
||||||
|
|
||||||
NTFY = "ntfy"
|
NTFY = "ntfy"
|
||||||
"""Ntfy"""
|
"""Ntfy"""
|
||||||
|
|
||||||
|
@ -115,6 +121,9 @@ class NotificationType(str, Enum):
|
||||||
SLACK = "slack"
|
SLACK = "slack"
|
||||||
"""Slack"""
|
"""Slack"""
|
||||||
|
|
||||||
|
SMSC = "smsc"
|
||||||
|
"""SMSC"""
|
||||||
|
|
||||||
SMSEAGLE = "SMSEagle"
|
SMSEAGLE = "SMSEagle"
|
||||||
"""SMSEagle"""
|
"""SMSEagle"""
|
||||||
|
|
||||||
|
@ -200,6 +209,10 @@ notification_provider_options = {
|
||||||
NotificationType.FEISHU: dict(
|
NotificationType.FEISHU: dict(
|
||||||
feishuWebHookUrl=dict(type="str", required=True),
|
feishuWebHookUrl=dict(type="str", required=True),
|
||||||
),
|
),
|
||||||
|
NotificationType.FLASHDUTY: dict(
|
||||||
|
flashdutySeverity=dict(type="str", required=True),
|
||||||
|
flashdutyIntegrationKey=dict(type="str", required=False),
|
||||||
|
),
|
||||||
NotificationType.FREEMOBILE: dict(
|
NotificationType.FREEMOBILE: dict(
|
||||||
freemobileUser=dict(type="str", required=True),
|
freemobileUser=dict(type="str", required=True),
|
||||||
freemobilePass=dict(type="str", required=True),
|
freemobilePass=dict(type="str", required=True),
|
||||||
|
@ -258,6 +271,11 @@ notification_provider_options = {
|
||||||
mattermosticonemo=dict(type="str", required=False),
|
mattermosticonemo=dict(type="str", required=False),
|
||||||
mattermosticonurl=dict(type="str", required=False),
|
mattermosticonurl=dict(type="str", required=False),
|
||||||
),
|
),
|
||||||
|
NotificationType.NOSTR: dict(
|
||||||
|
sender=dict(type="str", required=True),
|
||||||
|
recipients=dict(type="str", required=True),
|
||||||
|
relays=dict(type="str", required=True),
|
||||||
|
),
|
||||||
NotificationType.NTFY: dict(
|
NotificationType.NTFY: dict(
|
||||||
ntfyAuthenticationMethod=dict(type="str", required=False),
|
ntfyAuthenticationMethod=dict(type="str", required=False),
|
||||||
ntfyusername=dict(type="str", required=False),
|
ntfyusername=dict(type="str", required=False),
|
||||||
|
@ -310,6 +328,7 @@ notification_provider_options = {
|
||||||
pushbulletAccessToken=dict(type="str", required=True),
|
pushbulletAccessToken=dict(type="str", required=True),
|
||||||
),
|
),
|
||||||
NotificationType.PUSHDEER: dict(
|
NotificationType.PUSHDEER: dict(
|
||||||
|
pushdeerServer=dict(type="str", required=False),
|
||||||
pushdeerKey=dict(type="str", required=True),
|
pushdeerKey=dict(type="str", required=True),
|
||||||
),
|
),
|
||||||
NotificationType.PUSHOVER: dict(
|
NotificationType.PUSHOVER: dict(
|
||||||
|
@ -346,11 +365,19 @@ notification_provider_options = {
|
||||||
signalURL=dict(type="str", required=True),
|
signalURL=dict(type="str", required=True),
|
||||||
),
|
),
|
||||||
NotificationType.SLACK: dict(
|
NotificationType.SLACK: dict(
|
||||||
|
slackchannelnotify=dict(type="bool", required=False),
|
||||||
slackchannel=dict(type="str", required=False),
|
slackchannel=dict(type="str", required=False),
|
||||||
slackusername=dict(type="str", required=False),
|
slackusername=dict(type="str", required=False),
|
||||||
slackiconemo=dict(type="str", required=False),
|
slackiconemo=dict(type="str", required=False),
|
||||||
slackwebhookURL=dict(type="str", required=True),
|
slackwebhookURL=dict(type="str", required=True),
|
||||||
),
|
),
|
||||||
|
NotificationType.SMSC: dict(
|
||||||
|
smscTranslit=dict(type="str", required=False),
|
||||||
|
smscLogin=dict(type="str", required=True),
|
||||||
|
smscPassword=dict(type="str", required=True),
|
||||||
|
smscToNumber=dict(type="str", required=True),
|
||||||
|
smscSenderName=dict(type="str", required=False),
|
||||||
|
),
|
||||||
NotificationType.SMSEAGLE: dict(
|
NotificationType.SMSEAGLE: dict(
|
||||||
smseagleEncoding=dict(type="bool", required=False),
|
smseagleEncoding=dict(type="bool", required=False),
|
||||||
smseaglePriority=dict(type="int", required=False),
|
smseaglePriority=dict(type="int", required=False),
|
||||||
|
@ -409,12 +436,14 @@ notification_provider_options = {
|
||||||
),
|
),
|
||||||
NotificationType.TWILIO: dict(
|
NotificationType.TWILIO: dict(
|
||||||
twilioAccountSID=dict(type="str", required=True),
|
twilioAccountSID=dict(type="str", required=True),
|
||||||
|
twilioApiKey=dict(type="str", required=False),
|
||||||
twilioAuthToken=dict(type="str", required=True),
|
twilioAuthToken=dict(type="str", required=True),
|
||||||
twilioToNumber=dict(type="str", required=True),
|
twilioToNumber=dict(type="str", required=True),
|
||||||
twilioFromNumber=dict(type="str", required=True),
|
twilioFromNumber=dict(type="str", required=True),
|
||||||
),
|
),
|
||||||
NotificationType.WEBHOOK: dict(
|
NotificationType.WEBHOOK: dict(
|
||||||
webhookContentType=dict(type="str", required=True),
|
webhookContentType=dict(type="str", required=True),
|
||||||
|
webhookCustomBody=dict(type="str", required=False),
|
||||||
webhookAdditionalHeaders=dict(type="str", required=False),
|
webhookAdditionalHeaders=dict(type="str", required=False),
|
||||||
webhookURL=dict(type="str", required=True),
|
webhookURL=dict(type="str", required=True),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue