43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
"""Service-specific monitoring agents."""
|
||
|
||
from langgraph.prebuilt import create_react_agent
|
||
from custom_tools import get_shell_tool, LogTailTool
|
||
|
||
|
||
def create_mariadb_worker():
|
||
"""Create MariaDB analysis agent."""
|
||
return create_react_agent(
|
||
model="openai:gpt-4o-mini",
|
||
tools=[get_shell_tool(), LogTailTool()],
|
||
prompt="""
|
||
You are a MariaDB expert. Check config files in /etc/mysql and inspect `/var/log/mysql/*.log` for errors.
|
||
Use `mysqladmin status` and other read‑only commands. Use the `tail_log` tool for logs.
|
||
""",
|
||
name="mariadb_analyzer"
|
||
)
|
||
|
||
|
||
def create_nginx_worker():
|
||
"""Create Nginx analysis agent."""
|
||
return create_react_agent(
|
||
model="openai:gpt-4o-mini",
|
||
tools=[get_shell_tool(), LogTailTool()],
|
||
prompt="""
|
||
You are an Nginx expert. Validate configuration with `nginx -t` and inspect access/error logs.
|
||
Use the `tail_log` tool for `/var/log/nginx/error.log`.
|
||
""",
|
||
name="nginx_analyzer"
|
||
)
|
||
|
||
|
||
def create_phpfpm_worker():
|
||
"""Create PHP-FPM analysis agent."""
|
||
return create_react_agent(
|
||
model="openai:gpt-4o-mini",
|
||
tools=[get_shell_tool(), LogTailTool()],
|
||
prompt="""
|
||
You are a PHP‑FPM expert. Check `systemctl status php*-fpm` and look for memory leaks or timeouts in the logs.
|
||
""",
|
||
name="phpfpm_analyzer"
|
||
)
|