# Monitoring contracts and operational integration

ipsonic-probe keeps checks small and readable. No daemon, database or additional runtime dependencies are needed.

## Ownership and runbooks

Add optional metadata to a YAML check:

```yaml
metadata:
  owner: application-operations
  environment: production
  description: Verify the local SSH TCP listener
  runbook: https://docs.example.org/runbooks/ssh
  tags:
    - infrastructure
    - ssh
```

For non-OK check results, the Nagios, Icinga 2 and Checkmk output includes owner, environment and runbook in the human-readable status message. JSON includes the `metadata` object. Metadata is informational, not executed.

## Secret-safe offline configuration diff

```sh
python3 ipsonic-probe.py --diff checks/old.yaml checks/new.yaml
```

Exit status: `0` unchanged, `1` changes detected, `3` invalid input. Values of secret-like fields are masked. **Do not treat diff output as a secret-scanning security boundary**: custom field names or unexpected sensitive values may need additional protection.

## Baseline: stable result-state comparison

```sh
python3 ipsonic-probe.py checks/ssh.yaml --baseline-save ssh-baseline.json
python3 ipsonic-probe.py checks/ssh.yaml --baseline-compare ssh-baseline.json
```

Baseline files are created with mode 0600 and cannot be overwritten implicitly. Saving requires an OK result. Comparison returns `0` for unchanged, `2` for a changed result and `3` for invalid or missing baselines. The current baseline captures the status, exit code and stable assertion IDs. It **does not yet compare actual DNS answer sets, TLS certificate fingerprints or HTTP headers**. This intentionally limited baseline avoids saving HTTP bodies, headers, tokens or other sensitive payloads.

## Monitoring output contracts

| Output | Contract |
| --- | --- |
| `nagios` | `STATUS - service: details \| response_time=...` |
| `icinga2` | Same plugin-line contract as Nagios |
| `checkmk` | `state "service" perfdata details` local check format |
| `json` | One JSON object per check, including `status`, `code`, `failures`, `assertion_results`, `metadata` |
| `text` | Human-readable check result |

Exit codes: 0 OK, 1 WARNING, 2 CRITICAL, 3 UNKNOWN. The overall exit code for multiple checks is the highest observed code. Runbook metadata appears only when a check is non-OK.

## Release manifest

`tools/build-release.sh VERSION` creates a deterministic source archive, its `.sha256` file and a `.manifest.json` file containing the version, artifact filename, SHA-256 digest and reproducible build metadata. The website download directory receives these files when the site is regenerated.
