chore: Remove duplicated tools, adjust workflows. (#8)

* chore: Remove duplicated tools, adjust workflows.

* chore: Update .env.example
pull/17608/head
MisluNotFound 1 year ago committed by GitHub
parent aeab94b33f
commit efdb480557
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -20,6 +20,8 @@ FILES_URL=http://127.0.0.1:5001
# APO Config # APO Config
APO_BACKEND_URL=http://127.0.0.1:8080 APO_BACKEND_URL=http://127.0.0.1:8080
APO_VM_URL=http://127.0.0.1:8080 APO_VM_URL=http://127.0.0.1:8080
WORKFLOW_DIR=./workflows
INITIAL_LANGUAGE=en-US
# The time in seconds after the signature is rejected # The time in seconds after the signature is rejected
FILES_ACCESS_TIMEOUT=300 FILES_ACCESS_TIMEOUT=300

@ -1,61 +0,0 @@
{
"version": "0.2.0",
"compounds": [
{
"name": "Launch Flask and Celery",
"configurations": ["Python: Flask", "Python: Celery"]
}
],
"configurations": [
{
"name": "Python: Flask",
"consoleName": "Flask",
"type": "debugpy",
"request": "launch",
"python": "${workspaceFolder}/.venv/bin/python",
"cwd": "${workspaceFolder}",
"envFile": ".env",
"module": "flask",
"justMyCode": true,
"jinja": true,
"env": {
"FLASK_APP": "app.py",
"GEVENT_SUPPORT": "True"
},
"args": [
"run",
"--port=5001"
]
},
{
"name": "Python: Celery",
"consoleName": "Celery",
"type": "debugpy",
"request": "launch",
"python": "${workspaceFolder}/.venv/bin/python",
"cwd": "${workspaceFolder}",
"module": "celery",
"justMyCode": true,
"envFile": ".env",
"console": "integratedTerminal",
"env": {
"FLASK_APP": "app.py",
"FLASK_DEBUG": "1",
"GEVENT_SUPPORT": "True"
},
"args": [
"-A",
"app.celery",
"worker",
"-P",
"gevent",
"-c",
"1",
"--loglevel",
"DEBUG",
"-Q",
"dataset,generation,mail,ops_trace,app_deletion"
]
}
]
}

@ -50,10 +50,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -63,8 +63,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -1,44 +0,0 @@
import json
from collections.abc import Generator
from typing import Any, Optional
import requests
from configs import dify_config
from core.tools.builtin_tool.tool import BuiltinTool
from core.tools.entities.tool_entities import ToolInvokeMessage
from libs.apo_utils import APOUtils
class ClusterCpuUsageRealLinuxTool(BuiltinTool):
def _invoke(
self,
user_id: str,
tool_parameters: dict[str, Any],
conversation_id: Optional[str] = None,
app_id: Optional[str] = None,
message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]:
cluster = tool_parameters.get('cluster')
start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("endTime")
params = {
'metricName': '集群总览 - 总览 - CPU使用量 - Real Linux',
'params': {
**({'cluster': cluster} if cluster else {})
},
'startTime': start_time,
'endTime': end_time,
'step': APOUtils.get_step(start_time, end_time),
}
resp = requests.post(dify_config.APO_BACKEND_URL + '/api/metric/query', json=params)
list = resp.json()['result']
list = json.dumps({
'type': 'metric',
'display': True,
'unit': list['unit'],
'data': {
'timeseries': list['timeseries']
}
})
yield self.create_text_message(list)

@ -1,53 +0,0 @@
identity:
name: 实时集群CPU使用核数
author: APO
label:
en_US: The number of CPU cores in real-time use in the cluster
zh_Hans: 实时集群CPU使用核数
description:
human:
en_US: The number of CPU cores in real-time use in the cluster
zh_Hans: 实时集群CPU使用核数
llm: The number of CPU cores in real-time use in the cluster
display:
type: metric
title: 集群总览 - 总览 - CPU使用量 - Real Linux
unit: "core"
parameters:
- name: cluster
type: string
required: False
label:
en_US: Cluster name
zh_Hans: 集群名称
human_description:
en_US: Cluster name
zh_Hans: 集群名称
llm_description: Cluster name
form: llm
- name: startTime
type: number
required: true
label:
en_US: startTime
zh_Hans: startTime
pt_BR: startTime
human_description:
en_US: Data query start time
zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time
llm_description: Data query start time
form: llm
- name: endTime
type: number
required: true
label:
en_US: endTime
zh_Hans: endTime
pt_BR: endTime
human_description:
en_US: Data query end time
zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time
llm_description: Data query start time
form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -1,44 +0,0 @@
import json
from collections.abc import Generator
from typing import Any, Optional
import requests
from configs import dify_config
from core.tools.builtin_tool.tool import BuiltinTool
from core.tools.entities.tool_entities import ToolInvokeMessage
from libs.apo_utils import APOUtils
class ClusterMemoryUsageRealLinuxTool(BuiltinTool):
def _invoke(
self,
user_id: str,
tool_parameters: dict[str, Any],
conversation_id: Optional[str] = None,
app_id: Optional[str] = None,
message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]:
cluster = tool_parameters.get('cluster')
start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("endTime")
params = {
'metricName': '集群总览 - 总览 - 内存使用量 - Real Linux',
'params': {
**({'cluster': cluster} if cluster else {})
},
'startTime': start_time,
'endTime': end_time,
'step': APOUtils.get_step(start_time, end_time),
}
resp = requests.post(dify_config.APO_BACKEND_URL + '/api/metric/query', json=params)
list = resp.json()['result']
list = json.dumps({
'type': 'metric',
'display': True,
'unit': list['unit'],
'data': {
'timeseries': list['timeseries']
}
})
yield self.create_text_message(list)

@ -1,53 +0,0 @@
identity:
name: 实时集群内存使用字节数
author: APO
label:
en_US: The number of bytes of memory in real-time use in the cluster
zh_Hans: 实时集群内存使用字节数
description:
human:
en_US: The number of bytes of memory in real-time use in the cluster
zh_Hans: 实时集群内存使用字节数
llm: The number of bytes of memory in real-time use in the cluster
display:
type: metric
title: 集群总览 - 总览 - 内存使用量 - Real Linux
unit: "bytes"
parameters:
- name: cluster
type: string
required: false
label:
en_US: Cluster name
zh_Hans: 集群名称
human_description:
en_US: Cluster name
zh_Hans: 集群名称
llm_description: Cluster name
form: llm
- name: startTime
type: number
required: true
label:
en_US: startTime
zh_Hans: startTime
pt_BR: startTime
human_description:
en_US: Data query start time
zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time
llm_description: Data query start time
form: llm
- name: endTime
type: number
required: true
label:
en_US: endTime
zh_Hans: endTime
pt_BR: endTime
human_description:
en_US: Data query end time
zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time
llm_description: Data query start time
form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -1,44 +0,0 @@
import json
from collections.abc import Generator
from typing import Any, Optional
import requests
from configs import dify_config
from core.tools.builtin_tool.tool import BuiltinTool
from core.tools.entities.tool_entities import ToolInvokeMessage
from libs.apo_utils import APOUtils
class ClusterNetworkLinuxReceiveDroppedPacketsTool(BuiltinTool):
def _invoke(
self,
user_id: str,
tool_parameters: dict[str, Any],
conversation_id: Optional[str] = None,
app_id: Optional[str] = None,
message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]:
cluster = tool_parameters.get('cluster')
start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("endTime")
params = {
'metricName': '集群总览 - 总览 - 网络饱和 - 丢包数 - Linux Packets dropped (receive)',
'params': {
**({'cluster': cluster} if cluster else {})
},
'startTime': start_time,
'endTime': end_time,
'step': APOUtils.get_step(start_time, end_time),
}
resp = requests.post(dify_config.APO_BACKEND_URL + '/api/metric/query', json=params)
list = resp.json()['result']
list = json.dumps({
'type': 'metric',
'display': True,
'unit': list['unit'],
'data': {
'timeseries': list['timeseries']
}
})
yield self.create_text_message(list)

@ -1,53 +0,0 @@
identity:
name: Linux集群网络接收丢包数
author: APO
label:
en_US: The number of dropped packets received by the Linux cluster network
zh_Hans: Linux集群网络接收丢包数
description:
human:
en_US: The number of dropped packets received by the Linux cluster network
zh_Hans: Linux集群网络接收丢包数
llm: The number of dropped packets received by the Linux cluster network
display:
type: metric
title: 集群总览 - 总览 - 网络饱和 - 丢包数 - Linux Packets dropped (receive)
unit: "short"
parameters:
- name: cluster
type: string
required: False
label:
en_US: Cluster name
zh_Hans: 集群名称
human_description:
en_US: Cluster name
zh_Hans: 集群名称
llm_description: Cluster name
form: llm
- name: startTime
type: number
required: true
label:
en_US: startTime
zh_Hans: startTime
pt_BR: startTime
human_description:
en_US: Data query start time
zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time
llm_description: Data query start time
form: llm
- name: endTime
type: number
required: true
label:
en_US: endTime
zh_Hans: endTime
pt_BR: endTime
human_description:
en_US: Data query end time
zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time
llm_description: Data query start time
form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -1,44 +0,0 @@
import json
from collections.abc import Generator
from typing import Any, Optional
import requests
from configs import dify_config
from core.tools.builtin_tool.tool import BuiltinTool
from core.tools.entities.tool_entities import ToolInvokeMessage
from libs.apo_utils import APOUtils
class ClusterNetworkReceiveBandwidthTool(BuiltinTool):
def _invoke(
self,
user_id: str,
tool_parameters: dict[str, Any],
conversation_id: Optional[str] = None,
app_id: Optional[str] = None,
message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]:
cluster = tool_parameters.get('cluster')
start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("endTime")
params = {
'metricName': '集群总览 - 总览 - 集群整体网络带宽(按设备统计) - 接收',
'params': {
**({'cluster': cluster} if cluster else {})
},
'startTime': start_time,
'endTime': end_time,
'step': APOUtils.get_step(start_time, end_time),
}
resp = requests.post(dify_config.APO_BACKEND_URL + '/api/metric/query', json=params)
list = resp.json()['result']
list = json.dumps({
'type': 'metric',
'display': True,
'unit': list['unit'],
'data': {
'timeseries': list['timeseries']
}
})
yield self.create_text_message(list)

@ -1,53 +0,0 @@
identity:
name: 集群网络接收带宽(按设备统计,排除虚拟设备)
author: APO
label:
en_US: Cluster network receiving bandwidth (statistically by device, excluding virtual devices)
zh_Hans: 集群网络接收带宽(按设备统计,排除虚拟设备)
description:
human:
en_US: Cluster network receiving bandwidth (statistically by device, excluding virtual devices)
zh_Hans: 集群网络接收带宽(按设备统计,排除虚拟设备)
llm: Cluster network receiving bandwidth (statistically by device, excluding virtual devices)
display:
type: metric
title: 集群总览 - 总览 - 集群整体网络带宽(按设备统计) - 接收
unit: "bytes"
parameters:
- name: cluster
type: string
required: False
label:
en_US: Cluster name
zh_Hans: 集群名称
human_description:
en_US: Cluster name
zh_Hans: 集群名称
llm_description: Cluster name
form: llm
- name: startTime
type: number
required: true
label:
en_US: startTime
zh_Hans: startTime
pt_BR: startTime
human_description:
en_US: Data query start time
zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time
llm_description: Data query start time
form: llm
- name: endTime
type: number
required: true
label:
en_US: endTime
zh_Hans: endTime
pt_BR: endTime
human_description:
en_US: Data query end time
zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time
llm_description: Data query start time
form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -1,44 +0,0 @@
import json
from collections.abc import Generator
from typing import Any, Optional
import requests
from configs import dify_config
from core.tools.builtin_tool.tool import BuiltinTool
from core.tools.entities.tool_entities import ToolInvokeMessage
from libs.apo_utils import APOUtils
class ClusterNetworkSendBandwidthTool(BuiltinTool):
def _invoke(
self,
user_id: str,
tool_parameters: dict[str, Any],
conversation_id: Optional[str] = None,
app_id: Optional[str] = None,
message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]:
cluster = tool_parameters.get('cluster')
start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("endTime")
params = {
'metricName': '集群总览 - 总览 - 集群整体网络带宽(按设备统计) - 发送',
'params': {
**({'cluster': cluster} if cluster else {})
},
'startTime': start_time,
'endTime': end_time,
'step': APOUtils.get_step(start_time, end_time),
}
resp = requests.post(dify_config.APO_BACKEND_URL + '/api/metric/query', json=params)
list = resp.json()['result']
list = json.dumps({
'type': 'metric',
'display': True,
'unit': list['unit'],
'data': {
'timeseries': list['timeseries']
}
})
yield self.create_text_message(list)

@ -1,53 +0,0 @@
identity:
name: 集群网络发送带宽(按设备统计,排除虚拟设备)
author: APO
label:
en_US: Cluster network sending bandwidth (statistically by device, excluding virtual devices)
zh_Hans: 集群网络发送带宽(按设备统计,排除虚拟设备)
description:
human:
en_US: Cluster network sending bandwidth (statistically by device, excluding virtual devices)
zh_Hans: 集群网络发送带宽(按设备统计,排除虚拟设备)
llm: Cluster network sending bandwidth (statistically by device, excluding virtual devices)
display:
type: metric
title: 集群总览 - 总览 - 集群整体网络带宽(按设备统计) - 发送
unit: "bytes"
parameters:
- name: cluster
type: string
required: False
label:
en_US: Cluster name
zh_Hans: 集群名称
human_description:
en_US: Cluster name
zh_Hans: 集群名称
llm_description: Cluster name
form: llm
- name: startTime
type: number
required: true
label:
en_US: startTime
zh_Hans: startTime
pt_BR: startTime
human_description:
en_US: Data query start time
zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time
llm_description: Data query start time
form: llm
- name: endTime
type: number
required: true
label:
en_US: endTime
zh_Hans: endTime
pt_BR: endTime
human_description:
en_US: Data query end time
zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time
llm_description: Data query start time
form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -1,44 +0,0 @@
import json
from collections.abc import Generator
from typing import Any, Optional
import requests
from configs import dify_config
from core.tools.builtin_tool.tool import BuiltinTool
from core.tools.entities.tool_entities import ToolInvokeMessage
from libs.apo_utils import APOUtils
class ClusterOverviewCpuUtilizationLinuxTool(BuiltinTool):
def _invoke(
self,
user_id: str,
tool_parameters: dict[str, Any],
conversation_id: Optional[str] = None,
app_id: Optional[str] = None,
message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]:
cluster = tool_parameters.get('cluster', '.*')
start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("endTime")
params = {
'metricName': '集群总览 - 总览 - 集群总CPU使用率 - Real Linux',
'params': {
'cluster': cluster
},
'startTime': start_time,
'endTime': end_time,
'step': APOUtils.get_step(start_time, end_time),
}
resp = requests.post(dify_config.APO_BACKEND_URL + '/api/metric/query', json=params)
list = resp.json()['result']
list = json.dumps({
'type': 'metric',
'display': True,
'unit': list['unit'],
'data': {
'timeseries': list['timeseries']
}
})
yield self.create_text_message(list)

@ -1,53 +0,0 @@
identity:
name: 实时集群CPU使用率
author: APO
label:
en_US: Real-time cluster CPU utilization rate
zh_Hans: 实时集群CPU使用率
description:
human:
en_US: Real-time cluster CPU utilization rate
zh_Hans: 实时集群CPU使用率
llm: Real-time cluster CPU utilization rate
display:
type: metric
title: 集群总览 - 总览 - 集群总CPU使用率 - Real Linux
unit: "percentunit"
parameters:
- name: cluster
type: string
required: False
label:
en_US: Cluster name
zh_Hans: 集群名称
human_description:
en_US: Cluster name
zh_Hans: 集群名称
llm_description: Cluster name
form: llm
- name: startTime
type: number
required: true
label:
en_US: startTime
zh_Hans: startTime
pt_BR: startTime
human_description:
en_US: Data query start time
zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time
llm_description: Data query start time
form: llm
- name: endTime
type: number
required: true
label:
en_US: endTime
zh_Hans: endTime
pt_BR: endTime
human_description:
en_US: Data query end time
zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time
llm_description: Data query start time
form: llm

@ -1,44 +0,0 @@
import json
from collections.abc import Generator
from typing import Any, Optional
import requests
from configs import dify_config
from core.tools.builtin_tool.tool import BuiltinTool
from core.tools.entities.tool_entities import ToolInvokeMessage
from libs.apo_utils import APOUtils
class ClusterOverviewMemoryUtilizationLinuxTool(BuiltinTool):
def _invoke(
self,
user_id: str,
tool_parameters: dict[str, Any],
conversation_id: Optional[str] = None,
app_id: Optional[str] = None,
message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]:
cluster = tool_parameters.get('cluster', '.*')
start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("endTime")
params = {
'metricName': '集群总览 - 总览 - 集群总内存使用率 - Real Linux',
'params': {
'cluster': cluster
},
'startTime': start_time,
'endTime': end_time,
'step': APOUtils.get_step(start_time, end_time),
}
resp = requests.post(dify_config.APO_BACKEND_URL + '/api/metric/query', json=params)
list = resp.json()['result']
list = json.dumps({
'type': 'metric',
'display': True,
'unit': list['unit'],
'data': {
'timeseries': list['timeseries']
}
})
yield self.create_text_message(list)

@ -1,53 +0,0 @@
identity:
name: 实时集群内存使用率
author: APO
label:
en_US: Real-time cluster memory utilization rate
zh_Hans: 实时集群内存使用率
description:
human:
en_US: Real-time cluster memory utilization rate
zh_Hans: 实时集群内存使用率
llm: Real-time cluster memory utilization rate
display:
type: metric
title: 集群总览 - 总览 - 集群总内存使用率 - Real Linux
unit: "percentunit"
parameters:
- name: cluster
type: string
required: False
label:
en_US: Cluster name
zh_Hans: 集群名称
human_description:
en_US: Cluster name
zh_Hans: 集群名称
llm_description: Cluster name
form: llm
- name: startTime
type: number
required: true
label:
en_US: startTime
zh_Hans: startTime
pt_BR: startTime
human_description:
en_US: Data query start time
zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time
llm_description: Data query start time
form: llm
- name: endTime
type: number
required: true
label:
en_US: endTime
zh_Hans: endTime
pt_BR: endTime
human_description:
en_US: Data query end time
zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time
llm_description: Data query start time
form: llm

@ -1,44 +0,0 @@
import json
from collections.abc import Generator
from typing import Any, Optional
import requests
from configs import dify_config
from core.tools.builtin_tool.tool import BuiltinTool
from core.tools.entities.tool_entities import ToolInvokeMessage
from libs.apo_utils import APOUtils
class ClusterOverviewNamespaceCountTool(BuiltinTool):
def _invoke(
self,
user_id: str,
tool_parameters: dict[str, Any],
conversation_id: Optional[str] = None,
app_id: Optional[str] = None,
message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]:
cadvisor_job_name = tool_parameters.get('cadvisor_job_name', '.*')
start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("endTime")
params = {
'metricName': '集群总览 - 总览 - 命名空间数量',
'params': {
'cadvisor_job_name': cadvisor_job_name
},
'startTime': start_time,
'endTime': end_time,
'step': APOUtils.get_step(start_time, end_time),
}
resp = requests.post(dify_config.APO_BACKEND_URL + '/api/metric/query', json=params)
list = resp.json()['result']
list = json.dumps({
'type': 'metric',
'display': True,
'unit': list['unit'],
'data': {
'timeseries': list['timeseries']
}
})
yield self.create_text_message(list)

@ -1,53 +0,0 @@
identity:
name: K8s集群中命名空间的数量
author: APO
label:
en_US: Number of namespaces in Kubernetes cluster
zh_Hans: K8s集群中命名空间的数量
description:
human:
en_US: Number of namespaces in Kubernetes cluster
zh_Hans: K8s集群中命名空间的数量
llm: Number of namespaces in Kubernetes cluster
display:
type: metric
title: 集群总览 - 总览 - 命名空间数量
unit: "count"
parameters:
- name: cadvisor_job_name
type: string
required: False
label:
en_US: cAdvisor job name
zh_Hans: cAdvisor任务名称
human_description:
en_US: cAdvisor job name
zh_Hans: cAdvisor任务名称
llm_description: cAdvisor job name
form: llm
- name: startTime
type: number
required: true
label:
en_US: startTime
zh_Hans: startTime
pt_BR: startTime
human_description:
en_US: Data query start time
zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time
llm_description: Data query start time
form: llm
- name: endTime
type: number
required: true
label:
en_US: endTime
zh_Hans: endTime
pt_BR: endTime
human_description:
en_US: Data query end time
zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time
llm_description: Data query start time
form: llm

@ -1,44 +0,0 @@
import json
from collections.abc import Generator
from typing import Any, Optional
import requests
from configs import dify_config
from core.tools.builtin_tool.tool import BuiltinTool
from core.tools.entities.tool_entities import ToolInvokeMessage
from libs.apo_utils import APOUtils
class ClusterOverviewNodeCountTool(BuiltinTool):
def _invoke(
self,
user_id: str,
tool_parameters: dict[str, Any],
conversation_id: Optional[str] = None,
app_id: Optional[str] = None,
message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]:
cadvisor_job_name = tool_parameters.get('cadvisor_job_name', '.*')
start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("endTime")
params = {
'metricName': '集群总览 - 总览 - 节点数',
'params': {
'cadvisor_job_name': cadvisor_job_name
},
'startTime': start_time,
'endTime': end_time,
'step': APOUtils.get_step(start_time, end_time),
}
resp = requests.post(dify_config.APO_BACKEND_URL + '/api/metric/query', json=params)
list = resp.json()['result']
list = json.dumps({
'type': 'metric',
'display': True,
'unit': list['unit'],
'data': {
'timeseries': list['timeseries']
}
})
yield self.create_text_message(list)

@ -1,53 +0,0 @@
identity:
name: K8s集群中节点的数量
author: APO
label:
en_US: Number of nodes in Kubernetes cluster
zh_Hans: K8s集群中节点的数量
description:
human:
en_US: Number of nodes in Kubernetes cluster
zh_Hans: K8s集群中节点的数量
llm: Number of nodes in Kubernetes cluster
display:
type: metric
title: 集群总览 - 总览 - 节点数
unit: "count"
parameters:
- name: cadvisor_job_name
type: string
required: False
label:
en_US: cAdvisor job name
zh_Hans: cAdvisor任务名称
human_description:
en_US: cAdvisor job name
zh_Hans: cAdvisor任务名称
llm_description: cAdvisor job name
form: llm
- name: startTime
type: number
required: true
label:
en_US: startTime
zh_Hans: startTime
pt_BR: startTime
human_description:
en_US: Data query start time
zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time
llm_description: Data query start time
form: llm
- name: endTime
type: number
required: true
label:
en_US: endTime
zh_Hans: endTime
pt_BR: endTime
human_description:
en_US: Data query end time
zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time
llm_description: Data query start time
form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -1,44 +0,0 @@
import json
from collections.abc import Generator
from typing import Any, Optional
import requests
from configs import dify_config
from core.tools.builtin_tool.tool import BuiltinTool
from core.tools.entities.tool_entities import ToolInvokeMessage
from libs.apo_utils import APOUtils
class ClusterRunningPodsCountTool(BuiltinTool):
def _invoke(
self,
user_id: str,
tool_parameters: dict[str, Any],
conversation_id: Optional[str] = None,
app_id: Optional[str] = None,
message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]:
cadvisor_job_name = tool_parameters.get('cadvisor_job_name', '.*')
start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("endTime")
params = {
'metricName': '集群总览 - 总览 - 运行的Pod数',
'params': {
'cadvisor_job_name': cadvisor_job_name
},
'startTime': start_time,
'endTime': end_time,
'step': APOUtils.get_step(start_time, end_time),
}
resp = requests.post(dify_config.APO_BACKEND_URL + '/api/metric/query', json=params)
list = resp.json()['result']
list = json.dumps({
'type': 'metric',
'display': True,
'unit': list['unit'],
'data': {
'timeseries': list['timeseries']
}
})
yield self.create_text_message(list)

@ -1,53 +0,0 @@
identity:
name: K8s集群中运行中的Pod数量
author: APO
label:
en_US: Number of running Pods in Kubernetes cluster
zh_Hans: K8s集群中运行中的Pod数量
description:
human:
en_US: Number of running Pods in Kubernetes cluster
zh_Hans: K8s集群中运行中的Pod数量
llm: Number of running Pods in Kubernetes cluster
display:
type: metric
title: 集群总览 - 总览 - 运行的Pod数
unit: "count"
parameters:
- name: cadvisor_job_name
type: string
required: False
label:
en_US: cAdvisor job name
zh_Hans: cAdvisor任务名称
human_description:
en_US: cAdvisor job name
zh_Hans: cAdvisor任务名称
llm_description: cAdvisor job name
form: llm
- name: startTime
type: number
required: true
label:
en_US: startTime
zh_Hans: startTime
pt_BR: startTime
human_description:
en_US: Data query start time
zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time
llm_description: Data query start time
form: llm
- name: endTime
type: number
required: true
label:
en_US: endTime
zh_Hans: endTime
pt_BR: endTime
human_description:
en_US: Data query end time
zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time
llm_description: Data query start time
form: llm

@ -1,44 +0,0 @@
import json
from collections.abc import Generator
from typing import Any, Optional
import requests
from configs import dify_config
from core.tools.builtin_tool.tool import BuiltinTool
from core.tools.entities.tool_entities import ToolInvokeMessage
from libs.apo_utils import APOUtils
class ClusterTotalCpuCapacityTool(BuiltinTool):
def _invoke(
self,
user_id: str,
tool_parameters: dict[str, Any],
conversation_id: Optional[str] = None,
app_id: Optional[str] = None,
message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]:
cluster = tool_parameters.get('cluster', '.*')
start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("endTime")
params = {
'metricName': '集群总览 - 总览 - CPU使用量 - Total',
'params': {
'cluster': cluster
},
'startTime': start_time,
'endTime': end_time,
'step': APOUtils.get_step(start_time, end_time),
}
resp = requests.post(dify_config.APO_BACKEND_URL + '/api/metric/query', json=params)
list = resp.json()['result']
list = json.dumps({
'type': 'metric',
'display': True,
'unit': list['unit'],
'data': {
'timeseries': list['timeseries']
}
})
yield self.create_text_message(list)

@ -1,53 +0,0 @@
identity:
name: 集群总可用CPU核数
author: APO
label:
en_US: Total available CPU cores in cluster
zh_Hans: 集群总可用CPU核数
description:
human:
en_US: Total available CPU cores in cluster
zh_Hans: 集群总可用CPU核数
llm: Total available CPU cores in cluster
display:
type: metric
title: 集群总览 - 总览 - CPU使用量 - Total
unit: "core"
parameters:
- name: cluster
type: string
required: False
label:
en_US: Cluster name
zh_Hans: 集群名称
human_description:
en_US: Cluster name
zh_Hans: 集群名称
llm_description: Cluster name
form: llm
- name: startTime
type: number
required: true
label:
en_US: startTime
zh_Hans: startTime
pt_BR: startTime
human_description:
en_US: Data query start time
zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time
llm_description: Data query start time
form: llm
- name: endTime
type: number
required: true
label:
en_US: endTime
zh_Hans: endTime
pt_BR: endTime
human_description:
en_US: Data query end time
zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time
llm_description: Data query start time
form: llm

@ -1,44 +0,0 @@
import json
from collections.abc import Generator
from typing import Any, Optional
import requests
from configs import dify_config
from core.tools.builtin_tool.tool import BuiltinTool
from core.tools.entities.tool_entities import ToolInvokeMessage
from libs.apo_utils import APOUtils
class ClusterTotalMemoryCapacityTool(BuiltinTool):
def _invoke(
self,
user_id: str,
tool_parameters: dict[str, Any],
conversation_id: Optional[str] = None,
app_id: Optional[str] = None,
message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]:
cluster = tool_parameters.get('cluster', '.*')
start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("endTime")
params = {
'metricName': '集群总览 - 总览 - 内存使用量 - Total',
'params': {
'cluster': cluster
},
'startTime': start_time,
'endTime': end_time,
'step': APOUtils.get_step(start_time, end_time),
}
resp = requests.post(dify_config.APO_BACKEND_URL + '/api/metric/query', json=params)
list = resp.json()['result']
list = json.dumps({
'type': 'metric',
'display': True,
'unit': list['unit'],
'data': {
'timeseries': list['timeseries']
}
})
yield self.create_text_message(list)

@ -1,53 +0,0 @@
identity:
name: 集群总可用内存字节数
author: APO
label:
en_US: Total available memory in bytes
zh_Hans: 集群总可用内存字节数
description:
human:
en_US: Total available memory in bytes
zh_Hans: 集群总可用内存字节数
llm: Total available memory in bytes
display:
type: metric
title: 集群总览 - 总览 - 内存使用量 - Total
unit: "bytes"
parameters:
- name: cluster
type: string
required: False
label:
en_US: Cluster name
zh_Hans: 集群名称
human_description:
en_US: Cluster name
zh_Hans: 集群名称
llm_description: Cluster name
form: llm
- name: startTime
type: number
required: true
label:
en_US: startTime
zh_Hans: startTime
pt_BR: startTime
human_description:
en_US: Data query start time
zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time
llm_description: Data query start time
form: llm
- name: endTime
type: number
required: true
label:
en_US: endTime
zh_Hans: endTime
pt_BR: endTime
human_description:
en_US: Data query end time
zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time
llm_description: Data query start time
form: llm

@ -1,45 +0,0 @@
import json
from collections.abc import Generator
from typing import Any, Optional
import requests
from configs import dify_config
from core.tools.builtin_tool.tool import BuiltinTool
from core.tools.entities.tool_entities import ToolInvokeMessage
from libs.apo_utils import APOUtils
class SelectContainerCPUTool(BuiltinTool):
def _invoke(
self,
user_id: str,
tool_parameters: dict[str, Any],
conversation_id: Optional[str] = None,
app_id: Optional[str] = None,
message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]:
pod = tool_parameters.get("pod")
namespace = tool_parameters.get("namespace")
start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("endTime")
params = {
'metricName': '基础设施情况 - 容器CPU - 容器CPU使用率 - Containerd',
'params': {
"pod": pod,
"namespace": namespace
},
'startTime': start_time,
'endTime': end_time,
'step': APOUtils.get_step(start_time, end_time),
}
resp = requests.post(dify_config.APO_BACKEND_URL + '/api/metric/query', json=params)
list = resp.json()['result']
list = json.dumps({
'type': 'metric',
'display': True,
'unit': list['unit'],
'data': {
"timeseries": list['timeseries']
}
})
yield self.create_text_message(list)

@ -1,70 +0,0 @@
identity:
name: 查询容器CPU利用率
author: APO
label:
en_US: Query the CPU usage of the container
zh_Hans: 容器CPU使用率(使用Containerd容器运行时,按容器和Pod统计)
pt_BR: Query the CPU usage of the container
display:
type: metric
title: 基础设施情况 - 容器CPU - 容器CPU使用率 - Containerd
unit: percent(0-100)百分比
description:
human:
en_US: Query the CPU usage of the container
zh_Hans: 容器CPU使用率(使用Containerd容器运行时,按容器和Pod统计)
pt_BR: Query the CPU usage of the container
llm: Query the CPU usage of the container
parameters:
- name: pod
type: string
required: false
label:
en_US: pod
zh_Hans: pod
pt_BR: pod
human_description:
en_US: Specified pod name
zh_Hans: 指定的容器POD名称
pt_BR: Specified pod name
llm_description: Specified pod name
form: llm
- name: namespace
type: string
required: false
label:
en_US: namespace
zh_Hans: namespace
pt_BR: namespace
human_description:
en_US: Specified namespace
zh_Hans: 指定的容器所在Namespace
pt_BR: Specified namespace
llm_description: Specified namespace
form: llm
- name: startTime
type: number
required: true
label:
en_US: startTime
zh_Hans: startTime
pt_BR: startTime
human_description:
en_US: Data query start time
zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time
llm_description: Data query start time
form: llm
- name: endTime
type: number
required: true
label:
en_US: endTime
zh_Hans: endTime
pt_BR: endTime
human_description:
en_US: Data query end time
zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time
llm_description: Data query start time
form: llm

@ -50,10 +50,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -63,8 +63,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -1,48 +0,0 @@
import json
from collections.abc import Generator
from typing import Any, Optional
import requests
from configs import dify_config
from core.tools.builtin_tool.tool import BuiltinTool
from core.tools.entities.tool_entities import ToolInvokeMessage
from libs.apo_utils import APOUtils
class ContainerCpuThrottleContainerdSecondsTool(BuiltinTool):
def _invoke(
self,
user_id: str,
tool_parameters: dict[str, Any],
conversation_id: Optional[str] = None,
app_id: Optional[str] = None,
message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]:
cadvisor_job_name = tool_parameters.get('cadvisor_job_name', '.*')
namespace = tool_parameters.get('namespace', '.*')
pod = tool_parameters.get('pod', '.*')
start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("endTime")
params = {
'metricName': '基础设施情况 - 容器CPU - 容器CPU节流时间 - Containerd',
'params': {
'cadvisor_job_name': cadvisor_job_name,
'namespace': namespace,
'pod': pod
},
'startTime': start_time,
'endTime': end_time,
'step': APOUtils.get_step(start_time, end_time),
}
resp = requests.post(dify_config.APO_BACKEND_URL + '/api/metric/query', json=params)
list = resp.json()['result']
list = json.dumps({
'type': 'metric',
'display': True,
'unit': list['unit'],
'data': {
'timeseries': list['timeseries']
}
})
yield self.create_text_message(list)

@ -1,75 +0,0 @@
identity:
name: 容器CPU节流时长(使用Containerd容器运行时,按容器和Pod统计)
author: APO
label:
en_US: Container CPU throttling time (Containerd runtime, aggregated by container and Pod)
zh_Hans: 容器CPU节流时长(使用Containerd容器运行时,按容器和Pod统计)
description:
human:
en_US: Container CPU throttling time (Containerd runtime, aggregated by container and Pod)
zh_Hans: 容器CPU节流时长(使用Containerd容器运行时,按容器和Pod统计)
llm: Container CPU throttling time (Containerd runtime, aggregated by container and Pod)
display:
type: metric
title: 基础设施情况 - 容器CPU - 容器CPU节流时间 - Containerd
unit: "s"
parameters:
- name: cadvisor_job_name
type: string
required: False
label:
en_US: cAdvisor job name
zh_Hans: cAdvisor任务名称
human_description:
en_US: cAdvisor job name
zh_Hans: cAdvisor任务名称
llm_description: cAdvisor job name
form: llm
- name: namespace
type: string
required: False
label:
en_US: Namespace
zh_Hans: 命名空间
human_description:
en_US: Namespace
zh_Hans: 命名空间
llm_description: Namespace
form: llm
- name: pod
type: string
required: False
label:
en_US: Pod name
zh_Hans: Pod名称
human_description:
en_US: Pod name
zh_Hans: Pod名称
llm_description: Pod name
form: llm
- name: startTime
type: number
required: true
label:
en_US: startTime
zh_Hans: startTime
pt_BR: startTime
human_description:
en_US: Data query start time
zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time
llm_description: Data query start time
form: llm
- name: endTime
type: number
required: true
label:
en_US: endTime
zh_Hans: endTime
pt_BR: endTime
human_description:
en_US: Data query end time
zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time
llm_description: Data query start time
form: llm

@ -55,10 +55,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -68,8 +68,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -1,48 +0,0 @@
import json
from collections.abc import Generator
from typing import Any, Optional
import requests
from configs import dify_config
from core.tools.builtin_tool.tool import BuiltinTool
from core.tools.entities.tool_entities import ToolInvokeMessage
from libs.apo_utils import APOUtils
class ContainerCpuThrottlingContainerdSecondsTool(BuiltinTool):
def _invoke(
self,
user_id: str,
tool_parameters: dict[str, Any],
conversation_id: Optional[str] = None,
app_id: Optional[str] = None,
message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]:
cadvisor_job_name = tool_parameters.get('cadvisor_job_name', '.*')
namespace = tool_parameters.get('namespace', '.*')
pod = tool_parameters.get('pod', '.*')
start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("endTime")
params = {
'metricName': '基础设施情况 - 容器CPU - 容器CPU节流时间 - Containerd',
'params': {
'cadvisor_job_name': cadvisor_job_name,
'namespace': namespace,
'pod': pod
},
'startTime': start_time,
'endTime': end_time,
'step': APOUtils.get_step(start_time, end_time),
}
resp = requests.post(dify_config.APO_BACKEND_URL + '/api/metric/query', json=params)
list = resp.json()['result']
list = json.dumps({
'type': 'metric',
'display': True,
'unit': list['unit'],
'data': {
'timeseries': list['timeseries']
}
})
yield self.create_text_message(list)

@ -1,75 +0,0 @@
identity:
name: 容器CPU节流时长(使用Containerd容器运行时,按容器和Pod统计)
author: APO
label:
en_US: Container CPU throttling duration (Containerd runtime, by container and Pod)
zh_Hans: 容器CPU节流时长(使用Containerd容器运行时,按容器和Pod统计)
description:
human:
en_US: Container CPU throttling duration (Containerd runtime, by container and Pod)
zh_Hans: 容器CPU节流时长(使用Containerd容器运行时,按容器和Pod统计)
llm: Container CPU throttling duration (Containerd runtime, by container and Pod)
display:
type: metric
title: 基础设施情况 - 容器CPU - 容器CPU节流时间 - Containerd
unit: "s"
parameters:
- name: cadvisor_job_name
type: string
required: False
label:
en_US: cAdvisor job name
zh_Hans: cAdvisor任务名称
human_description:
en_US: cAdvisor job name
zh_Hans: cAdvisor任务名称
llm_description: cAdvisor job name
form: llm
- name: namespace
type: string
required: False
label:
en_US: Namespace
zh_Hans: 命名空间
human_description:
en_US: Namespace
zh_Hans: 命名空间
llm_description: Namespace
form: llm
- name: pod
type: string
required: False
label:
en_US: Pod name
zh_Hans: Pod名称
human_description:
en_US: Pod name
zh_Hans: Pod名称
llm_description: Pod name
form: llm
- name: startTime
type: number
required: true
label:
en_US: startTime
zh_Hans: startTime
pt_BR: startTime
human_description:
en_US: Data query start time
zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time
llm_description: Data query start time
form: llm
- name: endTime
type: number
required: true
label:
en_US: endTime
zh_Hans: endTime
pt_BR: endTime
human_description:
en_US: Data query end time
zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time
llm_description: Data query start time
form: llm

@ -55,10 +55,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -68,8 +68,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -55,10 +55,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -68,8 +68,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -1,48 +0,0 @@
import json
from collections.abc import Generator
from typing import Any, Optional
import requests
from configs import dify_config
from core.tools.builtin_tool.tool import BuiltinTool
from core.tools.entities.tool_entities import ToolInvokeMessage
from libs.apo_utils import APOUtils
class ContainerCpuUtilizationContainerdTool(BuiltinTool):
def _invoke(
self,
user_id: str,
tool_parameters: dict[str, Any],
conversation_id: Optional[str] = None,
app_id: Optional[str] = None,
message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]:
cadvisor_job_name = tool_parameters.get('cadvisor_job_name', '.*')
namespace = tool_parameters.get('namespace', '.*')
pod = tool_parameters.get('pod', '.*')
start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("endTime")
params = {
'metricName': '基础设施情况 - 容器CPU - 容器CPU使用率 - Containerd',
'params': {
'cadvisor_job_name': cadvisor_job_name,
'namespace': namespace,
'pod': pod
},
'startTime': start_time,
'endTime': end_time,
'step': APOUtils.get_step(start_time, end_time),
}
resp = requests.post(dify_config.APO_BACKEND_URL + '/api/metric/query', json=params)
list = resp.json()['result']
list = json.dumps({
'type': 'metric',
'display': True,
'unit': list['unit'],
'data': {
'timeseries': list['timeseries']
}
})
yield self.create_text_message(list)

@ -1,75 +0,0 @@
identity:
name: 容器CPU使用率(使用Containerd容器运行时,按容器和Pod统计)
author: APO
label:
en_US: Container CPU utilization rate (Containerd runtime, by container and Pod)
zh_Hans: 容器CPU使用率(使用Containerd容器运行时,按容器和Pod统计)
description:
human:
en_US: Container CPU utilization rate (Containerd runtime, by container and Pod)
zh_Hans: 容器CPU使用率(使用Containerd容器运行时,按容器和Pod统计)
llm: Container CPU utilization rate (Containerd runtime, by container and Pod)
display:
type: metric
title: 基础设施情况 - 容器CPU - 容器CPU使用率 - Containerd
unit: "core"
parameters:
- name: cadvisor_job_name
type: string
required: False
label:
en_US: cAdvisor job name
zh_Hans: cAdvisor任务名称
human_description:
en_US: cAdvisor job name
zh_Hans: cAdvisor任务名称
llm_description: cAdvisor job name
form: llm
- name: namespace
type: string
required: False
label:
en_US: Namespace
zh_Hans: 命名空间
human_description:
en_US: Namespace
zh_Hans: 命名空间
llm_description: Namespace
form: llm
- name: pod
type: string
required: False
label:
en_US: Pod name
zh_Hans: Pod名称
human_description:
en_US: Pod name
zh_Hans: Pod名称
llm_description: Pod name
form: llm
- name: startTime
type: number
required: true
label:
en_US: startTime
zh_Hans: startTime
pt_BR: startTime
human_description:
en_US: Data query start time
zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time
llm_description: Data query start time
form: llm
- name: endTime
type: number
required: true
label:
en_US: endTime
zh_Hans: endTime
pt_BR: endTime
human_description:
en_US: Data query end time
zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time
llm_description: Data query start time
form: llm

@ -55,10 +55,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -68,8 +68,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -55,10 +55,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -68,8 +68,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -55,10 +55,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -68,8 +68,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -1,45 +0,0 @@
import json
from collections.abc import Generator
from typing import Any, Optional
import requests
from configs import dify_config
from core.tools.builtin_tool.tool import BuiltinTool
from core.tools.entities.tool_entities import ToolInvokeMessage
from libs.apo_utils import APOUtils
class ContainerDiskTimeTool(BuiltinTool):
def _invoke(
self,
user_id: str,
tool_parameters: dict[str, Any],
conversation_id: Optional[str] = None,
app_id: Optional[str] = None,
message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]:
pod = tool_parameters.get("pod")
namespace = tool_parameters.get("namespace")
start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("endTime")
params = {
'metricName': '基础设施情况 - 容器磁盘 - 读写花费时间 /s - Read',
'params': {
"pod": pod,
"namespace": namespace
},
'startTime': start_time,
'endTime': end_time,
'step': APOUtils.get_step(start_time, end_time),
}
resp = requests.post(dify_config.APO_BACKEND_URL + '/api/metric/query', json=params)
list = resp.json()['result']
list = json.dumps({
'type': 'metric',
'display': True,
'unit': list['unit'],
'data': {
"timeseries": list['timeseries']
}
})
yield self.create_text_message(list)

@ -1,70 +0,0 @@
identity:
name: select_container_cpu
author: APO
label:
en_US: Query the disk read time of the container
zh_Hans: 容器磁盘读取耗时每秒(使用Containerd,按Pod和容器统计)
pt_BR: Query the disk read time of the container
display:
type: metric
title: 基础设施情况 - 容器磁盘 - 读写花费时间 /s - Read
unit: percent(0-100)百分比
description:
human:
en_US: Query the disk read time of the container
zh_Hans: 容器磁盘读取耗时每秒(使用Containerd,按Pod和容器统计)
pt_BR: Query the disk read time of the container
llm: 容器磁盘读取耗时每秒(使用Containerd,按Pod和容器统计)
parameters:
- name: pod
type: string
required: false
label:
en_US: pod
zh_Hans: pod
pt_BR: pod
human_description:
en_US: Specified pod name
zh_Hans: 指定的容器POD名称
pt_BR: Specified pod name
llm_description: Specified pod name
form: llm
- name: namespace
type: string
required: false
label:
en_US: namespace
zh_Hans: namespace
pt_BR: namespace
human_description:
en_US: Specified namespace
zh_Hans: 指定的容器所在Namespace
pt_BR: Specified namespace
llm_description: Specified namespace
form: llm
- name: startTime
type: number
required: true
label:
en_US: startTime
zh_Hans: startTime
pt_BR: startTime
human_description:
en_US: Data query start time
zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time
llm_description: Data query start time
form: llm
- name: endTime
type: number
required: true
label:
en_US: endTime
zh_Hans: endTime
pt_BR: endTime
human_description:
en_US: Data query end time
zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time
llm_description: Data query start time
form: llm

@ -55,10 +55,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -68,8 +68,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -55,10 +55,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -68,8 +68,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -55,10 +55,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -68,8 +68,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -55,10 +55,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -68,8 +68,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -55,10 +55,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -68,8 +68,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -1,45 +0,0 @@
import json
from collections.abc import Generator
from typing import Any, Optional
import requests
from configs import dify_config
from core.tools.builtin_tool.tool import BuiltinTool
from core.tools.entities.tool_entities import ToolInvokeMessage
from libs.apo_utils import APOUtils
class SelectContainerRSSTool(BuiltinTool):
def _invoke(
self,
user_id: str,
tool_parameters: dict[str, Any],
conversation_id: Optional[str] = None,
app_id: Optional[str] = None,
message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]:
pod = tool_parameters.get("pod")
namespace = tool_parameters.get("namespace")
start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("endTime")
params = {
'metricName': '基础设施情况 - 容器内存 - 容器内存使用率 - Containerd',
'params': {
"pod": pod,
"namespace": namespace
},
'startTime': start_time,
'endTime': end_time,
'step': APOUtils.get_step(start_time, end_time),
}
resp = requests.post(dify_config.APO_BACKEND_URL + '/api/metric/query', json=params)
list = resp.json()['result']
list = json.dumps({
'type': 'metric',
'display': True,
'unit': list['unit'],
'data': {
"timeseries": list['timeseries']
}
})
yield self.create_text_message(list)

@ -1,70 +0,0 @@
identity:
name: 查询容器内存使用量
author: APO
label:
en_US: Query container memory usage (Containerd)
zh_Hans: 容器内存使用字节数(使用Containerd容器运行时,按容器和Pod统计)
pt_BR: Query container memory usage
description:
human:
en_US: Query container memory usage (Containerd)
zh_Hans: 容器内存使用字节数(使用Containerd容器运行时,按容器和Pod统计)
pt_BR: Query container memory usage (Containerd)
llm: 容器内存使用字节数(使用Containerd容器运行时,按容器和Pod统计)
display:
type: metric
title: 基础设施情况 - 容器内存 - 容器内存使用率 - Containerd
unit: bytes 字节
parameters:
- name: pod
type: string
required: false
label:
en_US: pod
zh_Hans: pod
pt_BR: pod
human_description:
en_US: Specified pod name
zh_Hans: 指定的容器POD名称
pt_BR: Specified pod name
llm_description: Specified pod name
form: llm
- name: namespace
type: string
required: false
label:
en_US: namespace
zh_Hans: namespace
pt_BR: namespace
human_description:
en_US: Specified namespace
zh_Hans: 指定的容器所在Namespace
pt_BR: Specified namespace
llm_description: Specified namespace
form: llm
- name: startTime
type: number
required: true
label:
en_US: startTime
zh_Hans: startTime
pt_BR: startTime
human_description:
en_US: Data query start time
zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time
llm_description: Data query start time
form: llm
- name: endTime
type: number
required: true
label:
en_US: endTime
zh_Hans: endTime
pt_BR: endTime
human_description:
en_US: Data query end time
zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time
llm_description: Data query start time
form: llm

@ -50,10 +50,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -63,8 +63,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -30,7 +30,12 @@ class FaultLogTool(BuiltinTool):
} }
url = dify_config.APO_BACKEND_URL + "/api/log/fault/pagelist" url = dify_config.APO_BACKEND_URL + "/api/log/fault/pagelist"
resp = requests.post(url, json=params) resp = requests.post(url, json=params)
list = resp.json()['list'][0] log_list = resp.json().get('list', [])
list = []
if not log_list:
yield self.create_text_message('')
else:
list = log_list[0]
content_url = dify_config.APO_BACKEND_URL + "/api/log/fault/content" content_url = dify_config.APO_BACKEND_URL + "/api/log/fault/content"
content = requests.post(content_url, json=list).json() content = requests.post(content_url, json=list).json()

@ -37,10 +37,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -50,8 +50,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -50,10 +50,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -63,8 +63,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -13,7 +13,7 @@ description:
llm: Query host's CPU cores usage llm: Query host's CPU cores usage
display: display:
type: metric type: metric
title: 宿主机监控指标 - Quick CPU / Mem / Disk - CPU Cores title: 宿主机监控指标 - Basic CPU / Mem / Net / Disk - CPU Basic - CPU Usage
unit: core unit: core
parameters: parameters:
- name: job - name: job
@ -50,10 +50,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -63,8 +63,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -37,10 +37,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -50,8 +50,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -50,10 +50,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -63,8 +63,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -37,10 +37,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -50,8 +50,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -37,10 +37,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -50,8 +50,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -37,10 +37,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -50,8 +50,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -37,10 +37,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -50,8 +50,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -37,10 +37,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -50,8 +50,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -37,10 +37,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -50,8 +50,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -50,10 +50,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -63,8 +63,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -1,9 +1,9 @@
identity: identity:
name: 查询宿主机CPU压力 name: 查询宿主机内存压力
author: APO author: APO
label: label:
en_US: Query host's memory pressure en_US: Query host's memory pressure
zh_Hans: 查询宿主机CPU压力 zh_Hans: 查询宿主机内存压力
pt_BR: Query host's memory pressure pt_BR: Query host's memory pressure
description: description:
human: human:
@ -50,10 +50,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -63,8 +63,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -37,10 +37,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -50,8 +50,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -50,10 +50,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -63,8 +63,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -50,10 +50,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -63,8 +63,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -50,10 +50,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -63,8 +63,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -50,10 +50,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -63,8 +63,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -50,10 +50,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -63,8 +63,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -50,10 +50,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -63,8 +63,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -50,10 +50,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -63,8 +63,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -50,10 +50,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -63,8 +63,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm

@ -50,10 +50,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -63,8 +63,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -33,10 +33,10 @@ parameters:
zh_Hans: startTime zh_Hans: startTime
pt_BR: startTime pt_BR: startTime
human_description: human_description:
en_US: Data query start time en_US: Data query start time(Microsecond)
zh_Hans: 开始时间 (微秒) zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time pt_BR: Data query start time(Microsecond)
llm_description: Data query start time llm_description: Data query start time(Microsecond)
form: llm form: llm
- name: endTime - name: endTime
type: number type: number
@ -46,8 +46,8 @@ parameters:
zh_Hans: endTime zh_Hans: endTime
pt_BR: endTime pt_BR: endTime
human_description: human_description:
en_US: Data query end time en_US: Data query end time(Microsecond)
zh_Hans: 结束时间 (微秒) zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time pt_BR: Data query end time(Microsecond)
llm_description: Data query start time llm_description: Data query end time(Microsecond)
form: llm form: llm

@ -1,44 +0,0 @@
import json
from collections.abc import Generator
from typing import Any, Optional
import requests
from configs import dify_config
from core.tools.builtin_tool.tool import BuiltinTool
from core.tools.entities.tool_entities import ToolInvokeMessage
from libs.apo_utils import APOUtils
class LinuxNetworkDroppedPacketsTransmitTool(BuiltinTool):
def _invoke(
self,
user_id: str,
tool_parameters: dict[str, Any],
conversation_id: Optional[str] = None,
app_id: Optional[str] = None,
message_id: Optional[str] = None,
) -> Generator[ToolInvokeMessage, None, None]:
cluster = tool_parameters.get('cluster', '.*')
start_time = tool_parameters.get("startTime")
end_time = tool_parameters.get("endTime")
params = {
'metricName': '集群总览 - 总览 - 网络饱和 - 丢包数 - Linux Packets dropped (transmit)',
'params': {
'cluster': cluster
},
'startTime': start_time,
'endTime': end_time,
'step': APOUtils.get_step(start_time, end_time),
}
resp = requests.post(dify_config.APO_BACKEND_URL + '/api/metric/query', json=params)
list = resp.json()['result']
list = json.dumps({
'type': 'metric',
'display': True,
'unit': list['unit'],
'data': {
'timeseries': list['timeseries']
}
})
yield self.create_text_message(list)

@ -1,53 +0,0 @@
identity:
name: Linux集群网络发送丢包数
author: APO
label:
en_US: Linux cluster network transmit packet drops
zh_Hans: Linux集群网络发送丢包数
description:
human:
en_US: Linux cluster network transmit packet drops
zh_Hans: Linux集群网络发送丢包数
llm: Linux cluster network transmit packet drops
display:
type: metric
title: 集群总览 - 总览 - 网络饱和 - 丢包数 - Linux Packets dropped (transmit)
unit: "short"
parameters:
- name: cluster
type: string
required: False
label:
en_US: Cluster name
zh_Hans: 集群名称
human_description:
en_US: Cluster name
zh_Hans: 集群名称
llm_description: Cluster name
form: llm
- name: startTime
type: number
required: true
label:
en_US: startTime
zh_Hans: startTime
pt_BR: startTime
human_description:
en_US: Data query start time
zh_Hans: 开始时间 (微秒)
pt_BR: Data query start time
llm_description: Data query start time
form: llm
- name: endTime
type: number
required: true
label:
en_US: endTime
zh_Hans: endTime
pt_BR: endTime
human_description:
en_US: Data query end time
zh_Hans: 结束时间 (微秒)
pt_BR: Data query end time
llm_description: Data query start time
form: llm

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save