RabbitMQ
Common parts of every card (states, backoff, Unit and ExecReload, Test config, manual commands) are described in Monitor window.
| Detected by | systemd units rabbitmq-server or binaries rabbitmq-server |
| Read every | 5 minutes while the Monitor window shows the tab |
| Active probe | yes, off by default |
| Test config | none |
| Manual commands | 2 |
What the card reads and shows
Section titled “What the card reads and shows”RabbitMQ: the running node (process, node name, the listening ports of the broker and epmd), installed versions, the configuration (a closed list of keys of rabbitmq.conf and conf.d, the enabled plugins, only the state of advanced.config and rabbitmq-env.conf); with the active probe the node’s own view through rabbitmq-diagnostics: versions, alarms, memory and disk against their limits, totals and the queues of vhost / (counts; the top 20 by messages with names the card shows only when expanded).
Passive: on the host the probe finds the running node (beam.smp whose argv has -s rabbit; real and effective uid of root, the rabbitmq account or the session’s, the same PID namespace, a trusted exe). Of its argv only the node name (-sname/-name, closed alphabet), -home (an absolute path) and whether -setcookie is there leave the host; the cookie itself never does. Listening ports come from /proc/net/tcp{,6} (no command). rabbitmq/reader.sh reads the files, rabbitmq/filter.awk keeps a closed list of keys with checked values (never default_pass, ssl_options.password, ldap.*, …). advanced.config (Erlang terms) and rabbitmq-env.conf (a shell script) are never read: only whether they exist and their size. The Erlang cookie file is never opened (the gate only tests -f/-r).
Active (off by default): at most two calls of rabbitmq-diagnostics per run (status --formatter json through jq, list_queues -p /), each an Erlang VM, only behind a gate: the node runs in KryoDesk’s PID namespace with a known node name and no -setcookie, epmd listens (else the CLI would start one), a trusted CLI, erl and /usr/bin/env. Erlang distribution trusts both sides fully (the node may run code in the CLI), so the CLI runs as the node’s own account: a root session drops to it with a trusted setpriv (none: not run), another session only when it is that account. HOME is that account’s home from passwd, with an existing readable .erlang.cookie (else Erlang creates one). For a node of root the CLI’s scripts and rabbitmq-env.conf must be root’s. Clean environment (env -i, ERL_CRASH_DUMP_BYTES=0, cd /), the CLI’s own -t and GNU timeout around it, output limits, errors only as codes of a closed list of templates.
Card layout
Section titled “Card layout”Headline: Node name ((long names)), product and version (from the node, else the installed package), uptime. Then the card’s findings, each tagged Alarm: (red), Warning: (orange) or Note: (grey):
| Tag | Text | Condition |
|---|---|---|
| Alarm | memory alarm: publishers are blocked (node …), disk alarm: publishers are blocked, file descriptor limit reached, alarm |
Alarms in the node’s status (active probe). |
| Warning | the node’s command line holds -setcookie: the Erlang cookie (full control of the node) is visible to every account through ps and /proc | -setcookie in the node’s argv. |
| Warning | loopback_users = none (…): the guest account may log in from other hosts (if it exists with its default password) | loopback_users = none or loopback_users.guest = false. |
| Warning | memory N of the high watermark M (P%) | Memory at 90 % of the watermark or more. |
| Warning | free disk N is less than twice the limit M | Free disk below twice disk_free_limit. |
| Warning | the node is in maintenance mode | — |
| Warning | N queue(s) of vhost / hold messages and have no consumer | — |
| Warning | N queue(s) of vhost / are down, crashed, stopped or without a quorum (minority) | — |
| Warning | rabbitmq-diagnostics was refused (account or Erlang cookie): the probe stops until Retry | — |
| Note | port N ( |
Ports 15672 (management), 25672 (distribution), 4369 (epmd) on all addresses. |
Passive part:
- Process (node processes and the executable; others not used and why), Home (its
.erlang.cookieis never read), Listening (4369, 5671, 5672, 15671, 15672, 15692, 25672 with their role and address), epmd (listens on 4369, orange not listening on 4369 while a node runs), Erlang/OTP installed. - Configuration: each listed key with its value and
file:line; values overridden by a later file are grey (Show overridden values (N)); ? (unusual characters, not shown). Plugins fromenabled_plugins; the state and size ofadvanced.configandrabbitmq-env.conf.
Node status (active probe): the exact CLI line with the account and HOME it runs as, then:
| Line | Content and colour |
|---|---|
| Alarms | Green none, red alarm: |
| Memory | Used of the high watermark with percent; orange from 90 %. |
| Disk | Free and the limit; orange when free is below twice the limit. |
| File descriptors, Totals (queues, connections, vhosts), Erlang, Maintenance (orange yes), Listeners, Config files | From status. |
Queues of vhost /: N queues, N messages; N without consumers (N of them hold messages), N
down, crashed, stopped or in minority (the last two orange when above 0; at least when the
output was cut). Show the N largest queues (names may carry customer data) lists up to 20 with
messages, consumers and a state other than running; a queue with messages and no consumer is
orange. Over 5000 queues the list is not asked.
Active probe
Section titled “Active probe”Runs: rabbitmq-diagnostics -q -n <node of the running beam.smp> [-l] -t 15 status –formatter json (through jq: versions, alarms, memory and disk against their limits, totals, listeners) and -t 30 list_queues -p / –no-table-headers name messages consumers state (counts; the 20 largest queues with names from a closed alphabet), at most these two calls per run, every 5 min while the Monitor is open. The CLI starts an Erlang VM (seconds of CPU, ~100 MB) that connects to the node with Erlang distribution and uses the Erlang cookie: the cookie is full control of the node and of its whole cluster, and the node fully trusts the CLI and vice versa (either may run code in the other). So the CLI’s VM always runs as the node’s own account: a root session drops to it with a trusted setpriv (–reuid/–regid of that account, –init-groups, –no-new-privs; without setpriv nothing runs), another session only when it is that account; HOME is that account’s home from passwd (its .erlang.cookie must exist and be readable, else Erlang would create one; KryoDesk never opens it). Clean environment (env -i, ERL_CRASH_DUMP_BYTES=0, cd /), the CLI’s own -t and GNU timeout around it. Only when the node runs in KryoDesk’s PID namespace with a known node name and no -setcookie on its command line, epmd listens on 4369 (else the CLI would start one), the CLI, erl, jq and /usr/bin/env are trusted, and for a node of root the CLI’s scripts and rabbitmq-env.conf are root’s. Errors only as codes of a closed list (the text stays on the host). The list is not asked when status does not give the number of queues or it is over 5000
Traces on the host: each call is a short Erlang node (rabbitmqcli-…) connecting to the broker as the node’s account (in the broker’s log only with debug logging); with setpriv no su/runuser and no PAM session; no crash dump (ERL_CRASH_DUMP_BYTES=0); a temporary stderr file rabbitmq-cli.err in KryoDesk’s lock directory (removed after the run) and the lock file kryodesk/rabbitmq.lock. A cookie or account error stops the probe until Retry
Test config
Section titled “Test config”None: RabbitMQ has no check of its configuration without starting the node: cuttlefish translates rabbitmq.conf at boot and an error stops the start with a message in the node’s log; the startup log command is below.
Manual commands
Section titled “Manual commands”KryoDesk shows these with Copy / Paste to terminal and never runs them. -n <node> (and -l for long names) comes from the node the last probe found. Like every rabbitmq-diagnostics/rabbitmqctl call, the first four read the Erlang cookie (~/.erlang.cookie, created when missing) and start a short Erlang VM; as root the packaged wrapper switches to the rabbitmq account (su/runuser, a PAM session in auth.log).
| Label | Command | What it does |
|---|---|---|
| Cluster status | rabbitmq-diagnostics -q [-n <node> [-l]] cluster_status |
members of the cluster (disc and running nodes), partitions, alarms of every node, versions, feature flags |
| Alarms (health check) | rabbitmq-diagnostics -q [-n <node> [-l]] check_alarms |
exits non-zero when any node of the cluster has a resource alarm (memory, disk, file descriptors) |
| Virtual hosts | rabbitmq-diagnostics -q [-n <node> [-l]] list_vhosts |
names of the virtual hosts (the card lists queues of / only) |
| Queues of a vhost | rabbitmq-diagnostics -q [-n <node> [-l]] list_queues -p / name messages consumers state |
every queue of vhost / with messages, consumers and state (change -p for another vhost); queue names may carry customer data |
| Startup log (configuration errors) | journalctl -u rabbitmq-server -n 100 --no-pager |
the last 100 lines of the service’s journal: cuttlefish reports errors of rabbitmq.conf there when the node fails to start. Reads the journal (group adm or systemd-journal, or root) |