This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 4d8df4b21c85 CAMEL-26941: camel-jbang - camel status: the state of a 
running integration in one call (#29883)
4d8df4b21c85 is described below

commit 4d8df4b21c85ebd99e4c642faf2c041f30dbdacd
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Nov 14 08:51:06 2026 +0100

    CAMEL-26941: camel-jbang - camel status: the state of a running integration 
in one call (#29883)
    
    camel status [name] shows the state of a running integration in one call, 
where an agent needed camel get route, get health, get error and log, each a 
JVM of its own.
    
    It shows the problems first (a route not started or with failed exchanges, 
a health check down, a failed reload, a nearly full heap), then the state, 
uptime, folder and source files, the exchanges and the oldest inflight one, 
each route with its counters, the health, the HTTP server and endpoints, the 
last errors, the reloads of dev mode, the JVM, and the end of the log. Without 
a name it shows the only running integration; more than one, or none, is exit 
code 3. --json gives one docu [...]
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 .../modules/ROOT/pages/camel-jbang-managing.adoc   |  33 ++
 .../pages/jbang-commands/camel-jbang-commands.adoc |   1 +
 .../pages/jbang-commands/camel-jbang-status.adoc   |  28 +
 .../META-INF/camel-jbang-commands-metadata.json    |   1 +
 .../dsl/jbang/core/commands/CamelJBangMain.java    |   3 +
 .../core/commands/GroupedCommandHelpRenderer.java  |   2 +-
 .../core/commands/process/IntegrationStatus.java   | 602 +++++++++++++++++++++
 .../commands/process/IntegrationStatusTest.java    | 275 ++++++++++
 .../src/test/resources/golden/cli-help.txt         |  30 +-
 9 files changed, 973 insertions(+), 2 deletions(-)

diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang-managing.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-jbang-managing.adoc
index 2152eb5df44d..92924f195f52 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-jbang-managing.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-jbang-managing.adoc
@@ -139,6 +139,39 @@ Use `--remote` to break down TOTAL into remote/total pairs.
 
 TIP: Use `camel get --watch` for continuous updates.
 
+=== The state of one integration in one call
+
+`camel status` shows one integration, with what `camel get route`, `camel get 
health`, `camel get error` and `camel log`
+show, in one command. That is what an AI agent wants after it has run or 
changed an integration.
+
+It starts with what is wrong, in a few words each: a route that is not started 
or has failed exchanges, a health check
+that is down, a failed reload, or a heap that is nearly full (`Problems: none` 
when all is well). Then it shows:
+
+* the state and uptime, the folder the integration was started from, and its 
files (the files of its routes, and the
+  properties files it loaded)
+* the exchanges, and the oldest inflight one with where it is now (when the 
inflight exchanges are listed, as in dev
+  mode)
+* each route with its counters, its file and line, and its last error
+* the health checks that are down
+* the HTTP server with its endpoints and management endpoints
+* the last errors
+* the reloads of dev mode, with the outcome of the last one
+* the Java version, heap, threads and garbage collections of its JVM
+* the end of its log
+
+For example, as one JSON document:
+
+[source,bash]
+----
+camel status cheese --json
+----
+
+With `--json` it prints one document: `problems` is an empty list when all is 
well, the routes have the fields of
+`camel get route --json`, `uptime` is in millis, and the log records are 
newest first.
+
+Without a name it shows the only integration that runs. `--log-lines` and 
`--errors` set how many log records and
+errors to show (20 and 5 by default).
+
 == Route status
 
 See per-route statistics across all running integrations:
diff --git 
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-commands.adoc 
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-commands.adoc
index b8645eaee247..b24e56124395 100644
--- 
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-commands.adoc
+++ 
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-commands.adoc
@@ -43,6 +43,7 @@ TIP: You can also use `camel --help` or `camel <command> 
--help` to see availabl
 | xref:jbang-commands/camel-jbang-script.adoc[camel script] | Run Camel 
integration as shell script for terminal scripting
 | xref:jbang-commands/camel-jbang-semantic.adoc[camel semantic] | List 
semantic definitions and expert contracts
 | xref:jbang-commands/camel-jbang-shell.adoc[camel shell] | Interactive Camel 
CLI shell.
+| xref:jbang-commands/camel-jbang-status.adoc[camel status] | The state of a 
running Camel integration in one call: where it runs and its files, its routes, 
health, last errors and last reload, its JVM, and the end of its log
 | xref:jbang-commands/camel-jbang-stop.adoc[camel stop] | Shuts down running 
Camel integrations
 | xref:jbang-commands/camel-jbang-top.adoc[camel top] | Top status of Camel 
integrations
 | xref:jbang-commands/camel-jbang-trace.adoc[camel trace] | Tail message 
traces from running Camel integrations
diff --git 
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-status.adoc 
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-status.adoc
new file mode 100644
index 000000000000..af8ffaca0861
--- /dev/null
+++ b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-status.adoc
@@ -0,0 +1,28 @@
+
+// AUTO-GENERATED by camel-package-maven-plugin - DO NOT EDIT THIS FILE
+= camel status
+
+The state of a running Camel integration in one call: where it runs and its 
files, its routes, health, last errors and last reload, its JVM, and the end of 
its log
+
+
+== Usage
+
+[source,bash]
+----
+camel status [options]
+----
+
+
+
+== Options
+
+[cols="2,5,1,2",options="header"]
+|===
+| Option | Description | Default | Type
+| `--errors` | How many of the last errors to show | 5 | int
+| `--json` | Output in JSON Format: one document, with the routes as camel get 
route has them, and the log records newest first |  | boolean
+| `--log-lines` | How many of the last log records to show | 20 | int
+| `-h,--help` | Display this help and exit |  | boolean
+|===
+
+
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json
 
b/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json
index 224c88ad7ab6..a41581312714 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json
@@ -32,6 +32,7 @@
     { "name": "script", "fullName": "script", "description": "Run Camel 
integration as shell script for terminal scripting", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.Script", "options": [ { "names": 
"--logging", "description": "Can be used to turn on logging (logs to file in 
<user home>\/.camel directory)", "defaultValue": "false", "javaType": 
"boolean", "type": "boolean" }, { "names": "--logging-level", "description": 
"Logging level (ERROR, WARN, INFO, DEBUG, TRACE)", "d [...]
     { "name": "semantic", "fullName": "semantic", "description": "List 
semantic definitions and expert contracts", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.action.CamelSemantic", "options": [ { 
"names": "--expert", "description": "Show the operations and parameter contract 
of this expert", "javaType": "java.lang.String", "type": "string" }, { "names": 
"--json", "description": "Output a single JSON document", "javaType": 
"boolean", "type": "boolean" }, { "names": "--timeou [...]
     { "name": "shell", "fullName": "shell", "description": "Interactive Camel 
CLI shell.", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Shell", 
"options": [ { "names": "-h,--help", "description": "Display this help and 
exit", "javaType": "boolean", "type": "boolean" } ] },
+    { "name": "status", "fullName": "status", "description": "The state of a 
running Camel integration in one call: where it runs and its files, its routes, 
health, last errors and last reload, its JVM, and the end of its log", 
"sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.process.IntegrationStatus", 
"options": [ { "names": "--errors", "description": "How many of the last errors 
to show", "defaultValue": "5", "javaType": "int", "type": "integer" }, { 
"names": "--json", "descri [...]
     { "name": "stop", "fullName": "stop", "description": "Shuts down running 
Camel integrations", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.process.StopProcess", "options": [ { 
"names": "--kill", "description": "To force killing the process (SIGKILL)", 
"javaType": "boolean", "type": "boolean" }, { "names": "--no-wait", 
"description": "Do not wait for the integration to stop", "javaType": 
"boolean", "type": "boolean" }, { "names": "--timeout", "description": "How 
long to wa [...]
     { "name": "top", "fullName": "top", "description": "Top status of Camel 
integrations", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.process.CamelTop", "options": [ { 
"names": "--watch", "description": "Execute periodically and showing output 
fullscreen", "javaType": "boolean", "type": "boolean" }, { "names": 
"-h,--help", "description": "Display this help and exit", "javaType": 
"boolean", "type": "boolean" } ], "subcommands": [ { "name": "context", 
"fullName": "top context [...]
     { "name": "trace", "fullName": "trace", "description": "Tail message 
traces from running Camel integrations", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.action.CamelTraceAction", "options": 
[ { "names": "--action", "description": "Action to start, stop, clear, list 
status, or dump traces", "defaultValue": "status", "javaType": 
"java.lang.String", "type": "string" }, { "names": "--ago", "description": "Use 
ago instead of yyyy-MM-dd HH:mm:ss in timestamp.", "javaType": "b [...]
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CamelJBangMain.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CamelJBangMain.java
index 58b2c02e0998..06e2cc03b40e 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CamelJBangMain.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CamelJBangMain.java
@@ -373,6 +373,9 @@ public class CamelJBangMain implements 
Command<CommandInvocation> {
         if (shouldCreate(only, "harden")) {
             commandLine.addSubcommand("harden", new CommandTree(new 
Harden(this)));
         }
+        if (shouldCreate(only, "status")) {
+            commandLine.addSubcommand("status", new CommandTree(new 
IntegrationStatus(this)));
+        }
         if (shouldCreate(only, "get")) {
             commandLine.addSubcommand("get", new CommandTree(new 
CamelStatus(this))
                     .addSubcommand("bean", new CommandTree(new 
CamelBeanDump(this)))
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/GroupedCommandHelpRenderer.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/GroupedCommandHelpRenderer.java
index 716409751d0c..b3f8d1091dee 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/GroupedCommandHelpRenderer.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/GroupedCommandHelpRenderer.java
@@ -32,7 +32,7 @@ public final class GroupedCommandHelpRenderer {
 
     static {
         GROUPS.put("Running", List.of("run", "dev", "stop", "restart", "ps", 
"log", "shell", "script"));
-        GROUPS.put("Monitoring", List.of("get", "top", "trace", "hawtio", 
"jolokia"));
+        GROUPS.put("Monitoring", List.of("status", "get", "top", "trace", 
"hawtio", "jolokia"));
         GROUPS.put("Actions", List.of("cmd", "bind"));
         GROUPS.put("Development",
                 List.of("init", "export", "debug", "eval", "explain", 
"transform", "dirty", "doctor", "sbom", "nano"));
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/IntegrationStatus.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/IntegrationStatus.java
new file mode 100644
index 000000000000..5a8d0ae92a8d
--- /dev/null
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/IntegrationStatus.java
@@ -0,0 +1,602 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dsl.jbang.core.commands.process;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.StringJoiner;
+
+import org.aesh.command.CommandDefinition;
+import org.aesh.command.option.Argument;
+import org.aesh.command.option.Option;
+import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
+import org.apache.camel.dsl.jbang.core.commands.ai.ReloadOutcome;
+import org.apache.camel.dsl.jbang.core.common.CliException;
+import org.apache.camel.dsl.jbang.core.common.CliExitCode;
+import org.apache.camel.dsl.jbang.core.common.JsonOutput;
+import org.apache.camel.dsl.jbang.core.common.ProcessFinder;
+import org.apache.camel.dsl.jbang.core.common.ProcessFinder.CamelProcess;
+import org.apache.camel.dsl.jbang.run.common.LogFileReader;
+import org.apache.camel.util.StringHelper;
+import org.apache.camel.util.TimeUtils;
+import org.apache.camel.util.UnitUtils;
+import org.apache.camel.util.json.JsonArray;
+import org.apache.camel.util.json.JsonObject;
+
+/**
+ * The state of one running integration in one call (CAMEL-26941): what an 
agent otherwise asks with camel get route,
+ * get health, get error and log, each a JVM of its own.
+ */
+@CommandDefinition(name = "status",
+                   description = "The state of a running Camel integration in 
one call: where it runs and its files,"
+                                 + " its routes, health, last errors and last 
reload, its JVM, and the end of its log",
+                   generateHelp = true,
+                   footer = {
+                           "Examples:",
+                           "  camel status",
+                           "  camel status myapp --json",
+                           "  camel status myapp --log-lines=50" })
+public class IntegrationStatus extends ProcessBaseCommand {
+
+    // how many records of the log are read for the last reload, also when 
fewer are shown
+    private static final int RELOAD_RECORDS = 200;
+
+    @Argument(description = "Name or pid of the running Camel integration 
(default: the only one running)")
+    String name = "*";
+
+    @Option(name = "json", hasValue = false,
+            description = "Output in JSON Format: one document, with the 
routes as camel get route has them, and the log"
+                          + " records newest first")
+    boolean jsonOutput;
+
+    @Option(name = "log-lines", description = "How many of the last log 
records to show", defaultValue = "20")
+    int logLines = 20;
+
+    @Option(name = "errors", description = "How many of the last errors to 
show", defaultValue = "5")
+    int errors = 5;
+
+    public IntegrationStatus(CamelJBangMain main) {
+        super(main);
+    }
+
+    @Override
+    public Integer doCall() throws Exception {
+        // no name (as ActionBaseCommand.findProcesses has it) is the only 
integration that runs
+        String query = name == null || name.isBlank() ? "*" : name;
+        List<CamelProcess> found = ProcessFinder.find(query);
+        if (found.isEmpty() && "*".equals(query)) {
+            throw CliException.notFound("No running Camel integrations");
+        }
+        // one scan when one integration matches; requireOne scans again only 
to tell what is wrong
+        CamelProcess process = found.size() == 1 ? found.get(0) : 
ProcessFinder.requireOne(query);
+        JsonObject log = LogFileReader.read(process.pid(), process.name(), 
Math.max(logLines, RELOAD_RECORDS), null,
+                null, false);
+        JsonObject status = status(process, loadErrorFile(process.pid()), log, 
logLines, errors);
+        if (jsonOutput) {
+            JsonOutput.print(printer(), status);
+        } else {
+            printText(status);
+        }
+        return CliExitCode.OK;
+    }
+
+    /**
+     * The state of the integration as one document.
+     *
+     * @param process   the integration, with its status
+     * @param errorFile its error file, or <tt>null</tt>
+     * @param log       its log as {@link LogFileReader} reads it, newest first
+     * @param logLines  how many log records to keep
+     * @param errors    how many errors to keep
+     */
+    static JsonObject status(CamelProcess process, JsonObject errorFile, 
JsonObject log, int logLines, int errors) {
+        JsonObject root = process.status();
+        JsonObject context = root.get("context") instanceof JsonObject jo ? jo 
: new JsonObject();
+        JsonObject runtime = root.get("runtime") instanceof JsonObject jo ? jo 
: new JsonObject();
+        JsonObject stats = context.get("statistics") instanceof JsonObject jo 
? jo : null;
+        JsonArray routes = routes(root);
+        JsonObject health = health(root);
+        JsonArray lastErrors = errors(errorFile, errors);
+        List<JsonObject> records = records(log);
+        JsonObject reload = reload(stats, records);
+        JsonObject jvm = jvm(root, runtime);
+        JsonObject answer = new JsonObject();
+        answer.put("pid", process.pid());
+        answer.put("name", process.name());
+        answer.put("camelVersion", context.getString("version"));
+        answer.put("platform", runtime.getString("platform"));
+        answer.put("state", context.getString("state"));
+        answer.put("phase", context.getInteger("phase"));
+        answer.put("uptime", context.getLong("uptime"));
+        answer.put("devMode", context.getBoolean("devMode"));
+        answer.put("problems", problems(context.getString("state"), routes, 
health, lastErrors, reload, jvm));
+        // where it was started, and the files of its routes, as an agent 
edits them
+        answer.put("directory", runtime.getString("directory"));
+        answer.put("sources", sources(routes, root));
+        if (stats != null) {
+            JsonObject exchanges = new JsonObject();
+            exchanges.put("total", number(stats.get("exchangesTotal")));
+            exchanges.put("failed", number(stats.get("exchangesFailed")));
+            exchanges.put("inflight", number(stats.get("exchangesInflight")));
+            JsonObject oldest = oldestInflight(root);
+            if (oldest != null) {
+                exchanges.put("oldestInflight", oldest);
+            }
+            answer.put("exchanges", exchanges);
+        }
+        answer.put("routes", routes);
+        answer.put("health", health);
+        answer.put("http", http(root));
+        answer.put("errors", lastErrors);
+        answer.put("reload", reload);
+        answer.put("jvm", jvm);
+        answer.put("log", new JsonArray(records.subList(0, 
Math.min(Math.max(logLines, 0), records.size()))));
+        return answer;
+    }
+
+    /**
+     * What is wrong, in a few words each, so an agent does not have to work 
it out from the rest: a route that is not
+     * started or has failed exchanges, a health check that is down, a failed 
reload, a heap that is nearly full. Empty
+     * when all is well. The failed exchanges are those of the routes, which a 
reload starts again from zero.
+     */
+    private static JsonArray problems(
+            String state, JsonArray routes, JsonObject health, JsonArray 
errors, JsonObject reload, JsonObject jvm) {
+        JsonArray answer = new JsonArray();
+        if (state != null && !"Started".equals(state)) {
+            answer.add("Camel is " + state);
+        }
+        for (Object o : routes) {
+            JsonObject route = (JsonObject) o;
+            String id = route.getString("routeId");
+            String status = route.getString("status");
+            if (status != null && !"Started".equals(status) && 
!"Error".equals(status)) {
+                answer.add("route " + id + " is " + status);
+            }
+            Long failed = route.getLong("failed");
+            JsonObject lastError = route.getMap("lastError");
+            if (failed != null && failed > 0) {
+                String last = newestError(errors, id);
+                if (last == null && lastError != null) {
+                    last = lastError.getString("message");
+                }
+                answer.add("route " + id + ": " + failed + (failed == 1 ? " 
failed exchange" : " failed exchanges")
+                           + (last != null ? ", the last: " + last : ""));
+            } else if (lastError != null) {
+                answer.add("route " + id + " failed (" + 
lastError.getString("phase") + "): "
+                           + lastError.getString("message"));
+            }
+        }
+        JsonArray down = health.getCollection("down");
+        if (down != null) {
+            for (Object o : down) {
+                JsonObject check = (JsonObject) o;
+                answer.add("health check " + check.getString("id") + " is DOWN"
+                           + (check.getString("message") != null ? ": " + 
check.getString("message") : ""));
+            }
+        }
+        if (Boolean.FALSE.equals(health.getBoolean("ready")) && (down == null 
|| down.isEmpty())) {
+            answer.add("not ready");
+        }
+        if (reload.get("last") instanceof JsonObject last && 
"failed".equals(last.getString("status"))) {
+            String message = last.getString("message");
+            answer.add("the last reload failed" + (message != null ? ": " + 
message.lines().findFirst().orElse("") : ""));
+        }
+        Long used = jvm.getLong("heapUsed");
+        Long max = jvm.getLong("heapMax");
+        if (used != null && max != null && max > 0 && used * 10 >= max * 9) {
+            answer.add("the heap is " + used * 100 / max + "% full");
+        }
+        return answer;
+    }
+
+    /**
+     * The newest error of the route, as <tt>type: message</tt>, or 
<tt>null</tt>.
+     */
+    private static String newestError(JsonArray errors, String routeId) {
+        for (Object o : errors) {
+            JsonObject error = (JsonObject) o;
+            if (routeId != null && routeId.equals(error.getString("routeId"))) 
{
+                JsonObject exception = error.getMap("exception");
+                return exception != null ? exception.getString("type") + ": " 
+ exception.getString("message") : null;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * The files of the routes, without the line (<tt>orders.camel.yaml</tt>), 
and the properties files that were loaded
+     * (<tt>application.properties</tt>), as an agent edits those too.
+     */
+    private static JsonArray sources(JsonArray routes, JsonObject root) {
+        Set<String> files = new LinkedHashSet<>();
+        for (Object o : routes) {
+            if (o instanceof JsonObject route && route.getString("source") != 
null) {
+                files.add(route.getString("source").replaceFirst(":\\d+$", 
""));
+            }
+        }
+        if (root.get("properties") instanceof JsonObject properties
+                && properties.get("locations") instanceof JsonArray locations) 
{
+            for (Object o : locations) {
+                String location = String.valueOf(o);
+                if (location.startsWith("file:")) {
+                    // file:./application.properties and 
file:application.properties are the same file
+                    String file = StringHelper.before(location.substring(5), 
";", location.substring(5));
+                    files.add(file.startsWith("./") ? file.substring(2) : 
file);
+                }
+            }
+        }
+        return new JsonArray(new ArrayList<>(files));
+    }
+
+    /**
+     * The exchange that has been inflight the longest, and where it is now, 
when the integration lists its inflight
+     * exchanges (as in dev mode): one that stays at the same place is how a 
hang shows.
+     */
+    private static JsonObject oldestInflight(JsonObject root) {
+        if (!(root.get("inflight") instanceof JsonObject inflight)
+                || !(inflight.get("exchanges") instanceof JsonArray 
exchanges)) {
+            return null;
+        }
+        JsonObject oldest = null;
+        for (Object o : exchanges) {
+            if (o instanceof JsonObject exchange
+                    && (oldest == null
+                            || exchange.getLongOrDefault("duration", 0) > 
oldest.getLongOrDefault("duration", 0))) {
+                oldest = exchange;
+            }
+        }
+        if (oldest == null) {
+            return null;
+        }
+        JsonObject answer = new JsonObject();
+        // the duration of an inflight exchange is the time since it was 
created
+        answer.put("age", oldest.getLong("duration"));
+        answer.put("routeId", oldest.getString("atRouteId"));
+        answer.put("nodeId", oldest.getString("nodeId"));
+        answer.put("source", oldest.getString("nodeSource"));
+        return answer;
+    }
+
+    /**
+     * The Java version, the heap and the threads: a heap near its maximum, or 
a garbage collection that takes longer
+     * and longer, is trouble on its way.
+     */
+    private static JsonObject jvm(JsonObject root, JsonObject runtime) {
+        JsonObject answer = new JsonObject();
+        answer.put("javaVersion", runtime.getString("javaVersion"));
+        answer.put("javaVendor", runtime.getString("javaVendor"));
+        if (root.get("memory") instanceof JsonObject memory) {
+            answer.put("heapUsed", memory.getLong("heapMemoryUsed"));
+            answer.put("heapMax", memory.getLong("heapMemoryMax"));
+        }
+        if (root.get("threads") instanceof JsonObject threads) {
+            answer.put("threads", threads.getInteger("threadCount"));
+        }
+        if (root.get("gc") instanceof JsonObject gc) {
+            answer.put("gcCount", gc.getLong("collectionCount"));
+            answer.put("gcTime", gc.getLong("collectionTime"));
+        }
+        return answer;
+    }
+
+    private static JsonArray routes(JsonObject root) {
+        JsonArray answer = new JsonArray();
+        if (!(root.get("routes") instanceof JsonArray routes)) {
+            return answer;
+        }
+        for (Object o : routes) {
+            if (!(o instanceof JsonObject route)) {
+                continue;
+            }
+            JsonObject jo = new JsonObject();
+            jo.put("routeId", route.getString("routeId"));
+            jo.put("from", route.getString("from"));
+            // where the route is: orders.camel.yaml:4, relative to the 
directory it was started from
+            String source = route.getString("source");
+            jo.put("source", source != null && source.startsWith("file:") ? 
source.substring(5) : source);
+            JsonObject lastError = route.get("lastError") instanceof 
JsonObject le ? le : null;
+            // as camel get route has it
+            jo.put("status", lastError != null ? "Error" : 
route.getString("state"));
+            String uptime = route.getString("uptime");
+            jo.put("uptime", uptime != null ? TimeUtils.toMilliSeconds(uptime) 
: null);
+            if (route.get("statistics") instanceof JsonObject stats) {
+                jo.put("total", number(stats.get("exchangesTotal")));
+                jo.put("failed", number(stats.get("exchangesFailed")));
+                jo.put("inflight", number(stats.get("exchangesInflight")));
+            }
+            if (lastError != null) {
+                JsonObject error = new JsonObject();
+                error.put("phase", lastError.getString("phase"));
+                error.put("timestamp", lastError.getLong("timestamp"));
+                error.put("message", lastError.getString("message"));
+                jo.put("lastError", error);
+            }
+            answer.add(jo);
+        }
+        return answer;
+    }
+
+    private static JsonObject health(JsonObject root) {
+        JsonObject answer = new JsonObject();
+        if (!(root.get("healthChecks") instanceof JsonObject hc)) {
+            return answer;
+        }
+        answer.put("up", hc.getBoolean("up"));
+        answer.put("ready", hc.getBoolean("ready"));
+        answer.put("live", hc.getBoolean("live"));
+        JsonArray down = new JsonArray();
+        if (hc.get("checks") instanceof JsonArray checks) {
+            for (Object o : checks) {
+                if (o instanceof JsonObject check && 
"DOWN".equals(check.getString("state"))) {
+                    JsonObject jo = new JsonObject();
+                    jo.put("id", check.getString("id"));
+                    jo.put("message", check.getString("message"));
+                    down.add(jo);
+                }
+            }
+        }
+        answer.put("down", down);
+        return answer;
+    }
+
+    /**
+     * How to reach the integration over HTTP: the server, the endpoints of 
the routes, and the management endpoints,
+     * such as the health check, so an agent does not have to guess the port.
+     */
+    private static JsonObject http(JsonObject root) {
+        JsonObject answer = new JsonObject();
+        JsonArray endpoints = new JsonArray();
+        JsonArray management = new JsonArray();
+        if (root.get("platform-http") instanceof JsonObject ph) {
+            if (ph.getString("server") != null) {
+                answer.put("server", ph.getString("server"));
+            }
+            endpoints(ph.get("endpoints"), endpoints);
+            endpoints(ph.get("managementEndpoints"), management);
+        }
+        answer.put("endpoints", endpoints);
+        answer.put("management", management);
+        return answer;
+    }
+
+    private static void endpoints(Object list, JsonArray answer) {
+        if (list instanceof JsonArray endpoints) {
+            for (Object o : endpoints) {
+                if (o instanceof JsonObject endpoint) {
+                    JsonObject jo = new JsonObject();
+                    jo.put("url", endpoint.getString("url"));
+                    if (endpoint.getString("verbs") != null) {
+                        jo.put("verbs", endpoint.getString("verbs"));
+                    }
+                    answer.add(jo);
+                }
+            }
+        }
+    }
+
+    /**
+     * The last errors, newest first, without the messages and the message 
history the error file also has.
+     */
+    private static JsonArray errors(JsonObject errorFile, int limit) {
+        List<JsonObject> all = new ArrayList<>();
+        if (errorFile != null && errorFile.get("errors") instanceof JsonArray 
arr) {
+            for (Object o : arr) {
+                if (o instanceof JsonObject error) {
+                    all.add(error);
+                }
+            }
+        }
+        all.sort(Comparator.comparingLong((JsonObject e) -> 
e.getLongOrDefault("timestamp", 0)).reversed());
+        JsonArray answer = new JsonArray();
+        for (JsonObject error : all.subList(0, Math.min(Math.max(limit, 0), 
all.size()))) {
+            JsonObject jo = new JsonObject();
+            jo.put("timestamp", error.getLong("timestamp"));
+            jo.put("routeId", error.getString("routeId"));
+            jo.put("nodeId", error.getString("nodeId"));
+            jo.put("exchangeId", error.getString("exchangeId"));
+            jo.put("handled", error.getBoolean("handled"));
+            if (error.get("exception") instanceof JsonObject exception) {
+                JsonObject ex = new JsonObject();
+                ex.put("type", exception.getString("type"));
+                ex.put("message", exception.getString("message"));
+                jo.put("exception", ex);
+            }
+            answer.add(jo);
+        }
+        return answer;
+    }
+
+    /**
+     * The reloads of dev mode as Camel counts them, and the outcome of the 
last one from the log.
+     */
+    private static JsonObject reload(JsonObject stats, List<JsonObject> 
records) {
+        JsonObject answer = new JsonObject();
+        if (stats != null && stats.get("reload") instanceof JsonObject counts) 
{
+            answer.put("reloaded", number(counts.get("reloaded")));
+            answer.put("failed", number(counts.get("failed")));
+        }
+        JsonObject last = ReloadOutcome.classify(records, null);
+        if (last != null) {
+            answer.put("last", last);
+        }
+        return answer;
+    }
+
+    private static List<JsonObject> records(JsonObject log) {
+        List<JsonObject> answer = new ArrayList<>();
+        if (log != null && log.get("lines") instanceof JsonArray lines) {
+            for (Object o : lines) {
+                if (o instanceof JsonObject record) {
+                    answer.add(record);
+                }
+            }
+        }
+        return answer;
+    }
+
+    private static Long number(Object value) {
+        return value != null ? JsonValues.number(value.toString()) : null;
+    }
+
+    private void printText(JsonObject status) {
+        StringBuilder sb = new StringBuilder();
+        sb.append(status.getString("name")).append(" (pid 
").append(status.getLong("pid")).append(")");
+        if (status.getString("camelVersion") != null) {
+            sb.append(", Camel ").append(status.getString("camelVersion"));
+        }
+        if (status.getString("platform") != null) {
+            sb.append(" (").append(status.getString("platform")).append(")");
+        }
+        sb.append(": ").append(status.getString("state"));
+        if (status.getLong("uptime") != null) {
+            sb.append(", up 
").append(TimeUtils.printDuration(status.getLong("uptime")));
+        }
+        if (Boolean.TRUE.equals(status.getBoolean("devMode"))) {
+            sb.append(", dev mode");
+        }
+        printer().println(sb.toString());
+        JsonArray problems = status.getCollection("problems");
+        if (problems.isEmpty()) {
+            printer().println("Problems: none");
+        } else {
+            printer().println("Problems:");
+            for (Object o : problems) {
+                printer().println("  - " + o);
+            }
+        }
+        if (status.getString("directory") != null) {
+            printer().println("Directory: " + status.getString("directory"));
+        }
+        JsonArray sources = status.getCollection("sources");
+        if (!sources.isEmpty()) {
+            StringJoiner files = new StringJoiner(", ");
+            sources.forEach(f -> files.add(f.toString()));
+            printer().println("Sources: " + files);
+        }
+        if (status.get("exchanges") instanceof JsonObject ex) {
+            String oldest = "";
+            if (ex.get("oldestInflight") instanceof JsonObject o) {
+                oldest = " (the oldest " + 
TimeUtils.printDuration(o.getLongOrDefault("age", 0)) + ", now at "
+                         + o.getString("routeId") + "/" + o.getString("nodeId")
+                         + (o.getString("source") != null ? " " + 
o.getString("source") : "") + ")";
+            }
+            printer().println("Exchanges: " + ex.getLong("total") + " total, " 
+ ex.getLong("failed") + " failed, "
+                              + ex.getLong("inflight") + " inflight" + oldest);
+        }
+        JsonArray routes = status.getCollection("routes");
+        printer().println("Routes:" + (routes.isEmpty() ? " none" : ""));
+        for (Object o : routes) {
+            JsonObject r = (JsonObject) o;
+            printer().println("  " + r.getString("routeId") + "  " + 
r.getString("status") + "  " + r.getString("from")
+                              + (r.getString("source") != null ? "  " + 
r.getString("source") : "")
+                              + "  (" + r.getLong("total") + " total, " + 
r.getLong("failed") + " failed, "
+                              + r.getLong("inflight") + " inflight)");
+            if (r.get("lastError") instanceof JsonObject le) {
+                printer().println("    last error (" + le.getString("phase") + 
"): " + le.getString("message"));
+            }
+        }
+        JsonObject health = status.getMap("health");
+        if (health.getBoolean("up") != null) {
+            JsonArray down = health.getCollection("down");
+            printer().println("Health: " + 
(Boolean.TRUE.equals(health.getBoolean("up")) ? "UP" : "DOWN")
+                              + 
(Boolean.TRUE.equals(health.getBoolean("ready")) ? ", ready" : ", not ready")
+                              + 
(Boolean.TRUE.equals(health.getBoolean("live")) ? ", live" : ", not live"));
+            for (Object o : down) {
+                JsonObject d = (JsonObject) o;
+                printer().println("  DOWN " + d.getString("id") + 
(d.getString("message") != null
+                        ? ": " + d.getString("message") : ""));
+            }
+        }
+        JsonObject http = status.getMap("http");
+        JsonArray endpoints = http.getCollection("endpoints");
+        JsonArray management = http.getCollection("management");
+        if (http.getString("server") != null || !endpoints.isEmpty() || 
!management.isEmpty()) {
+            printer().println("HTTP:" + (http.getString("server") != null ? " 
" + http.getString("server") : ""));
+            for (Object o : endpoints) {
+                JsonObject h = (JsonObject) o;
+                printer().println("  " + (h.getString("verbs") != null ? 
h.getString("verbs") + " " : "")
+                                  + h.getString("url"));
+            }
+            for (Object o : management) {
+                JsonObject h = (JsonObject) o;
+                printer().println("  management: " + h.getString("url"));
+            }
+        }
+        JsonArray errors = status.getCollection("errors");
+        if (!errors.isEmpty()) {
+            printer().println("Errors (newest first):");
+            for (Object o : errors) {
+                JsonObject e = (JsonObject) o;
+                Long ts = e.getLong("timestamp");
+                JsonObject ex = e.getMap("exception");
+                printer().println("  " + (ts != null ? 
TimeUtils.printSince(ts) + " ago  " : "") + e.getString("routeId")
+                                  + (ex != null ? "  " + ex.getString("type") 
+ ": " + ex.getString("message") : ""));
+            }
+        }
+        JsonObject reload = status.getMap("reload");
+        if (reload.getLong("reloaded") != null || reload.get("last") != null) {
+            StringBuilder rl = new StringBuilder("Reload: ");
+            if (reload.getLong("reloaded") != null) {
+                rl.append(reload.getLong("reloaded")).append(" reloaded, 
").append(reload.getLong("failed"))
+                        .append(" failed");
+            }
+            if (reload.get("last") instanceof JsonObject last) {
+                String message = last.getString("message");
+                rl.append(reload.getLong("reloaded") != null ? "; last: " : 
"last: ").append(last.getString("status"));
+                if (message != null) {
+                    // the first line: a failure has the cause and the 
validator's report below it
+                    rl.append(": 
").append(message.lines().findFirst().orElse(""));
+                }
+            }
+            printer().println(rl.toString());
+        }
+        JsonObject jvm = status.getMap("jvm");
+        StringJoiner vm = new StringJoiner(", ");
+        if (jvm.getString("javaVersion") != null) {
+            vm.add("Java " + jvm.getString("javaVersion")
+                   + (jvm.getString("javaVendor") != null ? " (" + 
jvm.getString("javaVendor") + ")" : ""));
+        }
+        Long heapUsed = jvm.getLong("heapUsed");
+        if (heapUsed != null) {
+            Long heapMax = jvm.getLong("heapMax");
+            vm.add("heap " + UnitUtils.printUnitFromBytesDot(heapUsed)
+                   + (heapMax != null && heapMax > 0 ? " of " + 
UnitUtils.printUnitFromBytesDot(heapMax) : ""));
+        }
+        if (jvm.getInteger("threads") != null) {
+            vm.add(jvm.getInteger("threads") + " threads");
+        }
+        if (jvm.getLong("gcCount") != null) {
+            vm.add(jvm.getLong("gcCount") + " GCs (" + jvm.getLong("gcTime") + 
" ms)");
+        }
+        if (vm.length() > 0) {
+            printer().println("JVM: " + vm);
+        }
+        JsonArray log = status.getCollection("log");
+        if (!log.isEmpty()) {
+            printer().println("Log (last " + log.size() + " records):");
+            // oldest first, as a log reads
+            for (int i = log.size() - 1; i >= 0; i--) {
+                JsonObject r = (JsonObject) log.get(i);
+                printer().println("  " + r.getString("time") + " " + 
r.getString("level") + " " + r.getString("message"));
+            }
+        }
+    }
+
+}
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/process/IntegrationStatusTest.java
 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/process/IntegrationStatusTest.java
new file mode 100644
index 000000000000..a4aff4035a3e
--- /dev/null
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/process/IntegrationStatusTest.java
@@ -0,0 +1,275 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dsl.jbang.core.commands.process;
+
+import java.nio.file.Files;
+import java.util.List;
+import java.util.stream.Stream;
+
+import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
+import org.apache.camel.dsl.jbang.core.common.CliException;
+import org.apache.camel.dsl.jbang.core.common.CliExitCode;
+import org.apache.camel.dsl.jbang.core.common.CommandLineHelper;
+import org.apache.camel.util.json.JsonArray;
+import org.apache.camel.util.json.JsonObject;
+import org.apache.camel.util.json.Jsoner;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.MockedStatic;
+import org.mockito.junit.jupiter.MockitoExtension;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.Mockito.mockStatic;
+
+/**
+ * camel status: the state of one integration in one call (CAMEL-26941).
+ */
+@ExtendWith(MockitoExtension.class)
+class IntegrationStatusTest extends ProcessCommandTestSupport {
+
+    @Test
+    void theStateOfTheIntegrationInOneDocument() throws Exception {
+        writeIntegration();
+        IntegrationStatus command = command();
+        command.jsonOutput = true;
+
+        assertThat(call(command)).isEqualTo(CliExitCode.OK);
+
+        JsonObject status = json(printer.getStdout());
+        assertThat(status.getLong("pid")).isEqualTo(TEST_PID);
+        assertThat(status.getString("name")).isEqualTo("orders");
+        assertThat(status.getString("camelVersion")).isEqualTo("4.24.0");
+        assertThat(status.getString("platform")).isEqualTo("JBang");
+        assertThat(status.getString("state")).isEqualTo("Started");
+        assertThat(status.getInteger("phase")).isEqualTo(5);
+        assertThat(status.getLong("uptime")).isEqualTo(65000L);
+        assertThat(status.getBoolean("devMode")).isTrue();
+        // what is wrong, so an agent does not have to work it out from the 
rest
+        JsonArray problems = status.getCollection("problems");
+        assertThat(problems).containsExactly(
+                "route orders: 2 failed exchanges, the last: 
java.lang.IllegalStateException: Boom",
+                "health check kafka is DOWN: Connection refused");
+        assertThat(status.getString("directory")).isEqualTo("/work/orders");
+        // the files of the routes, and the properties file, which is loaded 
under two names
+        JsonArray sources = status.getCollection("sources");
+        assertThat(sources).containsExactly("orders.camel.yaml", 
"application.properties");
+        JsonObject exchanges = status.getMap("exchanges");
+        assertThat(exchanges.getLong("total")).isEqualTo(12L);
+        assertThat(exchanges.getLong("failed")).isEqualTo(2L);
+        JsonObject oldest = exchanges.getMap("oldestInflight");
+        assertThat(oldest.getLong("age")).isEqualTo(75000L);
+        assertThat(oldest.getString("routeId")).isEqualTo("orders");
+        assertThat(oldest.getString("nodeId")).isEqualTo("to1");
+        
assertThat(oldest.getString("source")).isEqualTo("orders.camel.yaml:9");
+
+        JsonArray routes = status.getCollection("routes");
+        assertThat(routes).hasSize(1);
+        JsonObject route = (JsonObject) routes.get(0);
+        assertThat(route.getString("routeId")).isEqualTo("orders");
+        assertThat(route.getString("source")).isEqualTo("orders.camel.yaml:4");
+        // as camel get route has it: a route with a last error is in error
+        assertThat(route.getString("status")).isEqualTo("Error");
+        assertThat(route.getLong("uptime")).isEqualTo(60000L);
+        assertThat(route.getLong("failed")).isEqualTo(2L);
+        JsonObject lastError = route.getMap("lastError");
+        assertThat(lastError.getString("message")).isEqualTo("Boom");
+
+        JsonObject health = status.getMap("health");
+        assertThat(health.getBoolean("up")).isFalse();
+        JsonArray down = health.getCollection("down");
+        assertThat(down).hasSize(1);
+        JsonObject kafka = (JsonObject) down.get(0);
+        assertThat(kafka.getString("id")).isEqualTo("kafka");
+
+        JsonObject http = status.getMap("http");
+        assertThat(http.getString("server")).isEqualTo("http://0.0.0.0:8080";);
+        JsonArray endpoints = http.getCollection("endpoints");
+        JsonObject endpoint = (JsonObject) endpoints.get(0);
+        
assertThat(endpoint.getString("url")).isEqualTo("http://0.0.0.0:8080/orders";);
+        JsonArray management = http.getCollection("management");
+        JsonObject healthEndpoint = (JsonObject) management.get(0);
+        
assertThat(healthEndpoint.getString("url")).isEqualTo("http://0.0.0.0:9876/observe/health";);
+
+        // the newest error first, without its message and history
+        JsonArray errors = status.getCollection("errors");
+        assertThat(errors).hasSize(2);
+        JsonObject newest = (JsonObject) errors.get(0);
+        assertThat(newest.getString("exchangeId")).isEqualTo("ex-2");
+        JsonObject exception = newest.getMap("exception");
+        assertThat(exception.getString("message")).isEqualTo("Boom");
+        assertThat(newest.containsKey("messageHistory")).isFalse();
+
+        JsonObject reload = status.getMap("reload");
+        assertThat(reload.getLong("reloaded")).isEqualTo(3L);
+        JsonObject last = reload.getMap("last");
+        assertThat(last.getString("status")).isEqualTo("reloaded");
+
+        JsonObject jvm = status.getMap("jvm");
+        assertThat(jvm.getString("javaVersion")).isEqualTo("21.0.2");
+        assertThat(jvm.getLong("heapUsed")).isEqualTo(40000000L);
+        assertThat(jvm.getLong("heapMax")).isEqualTo(512000000L);
+        assertThat(jvm.getInteger("threads")).isEqualTo(11);
+        assertThat(jvm.getLong("gcTime")).isEqualTo(13L);
+
+        // newest first, as camel_get_log has them
+        JsonArray log = status.getCollection("log");
+        assertThat(log).hasSize(4);
+        JsonObject newestRecord = (JsonObject) log.get(0);
+        assertThat(newestRecord.getString("message")).isEqualTo("Processing 
order 2");
+    }
+
+    @Test
+    void theLimitsOfTheLogAndTheErrors() throws Exception {
+        writeIntegration();
+        IntegrationStatus command = command();
+        command.jsonOutput = true;
+        command.logLines = 1;
+        command.errors = 1;
+
+        assertThat(call(command)).isEqualTo(CliExitCode.OK);
+
+        JsonObject status = json(printer.getStdout());
+        JsonArray log = status.getCollection("log");
+        assertThat(log).hasSize(1);
+        JsonArray errors = status.getCollection("errors");
+        assertThat(errors).hasSize(1);
+        // the last reload is found in the log also when the record is not 
shown
+        JsonObject reload = status.getMap("reload");
+        JsonObject last = reload.getMap("last");
+        assertThat(last.getString("status")).isEqualTo("reloaded");
+    }
+
+    @Test
+    void textForAPerson() throws Exception {
+        writeIntegration();
+
+        assertThat(call(command())).isEqualTo(CliExitCode.OK);
+
+        assertThat(printer.getStdout()).contains(
+                "orders (pid 12345), Camel 4.24.0 (JBang): Started, up 1m5s, 
dev mode",
+                "Problems:",
+                "  - route orders: 2 failed exchanges, the last: 
java.lang.IllegalStateException: Boom",
+                "  - health check kafka is DOWN: Connection refused",
+                "Exchanges: 12 total, 2 failed, 1 inflight (the oldest 1m15s, 
now at orders/to1 orders.camel.yaml:9)",
+                "Directory: /work/orders",
+                "Sources: orders.camel.yaml, application.properties",
+                "  orders  Error  timer://tick  orders.camel.yaml:4  (12 
total, 2 failed, 0 inflight)",
+                "    last error (processing): Boom",
+                "Health: DOWN, ready, live",
+                "  DOWN kafka: Connection refused",
+                "HTTP: http://0.0.0.0:8080";,
+                "  GET http://0.0.0.0:8080/orders";,
+                "  management: http://0.0.0.0:9876/observe/health";,
+                "Reload: 3 reloaded, 0 failed; last: reloaded: Routes reloaded 
summary (total:1 started:1)",
+                "JVM: Java 21.0.2 (Eclipse Adoptium), heap 40.0 MB of 512.0 
MB, 11 threads, 10 GCs (13 ms)",
+                "Log (last 4 records):");
+    }
+
+    @Test
+    void noProblems() throws Exception {
+        writeStatusFile(TEST_PID, json("""
+                
{"context":{"name":"orders","version":"4.24.0","state":"Started","phase":5,"uptime":5000,
+                   
"statistics":{"exchangesTotal":3,"exchangesFailed":0,"exchangesInflight":0}},
+                 
"routes":[{"routeId":"orders","from":"timer://tick","state":"Started","uptime":"5s",
+                   
"statistics":{"exchangesTotal":3,"exchangesFailed":0,"exchangesInflight":0}}],
+                 
"healthChecks":{"up":true,"ready":true,"live":true,"checks":[{"id":"routes","state":"UP"}]}}
+                """));
+        IntegrationStatus command = command();
+        command.jsonOutput = true;
+
+        assertThat(call(command)).isEqualTo(CliExitCode.OK);
+        JsonArray problems = 
json(printer.getStdout()).getCollection("problems");
+        assertThat(problems).isEmpty();
+
+        // the text says so too
+        assertThat(call(command())).isEqualTo(CliExitCode.OK);
+        assertThat(printer.getStdout()).contains("Problems: none");
+    }
+
+    @Test
+    void nothingRunning() {
+        IntegrationStatus command = command();
+
+        try (MockedStatic<ProcessHandle> mocked = 
mockStatic(ProcessHandle.class)) {
+            ProcessHandle current = mockCurrentHandle();
+            mocked.when(ProcessHandle::current).thenReturn(current);
+            mocked.when(ProcessHandle::allProcesses).thenAnswer(inv -> 
Stream.empty());
+
+            
assertThatThrownBy(command::doCall).isInstanceOf(CliException.class)
+                    .hasMessage("No running Camel integrations")
+                    .extracting(e -> ((CliException) 
e).getExitCode()).isEqualTo(CliExitCode.NOT_FOUND);
+        }
+    }
+
+    private IntegrationStatus command() {
+        return new IntegrationStatus(new 
CamelJBangMain().withPrinter(printer));
+    }
+
+    private static int call(IntegrationStatus command) throws Exception {
+        try (MockedStatic<ProcessHandle> mocked = 
mockStatic(ProcessHandle.class)) {
+            ProcessHandle ph = mockProcessHandle(TEST_PID);
+            ProcessHandle current = mockCurrentHandle();
+            mocked.when(ProcessHandle::current).thenReturn(current);
+            mocked.when(ProcessHandle::allProcesses).thenAnswer(inv -> 
Stream.of(ph));
+            return command.doCall();
+        }
+    }
+
+    private static void writeIntegration() throws Exception {
+        writeStatusFile(TEST_PID,
+                json("""
+                        
{"runtime":{"pid":12345,"platform":"JBang","directory":"/work/orders","javaVersion":"21.0.2",
+                           "javaVendor":"Eclipse Adoptium"},
+                         
"context":{"name":"orders","version":"4.24.0","state":"Started","phase":5,"uptime":65000,"devMode":true,
+                           
"statistics":{"exchangesTotal":12,"exchangesFailed":2,"exchangesInflight":1,
+                             "reload":{"reloaded":3,"failed":0}}},
+                         
"routes":[{"routeId":"orders","from":"timer://tick","source":"file:orders.camel.yaml:4","state":"Started","uptime":"1m0s",
+                           
"statistics":{"exchangesTotal":12,"exchangesFailed":2,"exchangesInflight":0},
+                           
"lastError":{"phase":"processing","timestamp":1794600000000,"message":"Boom"}}],
+                         
"healthChecks":{"up":false,"ready":true,"live":true,"checks":[
+                           {"id":"routes","state":"UP"},
+                           {"id":"kafka","state":"DOWN","message":"Connection 
refused"}]},
+                         
"memory":{"heapMemoryUsed":40000000,"heapMemoryMax":512000000},"threads":{"threadCount":11},
+                         "gc":{"collectionCount":10,"collectionTime":13},
+                         
"properties":{"locations":["file:application.properties","file:./application.properties"]},
+                         
"inflight":{"inflight":1,"inflightBrowseEnabled":true,"exchanges":[
+                           
{"exchangeId":"ex-3","fromRouteId":"orders","atRouteId":"orders","nodeId":"to1",
+                            
"nodeSource":"orders.camel.yaml:9","duration":75000}]},
+                         "platform-http":{"server":"http://0.0.0.0:8080";,
+                           
"endpoints":[{"url":"http://0.0.0.0:8080/orders","path":"/orders","verbs":"GET"}],
+                           
"managementEndpoints":[{"url":"http://0.0.0.0:9876/observe/health","path":"/observe/health"}]}}
+                        """));
+        Files.writeString(CommandLineHelper.getCamelDir().resolve(TEST_PID + 
"-error.json"), json("""
+                {"errors":[
+                  
{"timestamp":1794600000000,"routeId":"orders","nodeId":"to1","exchangeId":"ex-1","handled":false,
+                   
"exception":{"type":"java.lang.IllegalStateException","message":"Old"},"messageHistory":["a"]},
+                  
{"timestamp":1794600005000,"routeId":"orders","nodeId":"to1","exchangeId":"ex-2","handled":false,
+                   
"exception":{"type":"java.lang.IllegalStateException","message":"Boom"},"messageHistory":["b"]}]}
+                """).toJson());
+        Files.write(CommandLineHelper.getCamelDir().resolve(TEST_PID + 
".log"), List.of(
+                "2026-11-13 20:48:00.001  INFO 12345 --- [main] 
org.apache.camel.main.MainSupport : Started orders",
+                "2026-11-13 20:48:05.069  INFO 12345 --- [rReloadStrategy] 
.support.RouteWatcherReloadStrategy"
+                                                                               
                                      + " : Routes reloaded summary (total:1 
started:1)",
+                "2026-11-13 20:48:06.075  INFO 12345 --- [ - timer://tick] 
orders.camel.yaml:8 : Processing order 1",
+                "2026-11-13 20:48:07.079  INFO 12345 --- [ - timer://tick] 
orders.camel.yaml:8 : Processing order 2"));
+    }
+
+    private static JsonObject json(String text) {
+        return Jsoner.deserialize(text.trim(), (JsonObject) null);
+    }
+}
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/test/resources/golden/cli-help.txt 
b/dsl/camel-jbang/camel-jbang-core/src/test/resources/golden/cli-help.txt
index d08fe9e29773..6f71ecd415c2 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/test/resources/golden/cli-help.txt
+++ b/dsl/camel-jbang/camel-jbang-core/src/test/resources/golden/cli-help.txt
@@ -20,6 +20,9 @@ Running:
     script      Run Camel integration as shell script for terminal scripting
 
 Monitoring:
+    status      The state of a running Camel integration in one call: where it
+                runs and its files, its routes, health, last errors and last
+                reload, its JVM, and the end of its log
     get         Get status of Camel integrations (use get --help to see sub
                 commands)
     top         Top status of Camel integrations (use top --help to see sub
@@ -6126,6 +6129,31 @@ Examples:
 
 Press Ctrl-C to exit.
 
+== camel status --help
+The state of a running Camel integration in one call: where it runs and its
+files, its routes, health, last errors and last reload, its JVM, and the end of
+its log
+Usage: camel status [-h] [--json] [--log-lines=<log-lines>] [--errors=<errors>]
+                     [<name>]
+
+Options:
+  -h, --help                Display this help and exit
+      --json                Output in JSON Format: one document, with the 
routes
+                            as camel get route has them, and the log records
+                            newest first
+      --log-lines=<log-lines>
+                            How many of the last log records to show
+                            Default: 20
+      --errors=<errors>     How many of the last errors to show
+                            Default: 5
+  <name>                    Name or pid of the running Camel integration
+                            (default: the only one running)
+
+Examples:
+  camel status
+  camel status myapp --json
+  camel status myapp --log-lines=50
+
 == camel stop --help
 Shuts down running Camel integrations
 Usage: camel stop [-h] [--kill] [--timeout=<timeout>] [--no-wait] [<name>]
@@ -6807,7 +6835,7 @@ Examples:
 == camel no-such-command
 exit: 2
 stderr:
-  ERROR: 'camel no-such-command' is not a subcommand of 'camel'. Available: 
run, dev, stop, restart, ps, log, shell, script, get, top, trace, hawtio, 
jolokia, cmd, bind, init, export, debug, eval, explain, transform, dirty, 
doctor, sbom, nano, config, dependency, version, update, wrapper, completion, 
plugin, catalog, doc, infra, ask, harden, overview, semantic. See 'camel 
--help'.
+  ERROR: 'camel no-such-command' is not a subcommand of 'camel'. Available: 
run, dev, stop, restart, ps, log, shell, script, status, get, top, trace, 
hawtio, jolokia, cmd, bind, init, export, debug, eval, explain, transform, 
dirty, doctor, sbom, nano, config, dependency, version, update, wrapper, 
completion, plugin, catalog, doc, infra, ask, harden, overview, semantic. See 
'camel --help'.
   Usage: camel [-hV] [COMMAND]
   Try 'camel --help' for more information.
   Maybe a specific Camel CLI plugin must be installed? (Try 'camel plugin 
--help' for more information)

Reply via email to