Search Alerts tool
출처: 문서
본문
검색 알림 도구
도입됨 2.13 {: .label .label-purple }
SearchAlertsTool은 생성된 알림에 대한 정보를 검색해요. 알림에 대한 자세한 내용은 Alerting을 참조하세요.
1단계: SearchAlertsTool을 실행할 플로우 에이전트 등록하기
플로우 에이전트는 도구들을 순서대로 실행하고 마지막 도구의 출력을 반환해요. 플로우 에이전트를 생성하려면 다음 등록 에이전트 요청을 보내세요.
POST /_plugins/_ml/agents/_register
{
"name": "Test_Agent_For_Search_Alerts_Tool",
"type": "flow",
"description": "this is a test agent for the SearchAlertsTool",
"memory": {
"type": "demo"
},
"tools": [
{
"type": "SearchAlertsTool",
"name": "DemoSearchAlertsTool",
"parameters": {}
}
]
}
{% include copy-curl.html %}
매개변수 설명은 등록 매개변수를 참조하세요.
OpenSearch가 에이전트 ID로 응답해요.
{
"agent_id": "EuJYYo0B9RaBCvhuy1q8"
}
2단계: 에이전트 실행하기
다음 요청을 보내서 에이전트를 실행하세요.
POST /_plugins/_ml/agents/EuJYYo0B9RaBCvhuy1q8/_execute
{
"parameters": {
"question": "Do I have any alerts?"
}
}
{% include copy-curl.html %}
OpenSearch가 생성된 알림 목록과 총 알림 개수를 반환해요.
{
"inference_results": [
{
"output": [
{
"name": "response",
"result": "Alerts=[Alert(id=rv9nYo0Bk4MTqirc_DkW, version=394, schemaVersion=5, monitorId=ZuJnYo0B9RaBCvhuEVux, workflowId=, workflowName=, monitorName=test-monitor-2, monitorVersion=1, monitorUser=User[name=admin, backend_roles=[admin], roles=[own_index, all_access], custom_attribute_names=[], user_requested_tenant=null], triggerId=ZeJnYo0B9RaBCvhuEVul, triggerName=t-1, findingIds=[], relatedDocIds=[], state=ACTIVE, startTime=2024-02-01T02:03:18.420Z, endTime=null, lastNotificationTime=2024-02-01T08:36:18.409Z, acknowledgedTime=null, errorMessage=null, errorHistory=[], severity=1, actionExecutionResults=[], aggregationResultBucket=null, executionId=ZuJnYo0B9RaBCvhuEVux_2024-02-01T02:03:18.404853331_51c18f2c-5923-47c3-b476-0f5a66c6319b, associatedAlertIds=[])]TotalAlerts=1"
}
]
}
]
}
알림이 없으면 OpenSearch는 결과에 빈 배열을 반환해요.
{
"inference_results": [
{
"output": [
{
"name": "response",
"result": "Alerts=[]TotalAlerts=0"
}
]
}
]
}
등록 매개변수
다음 표는 에이전트 등록 시 사용할 수 있는 모든 도구 매개변수를 보여줘요. 모든 매개변수는 선택 사항이에요.
| 매개변수 | 유형 | 설명 |
|---|---|---|
alertIds |
Array | 검색할 알림의 ID예요. |
alertIndex |
String | 검색할 알림 인덱스의 이름이에요(기본값은 null). |
monitorId |
String | 알림을 필터링할 모니터의 ID예요. |
monitorIds |
Array | 알림을 필터링할 모니터 ID 목록이에요. |
workflowIds |
Array | 알림을 필터링할 워크플로우 ID 목록이에요. |
alertState |
String | 알림을 필터링할 알림 상태예요. 유효한 값은 ALL, ACTIVE, ERROR, COMPLETED, ACKNOWLEDGED예요. 기본값은 ALL이에요. |
severityLevel |
String | 알림을 필터링할 심각도 수준이에요. 유효한 값은 ALL, 1, 2, 3이에요. 기본값은 ALL이에요. |
searchString |
String | 특정 알림을 검색할 때 사용할 검색 문자열이에요. |
sortOrder |
String | 결과의 정렬 순서예요. 유효한 값은 asc(오름차순)와 desc(내림차순)예요. 기본값은 asc예요. |
sortString |
String | 결과를 정렬할 모니터 필드를 지정해요. 기본값은 monitor_name.keyword예요. |
size |
Integer | 반환할 결과 개수예요. 기본값은 20이에요. |
startIndex |
Integer | 시작할 알림의 페이지 인덱스예요. 기본값은 0이에요. |
실행 매개변수
다음 표는 에이전트 실행 시 사용할 수 있는 모든 도구 매개변수를 보여줘요.
| 매개변수 | 유형 | 필수/선택 | 설명 |
|---|---|---|---|
question |
String | 필수 | LLM에 보낼 자연어 질문이에요. |
도구 테스트하기
이 도구는 에이전트 워크플로우의 일부로 실행하거나 Execute Tool API를 사용하여 독립적으로 실행할 수 있어요. Execute Tool API는 개별 도구를 테스트하거나 독립적인 작업을 수행할 때 유용해요.