更新API接口
This commit is contained in:
parent
ad9cf38f12
commit
bed55db16f
@ -1277,7 +1277,7 @@ def _inactive_web_sites(bench: Bench):
|
||||
inactive = []
|
||||
session = requests.Session()
|
||||
for site in bench.sites:
|
||||
url = f"https://{site}/api/method/ping"
|
||||
url = f"https://{site}/api/action/ping"
|
||||
try:
|
||||
result = session.get(url)
|
||||
except Exception as e:
|
||||
|
||||
@ -5,4 +5,4 @@ def callback(job, connection, result, *args, **kwargs):
|
||||
from agent.server import Server
|
||||
|
||||
jcloud_url = Server().jcloud_url
|
||||
requests.post(url=f"{jcloud_url}/api/method/jcloud.api.callbacks.callback", data={"job_id": job.id})
|
||||
requests.post(url=f"{jcloud_url}/api/action/jcloud.api.callbacks.callback", data={"job_id": job.id})
|
||||
|
||||
@ -60,7 +60,7 @@ class Monitor(Server):
|
||||
jcloud_url = self.config.get("jcloud_url")
|
||||
jcloud_token = self.config.get("jcloud_token")
|
||||
return requests.post(
|
||||
f"{jcloud_url}/api/method/jcloud.api.monitoring.targets",
|
||||
f"{jcloud_url}/api/action/jcloud.api.monitoring.targets",
|
||||
data={"token": jcloud_token},
|
||||
).json()["message"]
|
||||
|
||||
|
||||
@ -635,7 +635,7 @@ class Site(Base):
|
||||
"timestamp": str(datetime.now()),
|
||||
}
|
||||
try:
|
||||
ping_url = f"https://{self.name}/api/method/ping"
|
||||
ping_url = f"https://{self.name}/api/action/ping"
|
||||
data["web"] = requests.get(ping_url).status_code == 200
|
||||
except Exception:
|
||||
data["web"] = False
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
##- for domain in domains ##
|
||||
- targets:
|
||||
- https://{{ domain.name }}/api/method/ping
|
||||
- https://{{ domain.name }}/api/action/ping
|
||||
labels:
|
||||
site: "{{ domain.site }}"
|
||||
##- endfor ##
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
## for bench in benches ##
|
||||
- targets:
|
||||
##- for site in bench.sites ##
|
||||
- https://{{ site }}/api/method/ping
|
||||
- https://{{ site }}/api/action/ping
|
||||
##- endfor ##
|
||||
labels:
|
||||
cluster: "{{ bench.cluster }}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user