OpenBSD Handbook

    Theme
    • Part I. Install & Configure
      • Introduction to OpenBSD
      • Installing OpenBSD
      • The X Window System
      • Networking on OpenBSD
      • System Configuration
      • OpenBSD Basics
      • Managing Software: Packages and Ports
    • Part II. Daily Operations
      • OpenBSD Desktop 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
          • OpenSMTPD Mail Server
          • Dovecot IMAP and POP3 Server
          • Postfix
          • Exim
          • Rspamd
        • Name
          • Unbound DNS Resolver
          • NSD Authoritative DNS Server
          • BIND DNS Server
        • Networking
          • OpenBGPD
          • rad
          • DHCP on OpenBSD
          • slaacd
        • Web
          • Apache HTTP Server
          • nginx Web Server
          • OpenBSD httpd Web Server
          • relayd Reverse Proxy
        • Logging
          • syslogd
        • Monitoring
          • SNMP
        • Remote Access
          • Audit OpenSSH
          • OpenSSH Server
        • File Synchronization
          • rsync
        • Messaging
          • RabbitMQ Message Broker
        • Time
          • NTP Time Synchronization
        • Load Balancing
          • Build Redundant Load-Balanced Gateways
          • Load Balance Services with NAT or DSR
          • Build an HA HTTPS Load Balancer
      • 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
        • Installation and First Boot
          • Complete the First 30 Minutes After Installation
          • Check Hardware Compatibility Before Installing
          • Bootstrap Wi-Fi Firmware Without Ethernet
          • Run OpenBSD as a Virtual Machine Guest
          • Install OpenBSD on a VPS or Cloud Server
          • Install OpenBSD with Full-Disk Encryption
          • Dual-Boot OpenBSD on a UEFI System
          • Automate OpenBSD Installation with Autoinstall and PXE
        • Desktops and Laptops
          • Set Up OpenBSD as a Laptop or Workstation
          • Configure Laptop Power Management
          • Troubleshoot Web Browsers on OpenBSD
          • Use Plan 9 Tools on OpenBSD
          • Build a Minimal Desktop with suckless Tools
          • Install Z shell (zsh)
        • Networking and Remote Access
          • Create an Administrator Account with doas and SSH Keys
          • Configure Secure Remote Access with OpenSSH
          • Use FIDO Security Keys with OpenSSH
          • Configure Wi-Fi Roaming and Wired Failover
          • Troubleshoot PF, NAT, and Routing
          • Route Multiple VLANs with PF
          • Configure a Road-Warrior WireGuard VPN
          • Route IPv6 Networks without NAT
          • Test OpenBGPD with Two Providers
          • Unlock an Internal Service with an SSH Key
          • Build a Simple Router and Firewall
        • Servers and Services
          • Set Up WordPress on OpenBSD
          • Build a Mail Server with OpenSMTPD, Dovecot, and Rspamd
        • Security, Maintenance and Recovery
          • Establish a Conservative Security Baseline
          • Recover Access and Reset the Root Password
          • Collect OpenBSD Diagnostic Evidence
          • Troubleshoot Package Installation and Update Failures
          • Schedule Recurring Maintenance
          • Monitor an OpenBSD System
          • Back Up and Restore an OpenBSD System
          • Configure softraid RAID1
          • Recover an OpenBSD System That Does Not Boot
        • Building, Automation and Virtual Machines
          • Manage OpenBSD with Ansible
          • Build Third-Party Software from Ports
          • Build OpenBSD from Source
          • Plan a Docker Workload Migration to OpenBSD
      • OpenBSD for Linux Users
      • OpenBSD for FreeBSD Users
      • OpenBSD for macOS Users
    • OpenBSD FAQ
    • OpenBSD Architectures
      • OpenBSD 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

        Monitor an OpenBSD System

        Synopsis #

        Start with OpenBSD’s base tools for local monitoring before adding an external platform. This guide covers resource use, services, hardware sensors, logs, scheduled reports, updates, and optional remote monitoring.

        Monitoring should make failures visible to someone who can respond. 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
        doas pfctl -si
          # Display PF status and state counters
        

        Check Services #

        rcctl(8) reports failed enabled daemons:

        doas rcctl ls failed
        

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

        doas 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:

        doas test -f /etc/sensorsd.conf || doas install -o root -g wheel -m 600 /dev/null /etc/sensorsd.conf
          # Create the local configuration only when absent
        doas vi /etc/sensorsd.conf
          # Add thresholds based on measured normal and documented safe ranges
        doas rcctl enable sensorsd
          # Enable monitoring at boot
        doas rcctl start sensorsd
          # Start monitoring now
        doas 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:

        doas 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:

        doas tail -n 100 /var/log/messages
          # Review recent system messages
        doas tail -n 100 /var/log/authlog
          # Review authentication events
        doas 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) :

        doas newsyslog -n
        

        The preview must be reviewed before forcing rotation.

        Check Update State #

        List missing binary errata patches with syspatch(8) :

        doas syspatch -c
        

        Keep package and firmware maintenance in the normal update workflow. Keep monitoring checks separate from update jobs so an alert does not also change the system.

        Add Remote Monitoring #

        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