aguacero7 / aguacero7/rkik

Support plugin mode with compare

Aperta
#54 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Rust
Stelle
59
Fork
6
Merge medio
5m
PR unite (30g)
1

Descrizione

### Description

Plugin mode (`--plugin`) is currently incompatible with compare mode. This limits monitoring use cases where multiple NTP servers need to be checked together.

### Current State

- Plugin mode works with single target
- Compare mode works with multiple targets
- Combining both is explicitly unsupported (see `docs/plugin.md`)

### Proposed Solution

Implement plugin output for compare mode with two options:

**Option A: Aggregated output**
```
OK - 3/3 servers within threshold | offset_avg=2.5ms offset_max=5.1ms
```

**Option B: Per-host output (one line per target)**
```
OK - time.google.com offset=1.2ms | offset=1.2ms
OK - pool.ntp.org offset=3.1ms | offset=3.1ms
WARNING - time.nist.gov offset=15.2ms | offset=15.2ms
```

Exit code should be the worst status among all targets.

### Implementation Details

1. Extend plugin output logic to handle multiple results
2. Add `--plugin-aggregate` flag for aggregated vs per-host output
3. Compute worst-case exit code from all results
4. Generate perfdata for each target

### Acceptance Criteria

- [ ] `--plugin` works with compare mode
- [ ] Aggregated output option available
- [ ] Per-host output option available
- [ ] Exit code reflects worst status
- [ ] Tests added for both output modes
- [ ] Documentation updated in `docs/plugin.md`

### Files to Modify

- `src/bin/rkik.rs`
- `src/bin/rkik/legacy.rs`
- `src/fmt/text.rs` (or new `src/fmt/plugin.rs`)
- `docs/plugin.md`
- `tests/cli_test.rs`

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.