Skip to main content
Glama

ssh_service_status

Check the operational status of specified services on a remote server to monitor system health and availability.

Instructions

Check status of services on remote server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serverYesServer name
servicesYesService names to check (e.g., nginx, mysql, docker)

Implementation Reference

  • 'ssh_service_status' is registered in the monitoring tool group, used for conditional tool enablement based on user configuration.
    monitoring: [ 'ssh_health_check', 'ssh_service_status', 'ssh_process_manager', 'ssh_monitor', 'ssh_tail', 'ssh_alert_setup' ],
  • Helper function to build shell command for checking service status, supporting both systemd and legacy sysv init systems.
    export function buildServiceStatusCommand(serviceName) { // Try systemd first, fallback to sysv return ` if command -v systemctl >/dev/null 2>&1; then systemctl is-active ${serviceName} 2>/dev/null >/dev/null && echo "ACTIVE" || echo "INACTIVE" systemctl is-enabled ${serviceName} 2>/dev/null >/dev/null && echo "ENABLED" || echo "DISABLED" systemctl status ${serviceName} 2>/dev/null | grep "Main PID" | awk '{print $3}' | cut -d'(' -f1 systemctl status ${serviceName} 2>/dev/null | grep "Active:" | sed 's/.*Active: //' | awk '{print $1,$2,$3}' elif command -v service >/dev/null 2>&1; then service ${serviceName} status >/dev/null 2>&1 && echo "ACTIVE" || echo "INACTIVE" echo "UNKNOWN" pgrep -f ${serviceName} | head -1 || echo "" echo "sysv" else echo "UNKNOWN" echo "UNKNOWN" echo "" echo "no-init-system" fi `.trim(); }
  • Helper function to parse service status command output into structured data including status, enabled state, PID, and health assessment.
    export function parseServiceStatus(output, serviceName) { const lines = output.trim().split('\n'); const [status, enabled, pid, details] = lines; return { name: serviceName, status: status === 'ACTIVE' ? 'running' : 'stopped', enabled: enabled === 'ENABLED' ? 'yes' : enabled === 'DISABLED' ? 'no' : 'unknown', pid: pid && pid !== '' ? parseInt(pid) : null, details: details || 'unknown', health: status === 'ACTIVE' ? HEALTH_STATUS.HEALTHY : HEALTH_STATUS.CRITICAL }; }

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/bvisible/mcp-ssh-manager'

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