OpenBSD Handbook

    Theme
    • Part I. Install & Configure
      • Introduction
      • Installing OpenBSD
      • The X Window System
      • Networking
      • System Configuration
      • OpenBSD Basics
      • Managing Software: Packages and Ports
    • Part II. Daily Operations
      • Graphical Environments
      • Multimedia
      • Printing
      • Linux Compatibility
      • Windows Compatibility
      • Games
    • Part III. System Administration
      • Virtualization
      • Storage and File Systems
      • Updating and Upgrading
      • Localization
      • The OpenBSD Boot Process
      • Security
    • Part IV. Networking & Daemons
      • Services
        • Database
          • MariaDB
          • PostgreSQL
          • Redis
          • memcached
        • Directory
          • YP (NIS)
          • LDAP
        • File
          • NFS
          • Samba
        • FTP Services
          • ftpd
          • ProFTPD
          • vsftpd
          • Pure-FTPd
          • TFTP
        • Mail
          • smtpd
          • Dovecot
          • Postfix
          • Exim
          • Rspamd
        • Name
          • Unbound
          • NSD
          • BIND
        • Networking
          • OpenBGPD
          • rad
          • DHCP
          • slaacd
        • Web
          • Apache
          • nginx
          • httpd
          • relayd
        • Logging
          • syslogd
        • Monitoring
          • SNMP
        • Remote Access
          • Audit OpenSSH
          • sshd
        • File Synchronization
          • rsync
        • Messaging
          • RabbitMQ
        • Time
          • NTP
      • PF
        • pfctl cheat sheet
        • PF Anchors
        • PF Filter Rules
        • PF Forwarding
        • PF Lists and Macros
        • PF Load Balancing
        • PF Logging
        • PF NAT
        • PF Options
        • PF Policies
        • PF Shortcuts
        • PF Tables
      • Advanced Networking
        • High Availability and State Replication
        • Multi-WAN and Policy-Based Routing
        • VPN and Cryptographic Tunneling
        • Classic and Lightweight Tunnels
        • IPv6 at Scale
        • QoS and Traffic Shaping
        • MPLS and Label Distribution
        • Network Services at Scale
        • Virtualization and Host Networking
        • Large-Scale L2 and L3 Design
        • Telemetry, Logging, and Flow Export
        • Hardening and Operational Safety
        • Reference Architectures
        • Troubleshooting Playbooks
      • Serial Communication
    • Part V. Miscellaneous
      • Virtualization Cheat Sheet
      • OpenBSD Cheatsheet
      • How-to Guides
        • Complete the First 30 Minutes After Installation
        • Check Hardware Compatibility Before Installing
        • Bootstrap Wi-Fi Firmware Without Ethernet
        • Set Up OpenBSD as a Laptop or Workstation
        • Configure Laptop Power Management
        • Run OpenBSD as a Virtual Machine Guest
        • Install OpenBSD on a VPS or Cloud Server
        • Install OpenBSD with Full-Disk Encryption
        • Troubleshoot Web Browsers on OpenBSD
        • Create an Administrator Account with doas and SSH Keys
        • Establish a Conservative Security Baseline
        • Manage OpenBSD with Ansible
        • Recover Access and Reset the Root Password
        • Collect OpenBSD Diagnostic Evidence
        • Configure Secure Remote Access with OpenSSH
        • Set Up WordPress
        • Build Third-Party Software from Ports
        • Use FIDO Security Keys with OpenSSH
        • Build OpenBSD from Source
        • Configure Wi-Fi Roaming and Wired Failover
        • Dual-Boot OpenBSD on a UEFI System
        • Troubleshoot PF, NAT, and Routing
        • Automate OpenBSD Installation with Autoinstall and PXE
        • Route Multiple VLANs with PF
        • Configure a Road-Warrior WireGuard VPN
        • Troubleshoot Package Installation and Update Failures
        • Route IPv6 Networks without NAT
        • Schedule Recurring Maintenance
        • Plan a Docker Workload Migration to OpenBSD
        • Build a Mail Server with OpenSMTPD, Dovecot, and Rspamd
        • Build a Simple Router and Firewall
        • Monitor an OpenBSD System
        • Back Up and Restore an OpenBSD System
        • Configure softraid RAID1
        • Recover an OpenBSD System That Does Not Boot
        • Install Z shell (zsh)
      • OpenBSD for Linux Users
      • OpenBSD for FreeBSD Users
      • OpenBSD for macOS Users
    • OpenBSD FAQ
    • Package Search
      • Synopsis
      • Establish a Resource Baseline
      • Check Services
      • Inspect Hardware Sensors
      • Read Daily Security and Maintenance Mail
      • Review Logs and Rotation
      • Check Update State
      • Add Remote Monitoring Deliberately

      Monitor an OpenBSD System

      Synopsis #

      OpenBSD includes enough base-system tools to establish a useful local monitoring baseline before adding an external platform. This guide inventories resource use, service state, hardware sensors, logs, scheduled maintenance reports, and update status. It also identifies where optional remote telemetry belongs.

      Monitoring must produce an actionable signal. Record normal values before setting thresholds, direct root’s local mail to an actively read mailbox, and test each notification path.

      Establish a Resource Baseline #

      Use systat(1) for interactive views and vmstat(8) for interval samples:

      $ systat vmstat
        # Observe CPU, memory, paging, interrupts, and disks
      $ vmstat 5 12
        # Record twelve samples at five-second intervals
      

      Inspect filesystems and inodes with df(1) :

      $ df -h
        # Display filesystem capacity
      $ df -i
        # Display inode consumption
      

      Capacity monitoring must cover both blocks and inodes. A filesystem can reject new files when either resource is exhausted.

      Record interface counters, routes, sockets, and PF state:

      $ netstat -in
        # Display interface packet and error counters
      $ route -n show
        # Display the routing table without DNS lookups
      # pfctl -si
        # Display PF status and state counters
      

      Check Services #

      rcctl(8) reports failed enabled daemons:

      # rcctl ls failed
      

      Check a specific service when its network endpoint or dependent application fails:

      # rcctl check sshd
        # Confirm that the daemon process is running
      $ netstat -na -f inet
        # Confirm that the expected socket is listening
      

      A running process does not prove that its protocol works. Add an application-level probe from the same network path as its clients.

      Inspect Hardware Sensors #

      sysctl(8) exposes sensors registered by supported drivers:

      $ sysctl hw.sensors
      

      Available sensors vary by platform, firmware, controller, and driver. Absence of a temperature, fan, voltage, drive, or battery sensor is not proof that the underlying hardware lacks that measurement.

      sensorsd(8) can monitor selected sensors and run commands when status changes. Start with the example and the current sensorsd.conf(5) manual rather than copying thresholds from another machine:

      # test -f /etc/sensorsd.conf || install -o root -g wheel -m 600 /dev/null /etc/sensorsd.conf
        # Create the local configuration only when absent
      # vi /etc/sensorsd.conf
        # Add thresholds based on measured normal and documented safe ranges
      # rcctl enable sensorsd
        # Enable monitoring at boot
      # rcctl start sensorsd
        # Start monitoring now
      # rcctl check sensorsd
        # Confirm that the daemon remains running
      

      Test a notification command independently before assigning it to a sensor rule.

      Read Daily Security and Maintenance Mail #

      daily(8) reports failed daemons, disk status, filesystems due for backup, and security-check output. Root’s mail must reach an account that is actually read.

      Review /etc/mail/aliases, preserve existing aliases, and direct root to an administrative mailbox:

      root: admin
      

      Rebuild the aliases database and test delivery:

      # newaliases
        # Rebuild the aliases database
      # printf 'monitoring test\n' | mail -s 'root mail test' root
        # Confirm that root mail reaches the monitored mailbox
      

      Site-specific daily checks belong in /etc/daily.local. Keep them quick, noninteractive, and silent on success. Output becomes part of the daily report.

      Review Logs and Rotation #

      Use tail(1) for short investigations:

      # tail -n 100 /var/log/messages
        # Review recent system messages
      # tail -n 100 /var/log/authlog
        # Review authentication events
      # tail -n 100 /var/log/daemon
        # Review daemon messages
      

      Do not assume every daemon writes a dedicated file. OpenBSD services commonly log through syslogd(8) . Review /etc/syslog.conf and /etc/newsyslog.conf before changing retention.

      Preview log rotation with newsyslog(8) :

      # newsyslog -n
      

      The preview must be reviewed before forcing rotation.

      Check Update State #

      List missing binary errata patches with syspatch(8) :

      # syspatch -c
      

      Keep package and firmware maintenance in the normal update workflow. A monitoring probe should report drift; it should not perform unattended upgrades unless that change authority has been designed explicitly.

      Add Remote Monitoring Deliberately #

      Remote telemetry is useful when local mail cannot report a failed host. Choose the smallest required surface:

      • snmpd(8) exposes base-system metrics to a restricted management network.
      • syslogd(8) can forward selected logs to a collector.
      • pflow(4) exports PF flow records from routers.
      • A remote service probe can test DNS, HTTP, SMTP, SSH, or another application from the client side.

      Bind monitoring daemons only to management addresses, restrict sources in both daemon and PF configuration, and verify the collector receives data. Community strings and telemetry can disclose operational details; do not expose them to the Internet.

      See Telemetry, Logging, and Flow Export for network-device telemetry and SNMP for the native agent.

      Report a bug
      • Synopsis
      • Establish a Resource Baseline
      • Check Services
      • Inspect Hardware Sensors
      • Read Daily Security and Maintenance Mail
      • Review Logs and Rotation
      • Check Update State
      • Add Remote Monitoring Deliberately