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