Skip to main content
Glama

get_system_load

Retrieve system load metrics by connecting to a remote server using SSH credentials, enabling real-time monitoring and performance analysis.

Instructions

获取系统负载信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostnameYes
passwordNo
portNo
timeoutNo
usernameYes

Implementation Reference

  • Handler function that connects via SSH to the remote server and runs 'uptime' command to retrieve system load average.
    def get_system_load( hostname: str, username: str, password: str = "", port: int = 22, timeout: int = 30 ) -> dict: """获取系统负载信息""" try: with SSHManager(hostname, username, password, port, timeout) as ssh: stdin, stdout, stderr = ssh.exec_command("uptime") load_output = stdout.read().decode().strip() load_avg = re.search(r'load average: (.*)', load_output) return {"status": "success", "load_average": load_avg.group(1) if load_avg else "unknown"} except Exception as e: return {"status": "error", "error": str(e)}
  • Identical handler function in the SSE variant, connects via SSH to remote server and runs 'uptime' to get load average.
    def get_system_load( hostname: str, username: str, password: str = "", port: int = 22, timeout: int = 30 ) -> dict: """获取系统负载信息""" try: with SSHManager(hostname, username, password, port, timeout) as ssh: stdin, stdout, stderr = ssh.exec_command("uptime") load_output = stdout.read().decode().strip() load_avg = re.search(r'load average: (.*)', load_output) return {"status": "success", "load_average": load_avg.group(1) if load_avg else "unknown"} except Exception as e: return {"status": "error", "error": str(e)}
  • Tool schema definition including name, description, and parameter specifications for input validation.
    {"name": "get_system_load", "description": "获取系统负载信息", "parameters": [ {"name": "hostname", "type": "str", "default": None}, {"name": "username", "type": "str", "default": None}, {"name": "password", "type": "str", "default": ""}, {"name": "port", "type": "int", "default": 22}, {"name": "timeout", "type": "int", "default": 30} ]},
  • Registration of the get_system_load tool function into the MCP server instance via tools_dict and dynamic @mcp.tool() decorator.
    tools_dict = { 'get_memory_info': get_memory_info, 'remote_server_inspection': remote_server_inspection, 'get_system_load': get_system_load, 'monitor_processes': monitor_processes, 'check_service_status': check_service_status, 'get_os_details': get_os_details, 'check_ssh_risk_logins': check_ssh_risk_logins, 'check_firewall_config': check_firewall_config, 'security_vulnerability_scan': security_vulnerability_scan, 'backup_critical_files': backup_critical_files, 'inspect_network': inspect_network, 'analyze_logs': analyze_logs, 'list_docker_containers': list_docker_containers, 'list_docker_images': list_docker_images, 'list_docker_volumes': list_docker_volumes, 'get_container_logs': get_container_logs, 'monitor_container_stats': monitor_container_stats, 'check_docker_health': check_docker_health } # 使用装饰器动态注册所有工具 for name, func in tools_dict.items(): mcp.tool()(func)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Heht571/ops-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server