Skip to main content

Custom Services

Sentinel AI can monitor any service that provides a status command. This guide shows you how to add custom services to the monitoring system.

Service Configuration Schema

Each service requires four properties:
name
string
required
Unique identifier for the service
check_command
string
required
Shell command to check service status (e.g., service nginx status)
running_indicator
string
required
String to look for in the output to confirm service is running (e.g., "is running")
type
string
required
Service category: web_server, database, container, custom

Adding Services Programmatically

From src/core/config.py:74:
src/core/config.py
def add_service(self, name, check_cmd, indicator, service_type):
    self.SERVICES[name] = {
        "check_command": check_cmd,
        "running_indicator": indicator,
        "type": service_type
    }
    self.save_services()

Example: Add Docker Service

from src.core.config import config

config.add_service(
    name="docker",
    check_cmd="systemctl status docker",
    indicator="active (running)",
    service_type="container"
)

Adding Services via API

Use the POST /services endpoint:
curl -X POST http://localhost:8000/services \
  -H "Content-Type: application/json" \
  -d '{
    "name": "redis",
    "check_command": "systemctl status redis",
    "running_indicator": "active (running)",
    "type": "database"
  }'

Common Service Examples

Redis

In-memory data store

MongoDB

NoSQL document database

Apache

Web server

Memcached

Distributed caching

Redis

{
  "name": "redis",
  "check_command": "systemctl status redis",
  "running_indicator": "active (running)",
  "type": "database"
}

MongoDB

{
  "name": "mongodb",
  "check_command": "systemctl status mongod",
  "running_indicator": "active (running)",
  "type": "database"
}

Apache

{
  "name": "apache",
  "check_command": "systemctl status apache2",
  "running_indicator": "active (running)",
  "type": "web_server"
}

Docker Containers

{
  "name": "my-app",
  "check_command": "docker ps | grep my-app",
  "running_indicator": "Up",
  "type": "container"
}

Custom Applications

{
  "name": "myapp",
  "check_command": "pgrep -f myapp.py",
  "running_indicator": "[0-9]",
  "type": "custom"
}

Service Configuration File

Services are stored in data/services.json. From src/core/config.py:60:
src/core/config.py
def load_services(self):
    if os.path.exists(self.SERVICES_FILE):
        try:
            with open(self.SERVICES_FILE, "r") as f:
                return json.load(f)
        except Exception:
            return self.DEFAULT_SERVICES.copy()
    return self.DEFAULT_SERVICES.copy()

Example Configuration

data/services.json
{
  "nginx": {
    "check_command": "service nginx status",
    "running_indicator": "is running",
    "type": "web_server"
  },
  "postgresql": {
    "check_command": "service postgresql status",
    "running_indicator": "online",
    "type": "database"
  },
  "redis": {
    "check_command": "systemctl status redis",
    "running_indicator": "active (running)",
    "type": "database"
  }
}

Removing Services

Via API

curl -X DELETE http://localhost:8000/services/redis

Programmatically

from src.core.config import config

config.remove_service("redis")

Best Practices

Use Systemd

Prefer systemctl status for better reliability

Test Commands

Always test check commands on the target server first

Unique Indicators

Choose indicators that won’t match error states

Service Types

Use appropriate types for dashboard grouping
The agent checks services every 30 seconds by default. Configure MONITOR_INTERVAL in your environment to change this.
Ensure the SSH user has permission to run status commands without requiring additional authentication.

Testing Service Configuration

Test your service configuration manually:
# SSH into your server
ssh sentinel@your-server

# Run the check command
systemctl status redis

# Verify the running indicator appears in the output

Service Configuration

Learn about service configuration

Services API

Explore the services API

Monitoring

How service monitoring works

SSH Setup

Configure SSH access

Build docs developers (and LLMs) love