# Complete user and operator guide

This is the central documentation for **ipsonic-probe**. It covers installation, every CLI action, monitoring behavior, operational workflows, security, releases, and links to the annotated YAML examples. All examples are intended for Linux/POSIX-style deployments using distribution packages; no pip, daemon, database, or cloud service is required.

## AWX and credential management

For AWX / Ansible Automation Controller Job Templates, Machine credentials, encrypted Ansible Vault files, custom environment-injected API credentials, and secure `no_log` execution, see [AWX Tutorial](awx-tutorial.html). Example playbooks and a strict-validating API check are in `ansible/`.

## Documentation map

| Topic | Detailed guide |
| --- | --- |
| Download, package verification, first TCP check | [First Test](first-test.html) |
| AWX / Ansible Automation Controller | [AWX Tutorial](awx-tutorial.html) |
| Installation and native OS packages | [README](index.html), [Ansible Installation](ansible-installation.html), [Raspberry Pi OS](raspberry-pi.html) |
| YAML configuration and monitoring features | [README](index.html), [Examples](examples/index.html) |
| Design, alerting and deployment principles | [Best Practices](best-practices.html) |
| CLI inventory, dry run, directory execution, TSV | [Operator Workflow](operator-workflow.html) |
| Self-test, strict validation, secret safety, timeouts | [Production Hardening](production-hardening.html) |
| Owner, runbook, diff, baseline, output formats | [Monitoring Contracts](monitoring-contracts.html) |
| Application acceptance and lifecycle | [Web Project Acceptance](web-project-acceptance.html) |
| Exchange checks | [Exchange Monitoring](exchange-monitoring.html) |
| All example configurations and explanations | [Example Catalog](examples/index.html) |

## Direct installation without extracting an archive

Download the latest standalone `ipsonic-probe-latest.py`, verify its SHA-256 checksum, and run it with Python 3. See the [direct installation tutorial](direct-installation.html). The standalone script includes the local DNS helper but still requires distribution-managed Requests and PyYAML.

## Installation from the official download

Use the **latest version listed** at [Downloads](downloads/index.html). Set `VERSION` to the release shown on the download page. The `.sha256` file must be in the same directory as the archive when verifying it.

```sh
VERSION="<release-from-downloads-page>"
BASE=https://ipsonic.com/probe/downloads
wget "$BASE/ipsonic-probe-$VERSION.tar.gz"
wget "$BASE/ipsonic-probe-$VERSION.tar.gz.sha256"
sha256sum -c "ipsonic-probe-$VERSION.tar.gz.sha256"
tar -xzf "ipsonic-probe-$VERSION.tar.gz"
cd "ipsonic-probe-$VERSION"
python3 ipsonic-probe.py --self-test
```

Install the native `python3`, Requests and PyYAML packages from your OS repository. On Debian/Ubuntu/Raspberry Pi OS these are commonly `python3`, `python3-requests`, `python3-yaml`; on AlmaLinux/Rocky Linux the PyYAML package is commonly `python3-pyyaml` (repository availability may vary). See `requirements-linux.txt` and `requirements.txt` in the archive. The commands above assume the release has been published at the official URL.

## First check: localhost SSH

```sh
python3 ipsonic-probe.py --validate --strict examples/138-hello-first-tcp-ssh.yaml
python3 ipsonic-probe.py --explain examples/138-hello-first-tcp-ssh.yaml
python3 ipsonic-probe.py examples/138-hello-first-tcp-ssh.yaml
```

The YAML targets `tcp://127.0.0.1:22`. A failure is expected when no local SSH listener is running. A successful TCP connection **does not** establish SSH authentication or application correctness.

## Complete CLI reference

| Command | Effect | Network activity |
| --- | --- | --- |
| `python3 ipsonic-probe.py --help` | CLI usage and options | No |
| `python3 ipsonic-probe.py --version` | Program version, Python and OS | No |
| `python3 ipsonic-probe.py --self-test` | Check local Python modules and trust store | No |
| `python3 ipsonic-probe.py --validate FILE.yaml` | Validate YAML and supported values | No |
| `python3 ipsonic-probe.py --validate --strict FILE.yaml` | Also reject unknown keys and literal auth secrets | No |
| `python3 ipsonic-probe.py --explain FILE.yaml` | Explain target, settings and metadata | No |
| `python3 ipsonic-probe.py --dry-run FILE.yaml` | Preview intended check | No |
| `python3 ipsonic-probe.py --list-checks DIR` | Inventory YAML files in a directory | No |
| `python3 ipsonic-probe.py --list-checks DIR --format tsv` | Tab-separated inventory | No |
| `python3 ipsonic-probe.py --list-checks DIR --format json` | JSON inventory | No |
| `python3 ipsonic-probe.py FILE.yaml` | Execute a check | Yes |
| `python3 ipsonic-probe.py --check-dir DIR` | Execute YAML files sequentially, non-recursively | Yes |
| `python3 ipsonic-probe.py --output nagios FILE.yaml` | Override configured output format | Yes |
| `python3 ipsonic-probe.py --diff OLD.yaml NEW.yaml` | Masked offline configuration diff | No |
| `python3 ipsonic-probe.py FILE.yaml --baseline-save FILE.json` | Save known-good result state | Yes |
| `python3 ipsonic-probe.py FILE.yaml --baseline-compare FILE.json` | Compare current result state | Yes |

`--format` applies to `--list-checks` only. `--output` applies to check output and accepts `text`, `json`, `nagios`, `icinga2`, and `checkmk`. `--strict` may be used with supported config-loading actions. Baseline actions require exactly one YAML file and cannot be combined with other actions.

## Configuration and supported checks

Each YAML file defines either a `url` target (`tcp://`, `http://`, `https://`) or a `dns` mapping, not both. Typical configuration sections include `request`, `auth`, `tls`, `proxy`, `connection`, `timeouts`, `execution`, `monitoring`, and `metadata`. The [example catalog](examples/index.html) contains complete configurations with plain-English descriptions and operational notes. Do not assume an option is supported merely because it appears in another monitoring product: use `--validate --strict`.

The checks cover TCP connectivity; HTTP methods, status, headers, response bodies and redirects; TLS verification and certificate checks; DNS record assertions and DNSSEC-related information; backend comparison; and retry/quorum logic. Proxy configuration affects HTTP(S) checks, not arbitrary TCP or DNS checks. For private PKI, configure the appropriate CA bundle rather than disabling TLS verification. Consult the example catalog for exact YAML syntax.

### Timeouts and retries

```yaml
timeouts:
  connect: 3
  response: 5
  total: 15
```

`timeouts.total` budgets the complete check including retries and backend checks, but cannot forcibly interrupt an already-running blocking network call. Use a process supervisor when a hard wall-clock termination is required. Retry counts are configured in `execution`; excessive retries increase load and alert latency.

### Optional operational metadata

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

Metadata helps developers hand checks to operators. On non-OK results, owner, environment and runbook are included in human-readable monitoring output; JSON includes the metadata object. Runbook URLs are informational and are not fetched by the tool.

## Monitoring output and exit-code contract

| Exit code | Meaning |
| --- | --- |
| `0` | OK |
| `1` | WARNING |
| `2` | CRITICAL |
| `3` | UNKNOWN, including configuration/runtime errors |

When executing multiple checks, the process returns the highest status code. `nagios` and `icinga2` emit plugin-style status/performance-data lines; `checkmk` emits local-check format; `json` provides structured fields; `text` is human-readable. A non-monitoring action can have action-specific exit semantics: **`--diff` returns 1 when differences are found**, while **baseline comparison returns 2 when the saved state differs**. These codes must not be interpreted as ordinary check alerts in those workflows.

## Production workflow: develop, operate, secure

1. Developers create a YAML check from the [examples](examples/index.html), including expected behavior and optional ownership/runbook metadata.
2. Run `--validate --strict`, `--explain` and `--dry-run` locally; these actions do not contact targets.
3. Review changes using `--diff OLD NEW`; treat the diff as helpful redaction, **not** a guarantee that arbitrary custom secrets are hidden.
4. Deploy configuration and OS-packaged dependencies with [Ansible](ansible-installation.html), shell, or existing configuration management.
5. Operators run a single check or `--check-dir` and integrate the chosen output format with their existing monitoring system.
6. Diagnose problems using the owner/runbook information, then adjust YAML as the application changes. Retest and review the change before rollout.

### Ansible: validate before execution

```yaml
- name: Validate ipsonic-probe configuration
  ansible.builtin.command:
    argv:
      - /usr/bin/python3
      - /opt/ipsonic-probe/ipsonic-probe.py
      - --validate
      - --strict
      - /etc/ipsonic-probe/api.yaml
  changed_when: false

- name: Run ipsonic-probe checks
  ansible.builtin.command:
    argv:
      - /usr/bin/python3
      - /opt/ipsonic-probe/ipsonic-probe.py
      - /etc/ipsonic-probe/api.yaml
  environment:
    HTTPTEST_API_TOKEN: "{{ vault_api_token }}"
  register: ipsonic_probe_result
  changed_when: false
  no_log: true
```

This example assumes the Python script and configuration are deployed at the paths shown. `no_log: true` protects sensitive task data; ensure Ansible Vault and operating-system file permissions are also configured appropriately.

## Security and baseline limitations

Prefer `auth.password_env` and `auth.token_env` over literal credentials. `--strict` rejects certain plaintext auth fields and known sensitive request headers. Output redaction targets known secrets; custom YAML fields, error strings and third-party responses still require review. Do not publish production configurations containing secrets. Avoid disabling TLS validation. `--diff` masks typical secret-like fields, but is not a complete secret-scanning boundary.

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

Baseline saving requires an OK check and refuses to overwrite an existing baseline. The file is created with permissions `0600`. The baseline captures only result status, exit code and stable assertion identifiers; it **does not** capture DNS answer sets, TLS fingerprints or HTTP response headers. Comparison returns 0 unchanged, 2 changed, 3 invalid or missing baseline.

## Release and offline website build

```sh
python3 -m unittest discover -s tests -q
sh tools/generate-site.sh --output site-output
VERSION="<new-release-version>"
sh tools/build-release.sh "$VERSION"
(cd releases && sha256sum -c ipsonic-probe-${VERSION}.tar.gz.sha256)
```

The release script creates a deterministic source `tar.gz`, its `.sha256`, and a `.manifest.json` containing the version, artifact name, digest and reproducible build metadata. The static website is generated locally without a CDN or framework. Choose a new version for new changes and do not overwrite an existing published release.

## Support and disclaimer

Maintainer: **mati peterson** — [ipsonic@mailbox.org](mailto:ipsonic@mailbox.org). Official project: [https://ipsonic.com/probe/](https://ipsonic.com/probe/). Main project: [https://ipsonic.com/](https://ipsonic.com/).

Software and examples are provided **AS IS**, without warranty. Validate checks, permissions, credentials and expected service behavior before production use. See [DISCLAIMER.md](DISCLAIMER.md).

## New feature examples

See [Feature Examples](feature-examples.html) for runnable examples of strict validation, inventory, directory checks, baseline comparison, diff, runbooks, monitoring outputs, and release verification.

## Infrastructure and operator integration examples

See [Integration Examples](INTEGRATION-EXAMPLES.md) for examples 149–179, exact commands, monitoring integration files and explicit feature limitations.

## Operator diagnostics and inventory

See [Operator diagnostics and inventory](operator-diagnostics.html) for `--doctor`, `--lint`, `--probe`, `--inventory`, exit codes, security caveats, and examples 176–181.

## Assertions and evidence

See [Assertions & Evidence](ASSERTIONS-EVIDENCE.md) for structured assertions, JSON result schema, opt-in HTTP/TLS/DNS evidence, baseline drift detection, perfdata, security limitations and examples.

## Kubernetes

See [Kubernetes operator examples](KUBERNETES.md) for service discovery, Ingress, API server readiness, and scoped ServiceAccount authentication.


## YAML protocol reference

See [YAML configuration reference](YAML-REFERENCE.md) for DNS, TCP, HTTP, HTTPS and TLS options.
