# Status & Monitoring

**Page:** api/daemon/monitoring

[Download Raw Markdown](./api/daemon/monitoring.md)

---

{/* AUTO-GENERATED — Do not edit manually. Regenerate with: npm run docs:api:generate */}



## Status & Monitoring

Use these endpoints to check the daemon's health, retrieve runtime status for individual programs or the full program set, and fetch recent log output for debugging.

---

## Health check

### `GET /api/v1/daemon/health`

Returns the standardized 9-field health response. Unauthenticated. Always returns HTTP `200` with `Content-Type: application/json` when the service is up.

This endpoint takes no parameters.



```bash
curl -X GET https://daemon.hoody.com/api/v1/daemon/health
```


```typescript
const health = await client.daemon.health.check();
```


```json
{
  "status": "ok",
  "service": "hoody-daemon",
  "built": "2025-01-15T10:30:00Z",
  "started": "2025-01-20T08:00:00Z",
  "memory": {
    "rss": 12582912,
    "heap": null
  },
  "fds": 42,
  "pid": 1234,
  "ip": "192.168.1.100",
  "userAgent": "hoody-cli/1.0.0"
}
```



---

## Program status

### `GET /api/v1/daemon/status`

Retrieves the current runtime status of all configured programs. Returns information about whether each program is running, stopped, or in another state, along with process details for running programs.

This endpoint takes no parameters.



```bash
curl -X GET https://daemon.hoody.com/api/v1/daemon/status
```


```typescript
const allStatus = await client.daemon.status.getAll();
```


```json
{
  "success": true,
  "statuses": [
    {
      "id": 1,
      "name": "web-server",
      "enabled": true,
      "status": {
        "id": 1,
        "status": "RUNNING",
        "pid": 1234,
        "uptime": "2:15:30"
      }
    },
    {
      "id": 2,
      "name": "nodejs-app",
      "enabled": false,
      "status": {
        "id": 2,
        "status": "STOPPED"
      }
    }
  ]
}
```


```json
{
  "success": true,
  "statuses": [
    {
      "id": 1,
      "name": "web-server",
      "enabled": true,
      "status": {
        "id": 1,
        "status": "RUNNING",
        "pid": 1234,
        "uptime": "0:05:12"
      }
    },
    {
      "id": 2,
      "name": "api-service",
      "enabled": true,
      "status": {
        "id": 2,
        "status": "RUNNING",
        "pid": 1235,
        "uptime": "0:04:58"
      }
    }
  ]
}
```



### `GET /api/v1/daemon/status/{id}`

Retrieves the current runtime status of a specific program by ID. For port-range programs, returns all running instances unless a specific port is requested via query parameter. Returns detailed process information including PID and uptime.

#### Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `id` | path | integer | Yes | Unique numeric identifier of the program |
| `port` | query | integer | No | Filter to specific port instance (for port-range programs only) |
| `include_stats` | query | string | No | Include resource stats (CPU, memory, process tree) for running programs. Adds a `stats` field with `pid`, `started_at`, `cpu_percent`, `memory_rss_bytes`, `process_count`, and per-process breakdown. Allowed values: `"true"`, `"false"`. |



```bash
curl -X GET "https://daemon.hoody.com/api/v1/daemon/status/1?port=8080&include_stats=true"
```


```typescript
const status = await client.daemon.status.get({
  id: 1,
  port: 8080,
  include_stats: "true",
});
```


```json
{
  "success": true,
  "status": {
    "id": 1,
    "status": "RUNNING",
    "pid": 1234,
    "uptime": "2:15:30"
  }
}
```


```json
{
  "success": true,
  "status": {
    "id": 2,
    "status": "STOPPED"
  }
}
```


```json
{
  "success": true,
  "status": {
    "id": 3,
    "status": "FATAL"
  }
}
```


```json
{
  "success": false,
  "error": "Program with ID 999 not found"
}
```



---

## Program logs

### `GET /api/v1/daemon/programs/{id}/logs`

Retrieve the last N lines from a program's stdout or stderr log file.

#### Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `id` | path | integer | Yes | Program ID |
| `type` | query | string | No | Log stream: `stdout` or `stderr`. Default: `"stdout"`. |
| `lines` | query | integer | No | Number of lines to return from end of file. Default: `100`. |
| `port` | query | integer | No | Port number (required for port-range programs) |



```bash
curl -X GET "https://daemon.hoody.com/api/v1/daemon/programs/1/logs?type=stdout&lines=50&port=8080"
```


```typescript
const logs = await client.daemon.status.getLogs({
  id: 1,
  type: "stdout",
  lines: 50,
  port: 8080,
});
```


```json
{
  "success": true,
  "logs": "[2025-01-20T10:00:00Z] Server started on port 8080\n[2025-01-20T10:00:01Z] Listening for connections\n",
  "type": "stdout",
  "lines": 2,
  "log_file": "/var/log/hoody/web-server.out.log"
}
```


```json
{
  "success": false,
  "error": "Invalid type parameter: must be 'stdout' or 'stderr'"
}
```




The `status` field in program status responses can be one of: `RUNNING`, `STOPPED`, `STARTING`, `STOPPING`, `BACKOFF`, or `FATAL`. The `pid` and `uptime` fields are only populated when the program is in a running state.