Skip to main content

Overview

The Service Management endpoints allow you to monitor service health, list configured services, add new services to monitoring, and remove services from the configuration.

Get Service Status

curl http://localhost:8000/status
Retrieves the current status of all monitored services by executing health check commands via SSH. Endpoint: GET /status

Response

Returns an object where each key is a service name and the value contains status information:
[service_name]
object
Status information for each monitored service
status
string
Service status: "running", "stopped", or "error"
details
string
Additional details about the service state. For running services, typically “Service is active”. For stopped or error states, contains diagnostic information.
type
string
Service type (e.g., "systemd", "docker", "custom")

Example Response

{
  "nginx": {
    "status": "running",
    "details": "Service is active",
    "type": "systemd"
  },
  "postgresql": {
    "status": "stopped",
    "details": "inactive (dead)",
    "type": "systemd"
  },
  "redis": {
    "status": "running",
    "details": "Service is active",
    "type": "docker"
  }
}
If SSH connection fails, all services will be marked as "error" with details indicating SSH unavailability.

List Services

curl http://localhost:8000/services
Retrieves the configuration for all monitored services, including check commands and running indicators. Endpoint: GET /services

Response

Returns an object with service configurations:
[service_name]
object
Configuration for each service
check_command
string
Shell command executed to check service status
running_indicator
string
String pattern that indicates the service is running (searched in command output)
type
string
Service type classification

Example Response

{
  "nginx": {
    "check_command": "systemctl status nginx",
    "running_indicator": "active (running)",
    "type": "systemd"
  },
  "postgresql": {
    "check_command": "systemctl status postgresql",
    "running_indicator": "active (running)",
    "type": "systemd"
  },
  "myapp": {
    "check_command": "docker ps --filter name=myapp",
    "running_indicator": "Up",
    "type": "docker"
  }
}

Add Service

curl -X POST http://localhost:8000/services \
  -H "Content-Type: application/json" \
  -d '{
    "name": "mongodb",
    "check_command": "systemctl status mongodb",
    "running_indicator": "active (running)",
    "type": "systemd"
  }'
Adds a new service to the monitoring configuration. Endpoint: POST /services

Request Body

name
string
required
Unique name identifier for the service
check_command
string
required
Shell command to execute for checking service status. This command will be run via SSH on the monitored host.
running_indicator
string
required
String pattern that should appear in the command output when the service is running. The service is considered running if this string is found in the output.
type
string
default:"custom"
Service type classification (e.g., "systemd", "docker", "custom"). This is used for categorization and reporting.

Response

status
string
Operation status - will be “ok”
message
string
Confirmation message with the service name
{
  "status": "ok",
  "message": "Service mongodb added"
}
The service will be immediately available for monitoring and will be included in subsequent /status calls.

Delete Service

curl -X DELETE http://localhost:8000/services/mongodb
Removes a service from the monitoring configuration. Endpoint: DELETE /services/{name}

Path Parameters

name
string
required
The name of the service to remove

Response

status
string
Operation status - will be “ok”
message
string
Confirmation message with the service name
{
  "status": "ok",
  "message": "Service mongodb removed"
}

Error Responses

404 Not Found - Service does not exist:
{
  "detail": "Service not found"
}
Removing a service from monitoring does not stop or affect the actual service - it only removes it from Sentinel AI’s monitoring configuration.

Service Types

Sentinel AI supports monitoring various service types. Common configurations:

Systemd Services

{
  "name": "nginx",
  "check_command": "systemctl status nginx",
  "running_indicator": "active (running)",
  "type": "systemd"
}

Docker Containers

{
  "name": "webapp",
  "check_command": "docker ps --filter name=webapp",
  "running_indicator": "Up",
  "type": "docker"
}

Custom Services

{
  "name": "custom-app",
  "check_command": "ps aux | grep custom-app",
  "running_indicator": "custom-app --daemon",
  "type": "custom"
}
The check_command is executed via SSH on the monitored host. Ensure the SSH user has appropriate permissions to run these commands.

Build docs developers (and LLMs) love