Skip to content
Komando

Health and network checks

Find out what a server is, whether it is healthy, and what it can reach.

Learn what a server is

komando facts web1

Run facts first on a server you do not know. It reports the OS, CPU, memory, disk, load, IP addresses, the package manager, the init system and which tools are installed, so you (or your agent) know which commands fit. It also shows what needs attention. Typed alone at your terminal, komando facts asks for the server (from your list); komando facts @web looks at many at once.

● web1  Ubuntu 20.04.6 LTS · x86_64 · 4 cpu · 7.8 GB RAM · disk / 63% · load 0.12 · up 34d
  support:   UNSUPPORTED: no security updates
  updates:   12 pending, security unknown · index 11d old · REBOOT REQUIRED · restart needed: nginx.service
  access:    user deploy · sudo without password · 1 failed units
  docker:    docker 24.0.7 · swarm manager · 14 running
  pm2:       (deploy) api online, worker online
  ports:     22 sshd, 80 nginx, 443 nginx, 3000 node (local only)
  units:     pm2-deploy.service (active), backup.timer (active)
  warning: Ubuntu 20.04.6 LTS: standard support ended 2025-05-31 and Ubuntu Pro (ESM) is not enabled, so it gets no security updates; ...
LineWhat it tells you
supportWhether the OS still gets security updates: supported, extended (Ubuntu Pro ESM is enabled, or Debian LTS), unsupported or unknown.
updatesPending updates and how many are security updates, read from the server's package index as it is (komando does not refresh it; komando pkg update does). A needed reboot, and services that still run old libraries (when needrestart is installed and komando may use sudo).
accessThe login user, and whether sudo works without a password.
dockerDocker's version, the Swarm role (manager, worker, none) and how many containers run.
pm2Node.js apps run by PM2, outside containers.
portsListening ports and the program behind each one. Without root or passwordless sudo, only your own programs have names.
unitsServices and timers added by hand under /etc/systemd/system (not from a package).

In JSON, disks lists every real file system: mount, device, size_mb, used_mb, avail_mb and used_pct.

Just the numbers, fast

komando facts web1 --only load,mem,disks -o json

--only runs just the probes of the sections you name, in about a second, for an app or a script that polls: load (load 1, 5 and 15 minutes, cpus), mem (mem_total_mb, mem_available_mb, swap_total_mb, swap_free_mb), disks (disks, disk_root_total_gb, disk_root_used_pct) and system (os, os_version, os_pretty, uptime_sec). No package index, Docker, ports, units or sudo; the keys of the other sections are left out. A read-only ssh-gate key runs it. A value the server does not have is null; a server without /etc/os-release (macOS, BSD) gives os and os_version from uname.

facts only reads. It never refreshes a package index or starts anything, and it uses sudo only when sudo already works without a password (it never asks for one).

What "unknown" means

When komando cannot read something, the JSON says null (and the text says "unknown"), never 0 or false. This matters most for security updates: a server whose OS is past its support gets no new security updates, so its package index shows none pending. komando reports those as unknown, with a warning, instead of a reassuring 0. Agents should read warnings first.

The JSON fields

In JSON (-o json), each server's data has these fields besides the basics (os, os_version, kernel, cpus, mem_total_mb, tools ...):

FieldMeaning
os_supportstatus, standard_support_until, extended_support_until, extended_by (ubuntu-pro-esm, debian-lts), past_standard_support, esm_enabled (Ubuntu), dates_checked
updatestotal, security, source, index_age_days
reboot_required, reboot_packagesa reboot is needed, and for which packages (Debian and Ubuntu; kernel when needrestart sees a newer kernel than the running one); on dnf/yum from needs-restarting -r
services_need_restartservices that run old code, from needrestart (or needs-restarting -s on dnf/yum); null without either, or without sudo
sudo_nopasswd, login_userthe same check as komando test
dockerinstalled, version, daemon_reachable, server_version, swarm, containers_running
pm2daemon_users (every user running PM2), apps of the login user (name, status, pid, restarts, cpu_pct, memory_mb), other_users
listeningsource (ss, netstat or /proc), process_names (all, own or none), ports[] (proto, address, port, process, pid)
custom_unitsunit, enabled, active for each unit added by hand; failed_units counts failed ones
warningsthings an agent must not miss, in plain words

Only names are kept, never command lines or environments (they can hold passwords), and secret-looking text is hidden.

Where the support dates come from

komando has a small built-in table for Ubuntu LTS, Debian, RHEL and its rebuilds (Rocky, AlmaLinux, Oracle Linux, CentOS), Alpine and Amazon Linux, taken from each vendor's release page (the sources are listed in internal/cli/facts_support.go). The JSON shows the date it was checked (os_support.dates_checked). A release that is not in the table, such as a short-lived Ubuntu release, is unknown. For Ubuntu, komando also asks pro status whether ESM is enabled.

Check server health

komando comes with ready-made checks (built-in recipes). Run one on any target:

komando recipe run health @web                    # uptime, load, memory, disk, failed services
komando recipe list                               # all of them, with what they run
komando recipe list --category security           # one category
komando recipe run top-mem web1
komando recipe run big-dirs web1 --var path=/srv
komando recipe run oom all --var since=-2h

Typed alone, komando recipe run asks for the recipe, then the target.

Category (--category)Recipes
systemhealth, disk, inodes, memory, big-dirs, big-files, cron-all, time-sync
processtop-cpu, top-mem, process, oom
networkconnections, firewall
webnginx-test, nginx-sites, apache-test
securityauth-failures, last-logins, sshd-config, sudoers
maintenance (these change things)apt-clean, drop-caches, journal-vacuum

Some recipes have blanks with defaults, for example big-dirs takes --var path=/srv --var depth=2. komando recipe list shows each recipe's blanks. A time back from now is written with a minus (since=-2h), as journalctl reads it.

Checks that have their own command are not recipes:

CheckCommand
listening portskomando net ports TARGET --sudo
a name in DNSkomando net dns TARGET NAME
a URL answerskomando net http TARGET URL
failed unitskomando svc list TARGET --failed
journal errorskomando logs TARGET -p err --since 1h --sudo
pending updateskomando pkg upgradable TARGET
security updateskomando pkg security TARGET
containerskomando docker ps TARGET --all
a Kubernetes clusterkomando cluster status CLUSTER
database sessionskomando db activity CONN
a cachekomando cache info CONN
certificateskomando cert check TARGET
Docker clean-upkomando docker prune TARGET --dry-run

To save your own checks, see Recipes.

Check TLS certificates

cert check tells you when certificates expire, before your visitors do. It only reads.

komando cert check web1                               # the certificates web1's web servers use

Typed alone, komando cert check asks for a server or a URL.

komando cert check @web --warn 14d                   # flag what expires within 14 days
komando cert check https://shop.example.com           # the certificate the website sends
komando cert check api.example.com:8443 intranet.example.com:443 --via bastion
komando cert check web1 --path /etc/ssl/private/site.pem
  • On a server, komando finds the certificates itself: certbot's (/etc/letsencrypt/live/*/cert.pem) and the files nginx (ssl_certificate), haproxy (crt) and apache (SSLCertificateFile) use. Add more with --path. Files that need root are read with sudo only when sudo works without a password; komando never asks for one. Only the certificate part of a file is read: a private key in the same file never leaves the server. When certbot is installed, the result also shows its renewal timer and whether the last renewal failed.
  • For a website (https://NAME, NAME:PORT) or a conn that uses TLS, komando connects from this computer, or through --via (a server or VPN), reads the certificate the site sends, and checks that it is trusted and matches the name.
  • Each certificate shows its names, issuer, expiry date, days left, where it came from and a status: ok, expiring, expired, not_yet_valid, not_trusted, or unreadable (missing, or needs root).
ResultExit code
every certificate is fine0
one expires within --warn (default 30d), has expired, is not trusted, or certbot's last renewal failed (CERT_PROBLEMS)1
a server or site could not be reached4 (or 7 on a timeout)

unreadable files are listed but do not fail the command.

Check the network from a server

These checks run from your servers, so you see what they see:

komando net check @web 10.0.0.5:5432 10.0.0.6:6379   # can each server open a TCP connection?

Typed alone, komando net check asks for the servers, then the addresses.

komando net http web1 https://example.com --expect 2xx
komando net ports web1 --sudo                         # PROTO ADDRESS PORT PROCESS PID
komando net dns web1 api.example.com
komando net dns web1 example.com --type MX            # MX, TXT, CNAME, NS ... (with or without dig on the server)
CommandFails whenExit code
net checka port does not answer (PORT_CLOSED); the result says why: refused, timeout (after 5 seconds), dns or unreachable5
net httpnothing answers (NO_RESPONSE, within 15 seconds, or --timeout)4
net http --expect 2xxthe status is another one (UNEXPECTED_STATUS); --expect 200 names one status5
net dnsthe name does not resolve (NXDOMAIN) or has no records of that type (NO_RECORDS)3
  • net ports uses ss, or netstat on small systems such as busybox. Add --sudo to see the process names.
  • net dns without --type shows the addresses the server would connect to. --type takes A, AAAA, CNAME, MX, NS, TXT, SOA, SRV, PTR or CAA. A and AAAA work everywhere; the others use dig on the server, or, without it, komando asks the server's resolver itself through the connection.
  • net http takes http:// and https:// URLs only. It reports the status, timing, the IP it reached and any redirect.

Limits

  • facts uses sudo only when it works without a password; it never asks for one. Without root or passwordless sudo, only your own programs in ports have names.
  • facts never refreshes a package index, so updates is as fresh as the server's own index.
  • The support dates cover Ubuntu LTS, Debian, RHEL and its rebuilds, Alpine and Amazon Linux; any other release is unknown.
  • facts keeps only names, never command lines or environments.
  • cert check reads files that need root only when sudo works without a password; such files show as unreadable and do not fail the command.
  • net check gives up on a port after 5 seconds; net http after 15 seconds (or --timeout).
  • net http takes http:// and https:// URLs only.
  • net dns --type other than A and AAAA uses dig on the server; without it, komando asks the server's resolver (/etc/resolv.conf) itself over TCP through the SSH connection, which needs TCP forwarding on the server (AllowTcpForwarding, on by default).
  • Recipes with blanks refuse a --var value that starts with -, except a number or a time back from now (see Recipes).

Troubleshooting

Error codeWhat it meansWhat to do
RECIPE_NOT_FOUNDno recipe of that name (exit 3)see them with komando recipe list; some checks are commands (table above)
UNKNOWN_VAR--var names a blank the recipe does not havecheck the blanks with komando recipe list
CERT_PROBLEMSa certificate expires within --warn, has expired, is not trusted, or certbot's last renewal failed (exit 1)renew or replace the certificates the result marks
PORT_CLOSEDnet check: a port did not answer (exit 5)the result says why (refused, timeout, dns, unreachable): check the address, firewall or service
NO_RESPONSEnet http: nothing answered (exit 4)check the URL, and that the server can reach it: komando net check SERVER HOST:443
UNEXPECTED_STATUSnet http --expect: another status came back (exit 5)check the URL and the service behind it
NXDOMAINnet dns: the name does not resolve from this server (exit 3)check the name and the server's DNS (/etc/resolv.conf)
NO_RECORDSnet dns: no records of that type (exit 3)check the name and --type
DIG_MISSINGnet dns --type found no dig on the server, and komando could not ask its resolver itself (no nameserver, or no TCP forwarding)install the package the error names

Source: docs/features/health.md in sgnd/komando at commit b622784.