Skip to content

140#52

Merged
alvagante merged 20 commits into
mainfrom
140
Jun 5, 2026
Merged

140#52
alvagante merged 20 commits into
mainfrom
140

Conversation

@alvagante

Copy link
Copy Markdown
Member

No description provided.

alvagante added 4 commits June 1, 2026 15:10
- Add Checkmk plugin with REST API and Livestatus client for host and service monitoring
- Implement CheckmkService for REST API communication and CheckmkLivestatusClient for raw TCP/TLS events
- Add database migrations for Checkmk permissions and configuration storage
- Create monitoring API endpoints (/api/nodes/:nodeId/services, /api/nodes/:nodeId/events)
- Add frontend Monitor tab component with service status and event timeline visualization
- Integrate with existing node linking, journal timeline, and integration color systems
- Add comprehensive test coverage including unit, integration, and property-based tests
- Update configuration schema and environment variables for Checkmk server connection
- Add MCP tools for Checkmk service queries and event retrieval
- Update documentation with Checkmk integration guide and architecture decision record
- Update Helm chart and Docker configurations to support new integration
…es and streamline service queries

- Add docker-compose framework hint to Kirograph configuration
- Extend Kirograph config with memory, docs, and data feature toggles and limits
- Add checkmk to NodeLinkingService scoring weights (weight: 8)
- Update CheckmkService.getHosts() to request effective_attributes from Checkmk API
- Prefer effective_attributes (resolved configuration) over raw attributes in host mapping
- Fallback to host.title when hostname ID is unavailable
- Add detailed logging for host retrieval operations with metadata
- Add warning logs when API response value is not an array
- Remove inventory cross-check validation from monitoring routes for improved performance
- Simplify service query logic by returning 200 with empty array instead of 404 when services not found
- Update MonitorTab component to reflect streamlined monitoring data display
- Update NodeDetailPage to integrate enhanced monitoring information
- Add comprehensive test coverage for updated CheckmkService behavior
- Add test cases for monitoring routes with simplified validation logiccd .
- Add explicit unknown type cast to resolve TypeScript type compatibility issue
- Update package version from 1.2.0 to 1.4.0 across all workspaces
- Maintain type safety while allowing Facts object construction from mixed-type properties
Copilot AI review requested due to automatic review settings June 2, 2026 16:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR bumps Pabawi to v1.4.0 and introduces an end-to-end Checkmk monitoring integration across backend, frontend UI, MCP tooling, docs, and deployment metadata.

Changes:

  • Add a Checkmk InformationSourcePlugin with REST + optional Livestatus support, plus new monitoring API routes and RBAC permission seeding.
  • Add frontend Monitor tab + setup guide, integrate Checkmk into journal filtering/display, and extend integration color palettes.
  • Extend MCP with two new read-only monitoring tools and update docs/tests accordingly.

Reviewed changes

Copilot reviewed 72 out of 74 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
package.json Bump root version to 1.4.0
package-lock.json Align lockfile version/workspaces versions
frontend/src/pages/NodeDetailPage.svelte Add Monitor tab wiring + journal filter options
frontend/src/pages/IntegrationSetupPage.svelte Add Checkmk setup guide route
frontend/src/pages/GlobalJournalPage.svelte Add Checkmk/state_change filter options
frontend/src/lib/monitorTabUtils.ts Add service grouping utilities/constants
frontend/src/lib/monitorTabUtils.test.ts Property-based tests for grouping order
frontend/src/lib/integrationColors.svelte.ts Add checkmk integration palette
frontend/src/lib/formatRelativeTime.ts Extract reusable relative time formatter
frontend/src/lib/checkmkApi.ts Add Checkmk frontend API helpers/types
frontend/src/components/NodeStatus.svelte Use shared formatRelativeTime
frontend/src/components/Navigation.svelte Display updated app version
frontend/src/components/MonitorTab.svelte New Monitor tab UI for service status
frontend/src/components/JournalTimeline.test.ts Add test for Checkmk state_change rendering
frontend/src/components/JournalTimeline.svelte Add Checkmk source icon + state_change label
frontend/src/components/IntegrationBadge.svelte Add Checkmk badge label
frontend/src/components/index.ts Export Checkmk setup/monitor components
frontend/src/components/EventsViewer.svelte Use shared formatRelativeTime
frontend/src/components/CheckmkSetupGuide.svelte New Checkmk setup guide UI
frontend/package.json Bump frontend version to 1.4.0
docs/mcp.md Document new monitoring MCP tools + proxy notes
docs/integrations/checkmk.md Add Checkmk integration docs
docs/configuration.md Document Checkmk env vars
docs/api.md Document monitoring endpoints (needs alignment)
docs/adr/0001-checkmk-events-source.md ADR for Livestatus vs REST fallback
Dockerfile.ubuntu Update OCI version label
Dockerfile.alpine Update OCI version label
Dockerfile Update OCI version label
CONTEXT.md Add shared terminology for Checkmk integration
charts/pabawi/Chart.yaml Bump Helm appVersion
CHANGELOG.md Add 1.4.0 entry for Checkmk integration
backend/test/unit/monitoring.routes.test.ts Unit tests for monitoring routes
backend/test/unit/mcp/McpServer.test.ts Update MCP tool count assertion
backend/test/unit/mcp/checkmk-tools.test.ts Add unit tests for new MCP tools
backend/test/unit/CheckmkPlugin.test.ts Unit tests for init + event fallback
backend/test/services/IntegrationColorService.test.ts Assert checkmk in valid integrations
backend/test/properties/mcp/permission-enforcement.property.test.ts Extend property test to new MCP tools
backend/test/properties/checkmk-service.property.test.ts Property tests for auth header + secret non-exposure
backend/test/properties/checkmk-config.property.test.ts Property tests for Checkmk env parsing/schema
backend/test/integration/mcp-endpoint.test.ts Update tools/list to 11 tools
backend/test/integration/integration-colors.test.ts Assert checkmk returned by colors API
backend/test/database/migration-integration.test.ts Update expected migration count to 15
backend/src/services/journal/types.ts Add state_change + checkmk to schemas
backend/src/services/IntegrationColorService.ts Add Checkmk color config
backend/src/server.ts Wire Checkmk live source + mount monitoring router + version bump
backend/src/routes/journal.ts Add Checkmk as journal SSE source (global + node)
backend/src/routes/inventory.ts Add expert-mode diagnostics metadata/warnings
backend/src/routes/integrations/monitoring.ts New monitoring routes for services/events
backend/src/plugins/registry.ts Register Checkmk plugin
backend/src/mcp/McpToolHandlers.ts Register two new monitoring MCP tools
backend/src/mcp/McpServer.ts Add RBAC permissions + update tool count log
backend/src/mcp/McpOutputSummariser.ts Add service summariser helper
backend/src/integrations/NodeLinkingService.ts Add Checkmk priority
backend/src/integrations/IntegrationManager.ts Add per-source fetch diagnostics + checkmk timeout
backend/src/integrations/checkmk/types.ts Define Checkmk integration types
backend/src/integrations/checkmk/CheckmkService.ts Implement REST client w/ sanitization
backend/src/integrations/checkmk/CheckmkLivestatusClient.ts Implement Livestatus LQL client
backend/src/database/migrations/015_checkmk_permissions.sql Seed checkmk:read + role backfill (SQLite)
backend/src/database/migrations/015_checkmk_permissions.postgres.sql Seed checkmk:read + role backfill (Postgres)
backend/src/config/schema.ts Add Checkmk Zod schemas
backend/src/config/ConfigService.ts Parse Checkmk env + expose accessor
backend/package.json Bump backend version to 1.4.0
backend/.env.example Add Checkmk env vars (currently duplicated)
AGENTS.md Update MCP tools list/count
.kirograph/config.json Extend kirograph configuration
.kiro/specs/checkmk-integration/tasks.md Add implementation plan/spec tasks
.kiro/specs/checkmk-integration/.config.kiro Add Kiro spec config
.gitignore Ignore backend crash dumps directory
.env.docker Add Checkmk + MCP docker env examples

Comment thread backend/.env.example
Comment on lines +208 to +217
# -----------------------------------------------------------------------------
# Checkmk integration (optional)
# -----------------------------------------------------------------------------
CHECKMK_ENABLED=false
# CHECKMK_SERVER_URL=https://checkmk.example.com
# CHECKMK_SITE=mysite
# CHECKMK_USERNAME=automation
# CHECKMK_PASSWORD= # pragma: allowlist secret
# Set to "false" to skip TLS certificate verification (self-signed certs)
# CHECKMK_SSL_VERIFY=true
Comment thread docs/api.md

## Checkmk Monitoring

Requires `CHECKMK_ENABLED=true`. All endpoints require JWT auth and the `monitoring:read` RBAC permission.
Comment thread docs/api.md
Comment on lines +475 to +489
**Response (`GET /api/nodes/:nodeId/services`):**

```json
{
"services": [
{
"description": "CPU load",
"state": "OK",
"stateType": "hard",
"pluginOutput": "OK - 15min load: 0.42",
"lastCheck": "2026-06-15T10:30:00Z"
}
]
}
```
Comment thread docs/api.md Outdated
Comment on lines +491 to +497
**Error codes:**

| HTTP | Code | Condition |
|---|---|---|
| 503 | `CHECKMK_NOT_CONFIGURED` | Plugin not enabled |
| 404 | `NODE_NOT_FOUND` | Node not known to Checkmk |
| 502 | _(upstream error)_ | Checkmk API failure or timeout |
Comment on lines +55 to +60
* Responses:
* 200 — service array (may be empty)
* 503 — CHECKMK_NOT_CONFIGURED (plugin absent/not initialized)
* 404 — NODE_NOT_FOUND (hostname unknown to Checkmk)
* 502 — upstream Checkmk API failure or timeout
*/
Comment on lines +226 to +231
* Responses:
* 200 — events array (may be empty)
* 503 — CHECKMK_NOT_CONFIGURED
* 404 — NODE_NOT_FOUND
* 502 — upstream failure/timeout
*/
| GET | `/api/nodes/:nodeId/services` | Live service monitoring status |
| GET | `/api/nodes/:nodeId/monitoring-events` | State-change events (supports `?limit=N`, default 200, max 1000) |

Both endpoints require JWT authentication and the `monitoring:read` RBAC permission.
|---|---|
| **Inventory** | Hosts from Checkmk (priority 8), merged into unified inventory |
| **Service monitoring** | Live status of all services on a node (OK, WARN, CRIT, UNKNOWN) |
| **State-change events** | Historical events from the Event Console, shown in the Monitor tab and node journal |
| "Connection refused" | Verify `CHECKMK_SERVER_URL` is reachable. Test with `curl`. Check firewall rules. |
| Monitor tab not showing | The node must be linked to a Checkmk host (same hostname). Check that the integration is healthy in the Status Dashboard. |
| Empty service list | Verify the hostname in Pabawi matches the hostname in Checkmk exactly |
| Events not appearing in journal | Events are fetched live — check that the Event Console has entries for the host in the last 7 days |
Comment thread CHANGELOG.md
- `GET /api/nodes/:nodeId/monitoring-events` endpoint returning state-change events with configurable limit.
- `CHECKMK_ENABLED`, `CHECKMK_SERVER_URL`, `CHECKMK_SITE`, `CHECKMK_USERNAME`, `CHECKMK_PASSWORD`, `CHECKMK_SSL_VERIFY` environment variables for configuration.
- Checkmk integration documentation at `docs/integrations/checkmk.md`.
- `monitoring:read` RBAC permission for monitoring endpoints.
alvagante added 2 commits June 3, 2026 09:55
- Differentiate package action format between Ansible and Bolt tools
- Use generic "package" action for Ansible instead of task name format
- Maintain existing behavior for Bolt (task name or package::ensure format)
- Add clarifying comments explaining tool-specific action requirements
…problems and events

- Add getUnhandledServiceProblems() and getRecentEvents() methods to CheckmkPlugin for dashboard data fetching
- Enhance getFailingServices() in CheckmkService to support filtering by hostname and unhandled status via unhandledOnly parameter
- Create new /api/monitoring/overview endpoint to provide unified dashboard view with service problems and recent events
- Implement query parameter validation (hours: 1-168, limit: 1-500) with sensible defaults (4 hours, 100 results)
- Add timeout handling and graceful fallback from Livestatus to REST API for event retrieval
- Integrate monitoring overview route into Express server
- Update home page UI to display unhandled problems and recent events from the new dashboard endpoint
- Enables real-time monitoring visibility on home page with efficient single-request data fetching
Copilot AI review requested due to automatic review settings June 3, 2026 09:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 75 out of 77 changed files in this pull request and generated 13 comments.

Comment on lines +436 to +440
// 503 means checkmk is not configured — not an error to display
if (err instanceof Error && err.message.includes('503')) {
isCheckmkActive = false;
return;
}
Comment on lines +91 to +103
const message = err instanceof Error ? err.message : 'An unknown error occurred';
// Distinguish 503 (unavailable/not configured) from 502 (upstream error)
if (
message.includes('unavailable') ||
message.includes('CHECKMK_NOT_CONFIGURED') ||
message.includes('not configured') ||
message.includes('Service unavailable') ||
message.includes('503')
) {
error = { type: 'unavailable', message: 'Monitoring unavailable' };
} else {
error = { type: 'upstream', message: message || 'Failed to fetch monitoring data' };
}
Comment thread backend/.env.example
Comment on lines +197 to +217
# -----------------------------------------------------------------------------
# Checkmk integration (optional)
# -----------------------------------------------------------------------------
CHECKMK_ENABLED=false
# CHECKMK_SERVER_URL=https://checkmk.example.com
# CHECKMK_SITE=mysite
# CHECKMK_USERNAME=automation
# CHECKMK_PASSWORD= # pragma: allowlist secret
# Set to "false" to skip TLS certificate verification (self-signed certs)
# CHECKMK_SSL_VERIFY=true

# -----------------------------------------------------------------------------
# Checkmk integration (optional)
# -----------------------------------------------------------------------------
CHECKMK_ENABLED=false
# CHECKMK_SERVER_URL=https://checkmk.example.com
# CHECKMK_SITE=mysite
# CHECKMK_USERNAME=automation
# CHECKMK_PASSWORD= # pragma: allowlist secret
# Set to "false" to skip TLS certificate verification (self-signed certs)
# CHECKMK_SSL_VERIFY=true
Comment thread docs/api.md
Comment on lines +460 to +463
## Checkmk Monitoring

Requires `CHECKMK_ENABLED=true`. All endpoints require JWT auth and the `monitoring:read` RBAC permission.

Comment thread docs/api.md Outdated
Comment on lines +475 to +497
**Response (`GET /api/nodes/:nodeId/services`):**

```json
{
"services": [
{
"description": "CPU load",
"state": "OK",
"stateType": "hard",
"pluginOutput": "OK - 15min load: 0.42",
"lastCheck": "2026-06-15T10:30:00Z"
}
]
}
```

**Error codes:**

| HTTP | Code | Condition |
|---|---|---|
| 503 | `CHECKMK_NOT_CONFIGURED` | Plugin not enabled |
| 404 | `NODE_NOT_FOUND` | Node not known to Checkmk |
| 502 | _(upstream error)_ | Checkmk API failure or timeout |
Comment on lines +116 to +126
## API Endpoints

The Checkmk integration exposes two API endpoints:

| Method | Path | Description |
|---|---|---|
| GET | `/api/nodes/:nodeId/services` | Live service monitoring status |
| GET | `/api/nodes/:nodeId/monitoring-events` | State-change events (supports `?limit=N`, default 200, max 1000) |

Both endpoints require JWT authentication and the `monitoring:read` RBAC permission.

Comment on lines +144 to +146
| Monitor tab not showing | The node must be linked to a Checkmk host (same hostname). Check that the integration is healthy in the Status Dashboard. |
| Empty service list | Verify the hostname in Pabawi matches the hostname in Checkmk exactly |
| Events not appearing in journal | Events are fetched live — check that the Event Console has entries for the host in the last 7 days |
Comment on lines +55 to +60
* Responses:
* 200 — service array (may be empty)
* 503 — CHECKMK_NOT_CONFIGURED (plugin absent/not initialized)
* 404 — NODE_NOT_FOUND (hostname unknown to Checkmk)
* 502 — upstream Checkmk API failure or timeout
*/
Comment on lines +98 to +112
try {
const [serviceProblems, events] = await Promise.race([
Promise.all([
plugin.getUnhandledServiceProblems(limit),
plugin.getRecentEvents(hours, limit),
]),
new Promise<never>((_, reject) => {
setTimeout(() => {
reject(new Error("Upstream timeout"));
}, UPSTREAM_TIMEOUT_MS);
}),
]);

res.json({ serviceProblems, events });
} catch (error: unknown) {
Comment on lines +22 to +32
/**
* A state-change monitoring event for a node's service.
* Validates Requirements: 9.2, 11.2
*/
export interface MonitoringEvent {
timestamp: string;
serviceDescription: string;
previousState: string;
currentState: string;
output: string;
}
alvagante added 3 commits June 3, 2026 13:01
…nd implement sorting

- Add acknowledged field to CheckmkFailingService type to track problem acknowledgment status
- Include acknowledged column in Livestatus query to retrieve acknowledgment data from Checkmk
- Update getUnhandledServiceProblems to return all service problems including acknowledged ones
- Add frontend sorting controls for service problems (severity and freshness modes)
- Implement derived sorting logic that places unacknowledged problems first, then sorts by selected mode
- Update problem counter to display both unhandled and acknowledged problem counts
- Enhance home page dashboard to visually distinguish acknowledged problems from unhandled ones
- Import Checkmk services API and monitoring utilities
- Add state variables for overview services data, loading, and error states
- Implement fetchOverviewServices() to retrieve Checkmk service status
- Add derived state for service summary counts (total, ok, warn, crit, unknown)
- Add derived state for critical and warning services with sorting
- Conditionally load Checkmk services when overview tab is active and integration available
- Wrap Puppet Runs section with conditional rendering based on PuppetDB availability
- Add new Monitoring Summary section displaying service status with color-coded summary cards
- Show critical and warning services with state indicators and clickable service details
- Only render Checkmk monitoring section when Checkmk integration is configured
- Support error handling and retry functionality for failed service loads
…oint

- Add CheckmkHostSummary type to track service state counts per host (total, ok, warn, crit, unknown)
- Implement getHostServiceSummary() in CheckmkService to aggregate service states by hostname from bulk API endpoint
- Sort host summaries by critical count descending, then warning count, then total services
- Extend monitoringOverview endpoint to fetch and return hostSummary alongside existing service problems and events
- Filter out "unchanged" PuppetDB reports in journal collectors to reduce noise and improve clarity
- Update JSDoc comments to clarify filtering behavior and response structure
- Optimizes monitoring dashboard to surface hosts with the most critical issues at the top
Copilot AI review requested due to automatic review settings June 4, 2026 09:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 80 out of 82 changed files in this pull request and generated 12 comments.

import { useExecutionStream, type ExecutionStream } from '../lib/executionStream.svelte';
import type { DebugInfo, LabeledDebugInfo } from '../lib/api';
import { getNodeServices, type ServiceStatus } from '../lib/checkmkApi';
import { STATE_NAMES, STATE_COLORS, groupServicesByState } from '../lib/monitorTabUtils';
Comment thread backend/.env.example
Comment on lines +208 to +217
# -----------------------------------------------------------------------------
# Checkmk integration (optional)
# -----------------------------------------------------------------------------
CHECKMK_ENABLED=false
# CHECKMK_SERVER_URL=https://checkmk.example.com
# CHECKMK_SITE=mysite
# CHECKMK_USERNAME=automation
# CHECKMK_PASSWORD= # pragma: allowlist secret
# Set to "false" to skip TLS certificate verification (self-signed certs)
# CHECKMK_SSL_VERIFY=true
Comment thread docs/api.md
Comment on lines +462 to +463
Requires `CHECKMK_ENABLED=true`. All endpoints require JWT auth and the `monitoring:read` RBAC permission.

Comment thread docs/api.md
Comment on lines +475 to +489
**Response (`GET /api/nodes/:nodeId/services`):**

```json
{
"services": [
{
"description": "CPU load",
"state": "OK",
"stateType": "hard",
"pluginOutput": "OK - 15min load: 0.42",
"lastCheck": "2026-06-15T10:30:00Z"
}
]
}
```
Comment thread docs/api.md Outdated
Comment on lines +491 to +497
**Error codes:**

| HTTP | Code | Condition |
|---|---|---|
| 503 | `CHECKMK_NOT_CONFIGURED` | Plugin not enabled |
| 404 | `NODE_NOT_FOUND` | Node not known to Checkmk |
| 502 | _(upstream error)_ | Checkmk API failure or timeout |
Comment on lines +79 to +85
Checkmk state-change events appear in the node journal timeline alongside events from other sources. Events are fetched from:

```
GET /{site}/check_mk/api/1.0/domain-types/historical_event/collections/all
```

Events are filtered by hostname, limited to the last 7 days and 500 entries maximum.
| GET | `/api/nodes/:nodeId/services` | Live service monitoring status |
| GET | `/api/nodes/:nodeId/monitoring-events` | State-change events (supports `?limit=N`, default 200, max 1000) |

Both endpoints require JWT authentication and the `monitoring:read` RBAC permission.
| "Connection refused" | Verify `CHECKMK_SERVER_URL` is reachable. Test with `curl`. Check firewall rules. |
| Monitor tab not showing | The node must be linked to a Checkmk host (same hostname). Check that the integration is healthy in the Status Dashboard. |
| Empty service list | Verify the hostname in Pabawi matches the hostname in Checkmk exactly |
| Events not appearing in journal | Events are fetched live — check that the Event Console has entries for the host in the last 7 days |
Comment on lines +55 to +60
* Responses:
* 200 — service array (may be empty)
* 503 — CHECKMK_NOT_CONFIGURED (plugin absent/not initialized)
* 404 — NODE_NOT_FOUND (hostname unknown to Checkmk)
* 502 — upstream Checkmk API failure or timeout
*/
Comment on lines +226 to +231
* Responses:
* 200 — events array (may be empty)
* 503 — CHECKMK_NOT_CONFIGURED
* 404 — NODE_NOT_FOUND
* 502 — upstream failure/timeout
*/
alvagante added 2 commits June 4, 2026 12:59
… host summary

- Create new MonitorPage.svelte component for detailed monitoring views
- Add /monitor route to application router with authentication required
- Add Monitor navigation item to main navigation menu with chart icon
- Move Checkmk service problems display from HomePage to dedicated MonitorPage
- Remove serviceProblems from HomePage monitoring overview section
- Add "View Details" button on HomePage to navigate to Monitor page
- Simplify HomePage to focus on host summary overview only
- Remove problem filtering, sorting, and time window controls from HomePage
- Reduce HomePage complexity by delegating detailed problem management to specialized page
…itor page

- Add configurable auto-refresh intervals (off, 15s, 30s, 1m, 5m) for service problems
- Implement refresh rate toggle buttons in the problems header with visual feedback
- Add manual refresh button with spinner animation during refresh
- Track last refresh timestamp and display in button tooltip
- Prevent concurrent refresh requests with refreshing state flag
- Add onDestroy lifecycle hook to clean up auto-refresh timer on component unmount
- Use Svelte $effect to reactively manage auto-refresh interval setup and teardown
- Improve header layout with flex wrapping for responsive control positioning
- Add clock icon and visual separators for better control organization
Copilot AI review requested due to automatic review settings June 4, 2026 12:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 82 out of 84 changed files in this pull request and generated 13 comments.

Comment on lines +37 to +38
import { getNodeServices, type ServiceStatus } from '../lib/checkmkApi';
import { STATE_NAMES, STATE_COLORS, groupServicesByState } from '../lib/monitorTabUtils';
Comment on lines +421 to +425
// 503 means checkmk is not configured — not an error to display
if (err instanceof Error && err.message.includes('503')) {
isCheckmkActive = false;
return;
}
Comment thread docs/api.md
Comment on lines +460 to +463
## Checkmk Monitoring

Requires `CHECKMK_ENABLED=true`. All endpoints require JWT auth and the `monitoring:read` RBAC permission.

Comment thread docs/api.md
Comment on lines +475 to +489
**Response (`GET /api/nodes/:nodeId/services`):**

```json
{
"services": [
{
"description": "CPU load",
"state": "OK",
"stateType": "hard",
"pluginOutput": "OK - 15min load: 0.42",
"lastCheck": "2026-06-15T10:30:00Z"
}
]
}
```
Comment on lines +77 to +85
### State-Change Events (Journal)

Checkmk state-change events appear in the node journal timeline alongside events from other sources. Events are fetched from:

```
GET /{site}/check_mk/api/1.0/domain-types/historical_event/collections/all
```

Events are filtered by hostname, limited to the last 7 days and 500 entries maximum.
Comment on lines +122 to +130
try {
const services = await Promise.race([
plugin.getNodeData(nodeId, "services") as Promise<unknown[]>,
new Promise<never>((_, reject) => {
setTimeout(() => {
reject(new Error("Upstream timeout"));
}, UPSTREAM_TIMEOUT_MS);
}),
]);
Comment on lines +55 to +59
* Responses:
* 200 — service array (may be empty)
* 503 — CHECKMK_NOT_CONFIGURED (plugin absent/not initialized)
* 404 — NODE_NOT_FOUND (hostname unknown to Checkmk)
* 502 — upstream Checkmk API failure or timeout
Comment on lines +227 to +231
* 200 — events array (may be empty)
* 503 — CHECKMK_NOT_CONFIGURED
* 404 — NODE_NOT_FOUND
* 502 — upstream failure/timeout
*/
Comment on lines +14 to +16
* IntegrationManager and CheckmkPlugin to exercise the router's own logic:
* 503 when plugin absent, 404 when node unknown, 502 on upstream failure,
* and 200 with correct shapes on success.
Comment on lines +43 to +46
| **Inventory** | Hosts from Checkmk (priority 8), merged into unified inventory |
| **Service monitoring** | Live status of all services on a node (OK, WARN, CRIT, UNKNOWN) |
| **State-change events** | Historical events from the Event Console, shown in the Monitor tab and node journal |
| **Node linking** | Checkmk hosts are linked to existing Pabawi nodes by hostname |
alvagante added 7 commits June 5, 2026 11:13
Add a playbook browser UI that discovers YAML playbook files in
ANSIBLE_PROJECT_PATH, displays their structure (plays, hosts, roles),
and auto-extracts parameters from vars_prompt/vars for a dynamic form.

Backend:
- New /api/playbooks and /api/playbooks/details endpoints
- AnsibleService.listPlaybooks() scans directories recursively
- AnsibleService.getPlaybookDetails() parses YAML to extract plays
  and parameters (vars_prompt → required, vars → optional)
- AnsiblePlugin exposes getAnsibleService() accessor
- BoltPlugin health check simplified to exec() for shell-wrapper compat
- Bolt/Ansible commands now pass --become / --run-as on sudo actions
- Crash handler accepts configurable dump directory via ConfigService
- Integration health checks run once synchronously at startup to warm cache

Frontend:
- ExecutePlaybookForm rewritten as full playbook browser with
  directory tree, search, content viewer, and PlaybookParameterForm
- AnsiblePlaybookInterface delegates form to ExecutePlaybookForm
- MonitorTab adds Last Change sort mode for Checkmk services
- Proxmox API functions unwrap nested response to return clean result

Tests:
- BoltPlugin tests updated for exec-based health check mock
…e, and dashboard integration

- Add dedicated Monitor page (`/monitor`) showing unhandled service problems with severity grouping and host state summary
- Add home page monitoring dashboard displaying unhandled problems count and recent state-change events
- Add auto-refresh and manual refresh controls on Monitor page with configurable interval
- Add Checkmk monitoring summary on node overview tab showing per-host service state counts
- Add Ansible playbook browser with `GET /api/playbooks` and `GET /api/playbooks/details` endpoints
- Add PlaybookParameterForm component with type-aware editors for playbook variables
- Rewrite ExecutePlaybookForm with directory tree browser, search, and content viewer
- Add `GET /api/nodes/:nodeId/monitoring-summary` endpoint for service state counts
- Add `lastStateChange` field to Checkmk service status for chronological sorting
- Add acknowledged flag on Checkmk service problems for distinguishing handled vs unhandled issues
- Add `PABAWI_CRASH_DUMP_DIR` configurable via ConfigService
- Switch Bolt health check from raw spawn to exec() with shell resolution
- Add `--run-as root` / `--become` support for Bolt and Ansible command execution
- Run integration health checks synchronously at startup to eliminate cold-start unavailability flash
- Unwrap nested Proxmox API responses in createProxmoxVM and createProxmoxLXC
- Fix Ansible parallel-execution package action format handlingscrip
- Crash dumps admin page: /crash-dumps route with list/view/download/delete API
- Checkmk getHostStateSummary() returning up/down/unreachable/downtime counts;
  home page renders host state grid instead of plain host count
- Puppet buildPuppetCommand() adds --confdir /etc/puppetlabs/puppet for correct
  config resolution under sudo
- Theme default changed from system to light for new users
- Add LogBufferService for ring buffer storage of structured log entries (2000 entry limit)
- Create /api/logs endpoint for querying logs by level, component, integration, and timestamp
- Add DELETE /api/logs endpoint to clear the in-memory buffer
- Update LoggerService to attach and use the log buffer for all log entries
- Refactor Bolt command execution to handle sudo by prepending to command string instead of using --run-as flag
- Remove runAs parameter from BoltService.runCommand to simplify command invocation
- Add LogsPage frontend component for displaying and filtering log entries
- Update Navigation to include link to new admin Logs page
- Add query parameter support: level, component, integration, since, limit (max 1000)
- Includes unit test updates for Bolt plugin changes
…m status endpoint

- Remove puppetDBService and puppetserverService parameters from createStatusRouter
- Delete logic that artificially added unconfigured integrations (puppetdb, puppetserver, bolt, hiera, proxmox, aws) to status response
- Only report integrations that are actually configured in the system
- Update integration status tests to verify unconfigured integrations are not included in response
- Simplifies status endpoint to focus on real integration state rather than placeholder entries
- Define ServiceState as a union type (0 | 1 | 2 | 3) for valid Checkmk state values
- Update STATE_ORDER constant to use ServiceState type annotation
- Update STATE_NAMES Record to use ServiceState keys instead of generic number
- Update STATE_COLORS Record to use ServiceState keys for semantic state colors
- Update STATE_NAME_TO_NUM Record to return ServiceState values
- Update ServiceGroup interface state property to use ServiceState type
- Update resolveServiceState function return type to ServiceState
- Improves type safety and prevents invalid state values at compile time
- Replace `types` with `types_or` in backend TypeScript check hook
- Replace `types` with `types_or` in frontend TypeScript check hook
- Allows pre-commit to match files with either .ts or .tsx extensions more reliably
alvagante added 2 commits June 5, 2026 15:43
…al path fallback

- Add API mocking setup with beforeEach to handle playbook fetch failures
- Implement waitFor assertions for async component initialization
- Add test for playbook browser mode with parameter detection
- Enhance extra vars handling tests with JSON validation scenarios
- Fix manual path mode to populate initialPlaybookPath on fetch failure
- Update test utilities to use async/await patterns for proper async handling
- Improve ParallelExecutionModal tests with better mock implementations
- Add provisioning API test cases for error scenarios and edge cases
- Ensure component properly falls back to manual input when playbook fetch fails
- Add test-backend hook to run Vitest for backend TypeScript files
- Add test-frontend hook to run Vitest for frontend TypeScript files with no-test pass-through
- Configure hooks to trigger on TypeScript file changes in respective directories
- Ensure unit tests run automatically during pre-commit phase for code quality
@alvagante alvagante merged commit 313adcc into main Jun 5, 2026
5 checks passed
@alvagante alvagante deleted the 140 branch June 5, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants