Monitoring and Alerting
TrueNAS Built-in Monitoring
Section titled “TrueNAS Built-in Monitoring”Dashboard
Section titled “Dashboard”The TrueNAS dashboard provides a real-time overview of system health:
| Widget | Information |
|---|---|
| CPU Usage | Per-core utilization percentage |
| Memory Usage | Used, free, cached, and wired memory |
| Pool Usage | Per-pool capacity, used, and available space |
| Network | Interface throughput (Rx/Tx) |
| Disk I/O | Read/write throughput per pool or disk |
| System Temperature | CPU, disk, and enclosure temperatures |
| System Load | 1, 5, and 15 minute load averages |
System Information
Section titled “System Information”Navigate to System → Advanced for detailed system information:
- System: Hostname, uptime, kernel version, platform
- Hardware: CPU model, RAM amount, PCI devices
- Network: Interface configuration, IP addresses, MAC addresses
- Storage: Pool status, disk information, SLOG/L2ARC status
SMART Tests
Section titled “SMART Tests”SMART Test Types
Section titled “SMART Test Types”| Test Type | Duration | What It Tests | Recommended Frequency |
|---|---|---|---|
| Short | 2–5 minutes | Basic electrical and mechanical tests | Daily |
| Long (Extended) | 2–6 hours | Full surface scan, complete mechanical test | Weekly |
| Conveyance | 5 minutes | Vendor-specific (transport damage check) | After shipping |
Configuring SMART Tests on TrueNAS
Section titled “Configuring SMART Tests on TrueNAS”- Navigate to Data Protection → S.M.A.R.T. Tests → Add.
- Select the disk type (All, HDD, SSD, NVMe).
- Select the test type (Short or Long).
- Set the schedule (Daily, Weekly, Monthly).
- Save.
Interpreting SMART Results
Section titled “Interpreting SMART Results”# Check SMART healthsmartctl -H /dev/sda
# Full SMART attributessmartctl -a /dev/sda
# Check self-test logsmartctl -l selftest /dev/sdaCritical attributes to monitor:
| Attribute | HDD | SSD | Warning Threshold |
|---|---|---|---|
| Reallocated Sector Count | Yes | N/A | Any increase |
| Current Pending Sector | Yes | N/A | Any non-zero value |
| Offline Uncorrectable | Yes | N/A | Any non-zero value |
| Media Wear Indicator | N/A | Yes | < 10% remaining |
| Available Spare | N/A | Yes | < 10% |
| Temperature | Yes | Yes | > 55 °C (HDD), > 70 °C (SSD) |
| Power-On Hours | Yes | Yes | Compare against MTBF (HDD: ~50,000 hours) |
| Command Timeout | Yes | Yes | Any non-zero value |
| UDMA CRC Error Count | Yes | Yes | Any non-zero value (cable issue) |
ZFS Scrub Scheduling
Section titled “ZFS Scrub Scheduling”Scrub Configuration
Section titled “Scrub Configuration”- Navigate to Data Protection → Scrub Tasks → Add.
- Select the pool to scrub.
- Set the schedule (Monthly is standard for HDD pools; Weekly for SSD pools).
- Set the threshold (minimum days between scrubs).
- Enable or disable scrub when resilvering is in progress.
Scrub Scheduling Best Practices
Section titled “Scrub Scheduling Best Practices”| Pool Type | Scrub Frequency | Rationale |
|---|---|---|
| All-HDD | Monthly | HDD scrub is slow (1–3 days for large pools) |
| All-SSD | Weekly | SSD scrub is fast (1–4 hours) |
| Hybrid (SSD special + HDD) | Monthly | Scrub the entire pool monthly |
| Critical data | Bi-weekly | Trade I/O impact for earlier detection |
Monitoring Scrub Progress
Section titled “Monitoring Scrub Progress”# Check scrub statuszpool status tank
# Example output:# pool: tank# status: scrub in progress since ...# scan: scrub repaired 0 in 12h34m with 0 errors on ...Email Alerting
Section titled “Email Alerting”Configuring Email on TrueNAS
Section titled “Configuring Email on TrueNAS”- Navigate to System → Alert Settings.
- Configure the email settings:
- SMTP server address and port
- Encryption (TLS/SSL)
- Authentication (username/password or app-specific password)
- From address
- To addresses (comma-separated)
- Send a test email to verify the configuration.
Alert Levels
Section titled “Alert Levels”TrueNAS classifies alerts into severity levels:
| Level | Meaning | Example |
|---|---|---|
| Critical | Immediate action required | Pool degraded, disk failure |
| Warning | Attention needed | SMART predictive failure, temperature |
| Information | Informational | Scrub completed, snapshot created |
Common Alert Triggers
Section titled “Common Alert Triggers”Configure alert rules for:
- Disk failures: Any drive with SMART status not “OK”
- Temperature: Disk or CPU temperature exceeding threshold
- Pool capacity: Pool usage exceeding 80% or 90%
- Scrub errors: Any errors found during scrub
- Replication lag: Replication destination falling behind source
- UPS events: Power failure, battery low, on battery
UPS Monitoring
Section titled “UPS Monitoring”NUT (Network UPS Tools)
Section titled “NUT (Network UPS Tools)”NUT provides UPS monitoring and automated shutdown for TrueNAS:
- Connect the UPS to the TrueNAS server via USB.
- Navigate to System → UPS → Add.
- Configure the UPS settings:
- Identifier (e.g.,
ups) - Driver (e.g.,
usbhid-upsfor USB-connected UPS) - Port (e.g.,
auto) - Shutdown mode (UPS goes to battery, or low battery)
- Configure the shutdown behavior:
- Minutes on battery before shutdown (e.g., 5 minutes)
- Load percentage threshold (e.g., shut down at 50% battery)
UPS Configuration Parameters
Section titled “UPS Configuration Parameters”| Setting | Value | Rationale |
|---|---|---|
| Shutdown timer | 5–10 minutes | Enough time for clean shutdown, not too long |
| Low battery threshold | 20–30% | Prevents battery exhaustion |
| Extra delay | 30 seconds | Allows other systems to shut down first |
| No communication grace | 60 seconds | Tolerates brief USB disconnects |
Multi-System UPS Monitoring
Section titled “Multi-System UPS Monitoring”For environments with multiple systems on the same UPS:
- Configure TrueNAS as the UPS master (connected to the UPS via USB).
- Configure other systems as UPS slaves (connected to TrueNAS via the network).
- TrueNAS notifies slave systems to shut down before shutting down itself.
# On TrueNAS (master), allow network access to NUT:# Configure the UPS service to listen on the network interface# Set up NUT users and passwords for slave systemsSNMP Monitoring
Section titled “SNMP Monitoring”SNMP Configuration
Section titled “SNMP Configuration”TrueNAS supports SNMPv2c and SNMPv3:
- Navigate to System → Advanced → SNMP.
- Enable SNMP.
- Configure community string (SNMPv2c) or user credentials (SNMPv3).
- Set the contact and location information.
- Select which OIDs to expose (system, interfaces, storage, etc.).
SNMP Integration
Section titled “SNMP Integration”TrueNAS SNMP exposes:
- System information (hostname, uptime, OS version)
- Interface statistics (bytes in/out, errors, drops)
- Storage pool information (capacity, health, I/O)
- Disk information (temperature, SMART health)
- CPU and memory utilization
Monitoring with External Tools
Section titled “Monitoring with External Tools”Use the SNMP data with:
- Zabbix: Full-featured monitoring platform with TrueNAS templates.
- LibreNMS: Auto-discovering network monitoring.
- PRTG: Windows-based monitoring with SNMP sensors.
- Check_MK: Enterprise monitoring with native TrueNAS checks.
Integration with Grafana and Prometheus
Section titled “Integration with Grafana and Prometheus”Prometheus Node Exporter
Section titled “Prometheus Node Exporter”TrueNAS can export metrics to Prometheus for visualization in Grafana:
- Deploy the Prometheus + Grafana stack from the TrueNAS app catalog.
- Configure Prometheus to scrape TrueNAS metrics (via the node exporter or the TrueNAS API).
- Import pre-built Grafana dashboards for TrueNAS.
Key Metrics to Monitor
Section titled “Key Metrics to Monitor”| Metric | Source | Alert Threshold |
|---|---|---|
| Pool capacity | ZFS | > 80% warning, > 90% critical |
| Pool health | ZFS | Any non-ONLINE state |
| Disk temperature | SMART | > 55 °C (HDD), > 70 °C (SSD) |
| CPU utilization | System | > 90% for 5+ minutes |
| Memory utilization | System | > 90% sustained |
| ARC hit ratio | ZFS | < 80% (consider more RAM or L2ARC) |
| Scrub errors | ZFS | Any errors |
| Replication lag | ZFS | > 24 hours behind |
| UPS battery | NUT | On battery, low battery |
| Network errors | Interface | Any CRC, frame, or drop errors |
Grafana Dashboard Examples
Section titled “Grafana Dashboard Examples”Common dashboard panels for TrueNAS:
- Pool capacity over time (bar chart or gauge)
- I/O throughput per pool (time series)
- Disk temperature heatmap
- ARC hit ratio and size (time series)
- Network throughput per interface (time series)
- CPU and memory utilization (time series)
- SMART predictive failure indicators (table)
Log Analysis
Section titled “Log Analysis”Accessing Logs
Section titled “Accessing Logs”# System logscat /var/log/messages
# ZFS-related logsdmesg | grep zfs
# SMB/CIFS logscat /var/log/samba4/log.smbd
# NFS logscat /var/log/messages | grep nfsd
# Boot logsjournalctl -bCommon Log Patterns to Monitor
Section titled “Common Log Patterns to Monitor”| Pattern | Severity | Action |
|---|---|---|
zfs: checksum error | Critical | Check pool health, scrub, replace disk |
ata1: hard resetting link | Warning | Check SATA cable and connection |
mpt2sas: device reset | Warning | Check SAS controller and disk |
smbd: connection denied | Information | Check authentication configuration |
kernel: out of memory | Critical | Add RAM, check for memory leaks |
UPS: on battery | Warning | Monitor battery level, prepare for shutdown |
Capacity Planning
Section titled “Capacity Planning”Monitoring Growth Rate
Section titled “Monitoring Growth Rate”# Check pool capacity and growthzpool list -vzfs list -o name,used,avail,refer,mountpoint
# Historical capacity tracking (via zpool history)zpool history tank | grep createTrack capacity growth over time to predict when you will need to add storage. A pool that grows by 1 TB/month will fill a 20 TB pool in approximately 20 months (accounting for RAIDZ overhead).
Planning Guidelines
Section titled “Planning Guidelines”| Metric | Action Threshold |
|---|---|
| Pool usage > 70% | Plan expansion within 6 months |
| Pool usage > 80% | Order drives immediately |
| Pool usage > 90% | Critical — expand or delete data |
| Pool usage > 95% | Emergency — ZFS performance degrades significantly |
Alert Fatigue Management
Section titled “Alert Fatigue Management”Reducing Noise
Section titled “Reducing Noise”Alert fatigue occurs when too many low-priority alerts desensitize administrators to critical ones.
Strategies:
- Set appropriate thresholds: Do not alert on every minor event. Temperature warnings at 45 °C are noise; warnings at 55 °C are actionable.
- Aggregate alerts: Group related alerts (e.g., “SMART errors on pool tank” rather than individual errors per disk).
- Use escalation: Critical alerts go to immediate notification (email + SMS); warnings go to a daily digest.
- Review and prune: Regularly review alert rules and remove or adjust ones that trigger frequently without action.
- Acknowledge and track: Use a ticketing system to track alert acknowledgment and resolution.
Common Pitfalls
Section titled “Common Pitfalls”Not Configuring Email Alerts
Section titled “Not Configuring Email Alerts”A TrueNAS system without email alerts is a silent system. Disk failures, pool degradation, and other Critical events will go unnoticed until data is lost. Always configure email alerts and verify they Work with a test email.
Running SMART Tests Only When Problems Occur
Section titled “Running SMART Tests Only When Problems Occur”SMART tests are predictive — they detect problems before they become failures. Running SMART tests Only when you suspect a problem defeats the purpose. Schedule regular short and long tests to catch Failures early.
Ignoring SMART Warnings
Section titled “Ignoring SMART Warnings”A SMART predictive failure warning means the drive has a high probability of failing. Replace the Drive immediately — do not wait for it to fail completely. The longer you wait, the higher the risk Of a second drive failing before the resilver completes.
Not Testing UPS Shutdown
Section titled “Not Testing UPS Shutdown”A UPS that is configured but never tested may fail when needed. Test the UPS shutdown procedure Quarterly:
- Disconnect the UPS from mains power.
- Verify TrueNAS detects the power loss.
- Verify TrueNAS initiates shutdown at the configured threshold.
- Verify other systems on the UPS also shut down.
- Reconnect mains power and verify systems restart cleanly.
Monitoring Without Context
Section titled “Monitoring Without Context”Collecting metrics without understanding what they mean leads to either panic (false alarms) or Complacency (missed warnings). Define clear thresholds for each metric, document them, and ensure The team understands what each alert means and what action to take.
TrueNAS Dashboard Deep Dive
Section titled “TrueNAS Dashboard Deep Dive”Real-Time Metrics
Section titled “Real-Time Metrics”The TrueNAS dashboard provides real-time metrics for:
| Category | Metrics | Refresh Rate |
|---|---|---|
| CPU | Per-core utilization, temperature, frequency | 2 seconds |
| Memory | Used, free, cached, wired, swap | 2 seconds |
| Network | Per-interface Rx/Tx throughput, errors | 2 seconds |
| Disk | Per-disk I/O throughput, latency, queue depth | 2 seconds |
| Pool | Per-pool I/O throughput, capacity, ARC stats | 5 seconds |
| UPS | Battery level, load, estimated runtime | 5 seconds |
Historical Metrics
Section titled “Historical Metrics”TrueNAS stores historical metrics using RRDtool (Round Robin Database). Historical data is retained For approximately:
- 1-minute resolution: 24 hours
- 5-minute resolution: 7 days
- 1-hour resolution: 30 days
For longer retention or higher resolution, use external monitoring (Prometheus + Grafana).
Dashboard Widgets Configuration
Section titled “Dashboard Widgets Configuration”The TrueNAS dashboard is customizable. Navigate to the dashboard and click the gear icon to:
- Add widgets: CPU, memory, pool, network, disk, system temperature, uptime.
- Rearrange widgets: Drag and drop to customize the layout.
- Resize widgets: Some widgets support resizing for more detail.
- Remove widgets: Remove widgets you do not need to reduce visual clutter.
Advanced SMART Analysis
Section titled “Advanced SMART Analysis”SMART Attribute Deep Dive
Section titled “SMART Attribute Deep Dive”Understanding SMART attributes in detail:
Reallocated Sector Count (ID 5):
- Count of sectors that have been reallocated due to read errors.
- Any increase indicates the drive is failing. Plan for immediate replacement.
- This is the single most important SMART attribute for HDDs.
Current Pending Sector Count (ID 197):
- Count of sectors that are unstable and awaiting reallocation.
- Non-zero value means the drive has detected potential bad sectors.
- If the count increases over time, the drive is deteriorating.
Uncorrectable Sector Count (ID 198):
- Count of sectors that could not be recovered after multiple read attempts.
- Any non-zero value means data has been lost. Replace the drive immediately.
Command Timeout (ID 188):
- Count of aborted operations due to timeout.
- Non-zero value can indicate cable issues, controller problems, or drive failure.
UDMA CRC Error Count (ID 199):
- Count of CRC errors on the UDMA interface.
- indicates a bad SATA/SAS cable or connector.
- Replace the cable before replacing the drive.
Media Wear Indicator (ID 173, SSD-specific):
- Percentage of rated endurance used.
- When this reaches 0%, the drive has reached its rated write endurance.
- Most drives continue to function beyond 0% but with increased risk.
Available Spare (ID 232, SSD-specific):
- Percentage of spare blocks remaining.
- When this drops below 10%, the drive is running out of spare blocks for wear leveling.
- Plan for replacement.
SMART Self-Test Log Analysis
Section titled “SMART Self-Test Log Analysis”# View self-test logsudo smartctl -l selftest /dev/sda
# Example output interpretation:# Num Test_Description Status Remaining LifeTime LBA_of_first_error# # 1 Extended offline Completed: read failure 90% 1200h 123456789
# Status values:# Completed without error — Healthy# Completed: read failure — Bad sectors detected# Aborted by host — Test was interrupted# Interrupted (host reset) — System rebooted during test# Not started — Test has not begunSMART Temperature Monitoring
Section titled “SMART Temperature Monitoring”# Monitor temperature continuouslywatch -n 5 "smartctl -A /dev/sda | grep -i temperature'
# Set up temperature alerting with smartd# /etc/smartd.conf:# /dev/sda -W 5,45,55 -R 5 -m admin@example.com# -W: Monitor temperature, warn at 45°C, critical at 55°C# -R: Report changes in raw attributes# -m: Email alertsZFS Scrub Deep Dive
Section titled “ZFS Scrub Deep Dive”Scrub Mechanics
Section titled “Scrub Mechanics”During a scrub, ZFS reads every block in the pool and verifies its checksum:
- Read the block and its stored checksum.
- Compute the checksum of the read data.
- Compare computed vs. Stored checksum.
- If they match: data is intact. Continue.
- If they do not match: a. Read the redundant copy (mirror) or recompute from parity (RAIDZ). B. Verify the corrected data. C. Write the corrected data back to the bad block. D. Log the error.
Scrub Performance Impact
Section titled “Scrub Performance Impact”| Pool Type | Scrub Speed | I/O Impact |
|---|---|---|
| All-SSD | 500 MB/s – 2 GB/s | Low (SSDs handle concurrent scrub + workload) |
| All-HDD | 50–150 MB/s | High (scrub consumes significant read bandwidth) |
| Mirror (SSD) | 1–2 GB/s | Low |
| RAIDZ2 (HDD) | 50–100 MB/s | High |
During a scrub of an HDD pool, normal I/O performance can degrade by 30–50%. Schedule scrubs during Off-peak hours.
Scrub Error Analysis
Section titled “Scrub Error Analysis”# After a scrub completes, check the resultszpool status tank
# Example output:# scan: scrub repaired 0 in 12h34m with 0 errors on Mon Jan 15 10:30# scan: scrub in progress since Mon Jan 15 10:00# 42.5% done, 0h47m to go# 0 repaired, 0 unrepairable errors
# Key fields:# repaired — Number of blocks repaired from redundancy# unrepairable — Number of blocks that could not be repaired (DATA LOSS)# errors — Total checksum errors foundIf unrepairable is non-zero, you have experienced data corruption that could not be recovered from Redundancy. Identify which files were affected and restore from backup.
Email Alerting Advanced Configuration
Section titled “Email Alerting Advanced Configuration”SMTP Configuration for Common Providers
Section titled “SMTP Configuration for Common Providers”Gmail (App Password):
SMTP Server: smtp.gmail.comPort: 465Encryption: SSL/TLSUsername: your-email@gmail.comPassword: <app-specific-password>From: your-email@gmail.comTo: admin@example.comSendGrid:
SMTP Server: smtp.sendgrid.netPort: 465Encryption: SSL/TLSUsername: apikeyPassword: <sendgrid-api-key>From: notifications@example.comTo: admin@example.comMailgun:
SMTP Server: smtp.mailgun.orgPort: 587Encryption: STARTTLSUsername: postmaster@mg.example.comPassword: <mailgun-password>From: notifications@example.comTo: admin@example.comAlert Routing
Section titled “Alert Routing”For environments with multiple administrators, route alerts based on severity:
| Severity | Notification Method | Response Time |
|---|---|---|
| Critical | Email + SMS (via PagerDuty/Opsgenie) | Immediate |
| Warning | Within 4 hours | |
| Information | Email (daily digest) | Next business day |
Prometheus Integration for TrueNAS
Section titled “Prometheus Integration for TrueNAS”Installing Node Exporter
Section titled “Installing Node Exporter”# Option 1: Use the TrueNAS app catalog# Install "Prometheus Node Exporter" from the catalog
# Option 2: Manual installation# SSH into TrueNAS and install node_exportercurl -LO https://github.com/prometheus/node_exporter/releases/download/v1.7.0/node_exporter-1.7.0.linux-amd64.tar.gztar xzf node_exporter-1.7.0.linux-amd64.tar.gzsudo cp node_exporter-1.7.0.linux-amd64/node_exporter /usr/local/bin/Key Metrics to Export
Section titled “Key Metrics to Export”| Metric | Source | Description |
|---|---|---|
zfs_arc_stats | /proc/spl/kstat/zfs/arcstats | ARC hit ratio, size, metadata |
zfs_pool_stats | zpool list | Pool capacity, health, I/O |
smartmon_device | smartctl | Disk temperatures, health |
node_cpu_seconds_total | /proc/stat | CPU utilization |
node_memory_MemAvailable_bytes | /proc/meminfo | Available memory |
node_filesystem_avail_bytes | statvfs | Filesystem free space |
Grafana Dashboard JSON
Section titled “Grafana Dashboard JSON”Import pre-built TrueNAS dashboards from Grafana.com or build custom ones. Key panels:
- Pool Health Status: Single stat panel showing pool state (ONLINE/DEGRADED/FAULTED).
- Pool Capacity Gauge: Gauge showing % used, with thresholds at 70% (yellow) and 90% (red).
- ARC Hit Ratio Time Series: Line chart showing hit ratio over 24 hours.
- Disk Temperature Heatmap: Color-coded table of all disk temperatures.
- I/O Throughput: Stacked area chart of read/write throughput per pool.
- SMART Predictive Failures: Table showing drives with SMART warnings.
UPS Monitoring Deep Dive
Section titled “UPS Monitoring Deep Dive”NUT Configuration Files
Section titled “NUT Configuration Files”TrueNAS NUT configuration is stored in /etc/nut/:
[myups] driver = usbhid-ups port = auto desc = "APC Back-UPS 1500"
# /etc/nut/upsd.confLISTEN 0.0.0.0 3493MAXAGE 15UPS Monitoring Commands
Section titled “UPS Monitoring Commands”# Check UPS statusupsc myups
# Key fields:# battery.charge — Remaining charge percentage# battery.runtime — Estimated minutes remaining# ups.status — "OL" (online), "OB" (on battery), "LB" (low battery)# ups.load — Load percentage# input.voltage — Input voltage# output.voltage — Output voltage# ups.temperature — UPS internal temperatureUPS Shutdown Sequence
Section titled “UPS Shutdown Sequence”When the UPS detects a power failure:
- Power failure detected. UPS switches to battery.
- NUT notifies TrueNAS. The UPS status changes to “OB” (on battery).
- Timer starts. TrueNAS waits for the configured delay (e.g., 5 minutes).
- If power is restored within the delay: Normal operation resumes. No shutdown.
- If timer expires: TrueNAS initiates shutdown: a. Stop all services (SMB, NFS, apps). B. Sync all ZFS pools (
zpool sync). C. Export all pools (zpool export -a). D. Shutdown the system (shutdown -p now). - UPS signals low battery: UPS sends the final “LB” signal and shuts itself down.
Multi-System UPS Monitoring
Section titled “Multi-System UPS Monitoring”For environments with multiple servers on one UPS:
# TrueNAS (master): Connected to UPS via USB# Server 2 (slave): Monitors via NUT network
# On the master (TrueNAS):# /etc/nut/upsd.users[upsmonitor] password = <password> upsmon master
# On the slave (Server 2):# /etc/nut/upsmon.confMONITOR myups@truenas-ip 1 upsmonitor <password> masterSHUTDOWNCMD "/sbin/shutdown -h +0"Log Analysis and Automation
Section titled “Log Analysis and Automation”Centralized Logging
Section titled “Centralized Logging”For environments with multiple systems, centralize logs using:
- syslog: Configure TrueNAS to forward logs to a central syslog server.
- ELK Stack: Elasticsearch + Logstash + Kibana for log analysis.
- Loki + Grafana: Lightweight log aggregation with Grafana integration.
Log Retention
Section titled “Log Retention”TrueNAS retains logs according to:
| Log Type | Default Retention | Location |
|---|---|---|
| System logs | 1 week | /var/log/ |
| Audit logs | Configurable | /var/log/audit/ |
| SMB logs | Configurable | /var/log/samba4/ |
| App logs | Configurable | Per-app |
| Middleware logs | Configurable | Per-app |
Log Analysis Scripts
Section titled “Log Analysis Scripts”#!/bin/bash# Check for common error patterns in system logsLOG_FILE="/var/log/messages"
echo "=== ZFS Errors ==="grep -i "zfs.*error\|zfs.*fault\|zfs.*degraded" "$LOG_FILE" | tail -20
echo "=== Disk Errors ==="grep -i "ata.*error\|scsi.*error\|i/o error\|medium error" "$LOG_FILE" | tail -20
echo "=== Network Errors ==="grep -i "link.*down\|carrier.*lost\|crc.*error" "$LOG_FILE" | tail -20
echo "=== Memory Errors ==="grep -i "out of memory\|oom\|page allocation failure" "$LOG_FILE" | tail -20
echo "=== UPS Events ==="grep -i "ups\|battery\|power failure" "$LOG_FILE" | tail -20Capacity Planning
Section titled “Capacity Planning”Growth Rate Analysis
Section titled “Growth Rate Analysis”# Track pool capacity over timezpool list -v -p | awk '{print strftime("%Y-%m-%d"), $0}' >> /var/log/pool_capacity.log
# Analyze growth rate (daily)cat /var/log/pool_capacity.log | awk '{print $1, $4}' | \ awk 'NR>1 {printf "%s %s %+.1f GB/day\n", $1, $2, ($2-prev)/((NR>2)?1:1)} {prev=$2}'Capacity Forecasting
Section titled “Capacity Forecasting”Based on historical growth rate, project when the pool will reach capacity thresholds:
Where:
- is the total pool capacity
- is the current used capacity
- is the daily growth rate
Alert Fatigue Prevention
Section titled “Alert Fatigue Prevention”Alert Tiers
Section titled “Alert Tiers”| Tier | Severity | Response | Channel |
|---|---|---|---|
| P0 | Critical, data at risk | Immediate | PagerDuty, SMS |
| P1 | Warning, performance degraded | Within 1 hour | Email, Slack |
| P2 | Informational, non-urgent | Next business day | Daily digest |
Alert Suppression
Section titled “Alert Suppression”Suppress alerts during known maintenance windows:
# TrueNAS does not have built-in alert suppression.# Workaround: Disable email alerts during maintenance, re-enable after.# Or use an external alerting system (PagerDuty) with maintenance windows.Advanced Monitoring Configurations
Section titled “Advanced Monitoring Configurations”Prometheus Scrape Configuration
Section titled “Prometheus Scrape Configuration”# prometheus.yml for TrueNAS monitoringglobal: scrape_interval: 15s evaluation_interval: 15s
scrape_configs: - job_name: "truenas'' static_configs: - targets: ["truenas.local:9100'] relabel_configs: - source_labels: [__address__] target_label: instance regex: "(.*):(.*)'' replacement: "${1}'
- job_name: "smartmon'' static_configs: - targets: ["truenas.local:9633']
- job_name: "zfs'' static_configs: - targets: ["truenas.local:9133']Grafana Dashboard JSON Export
Section titled “Grafana Dashboard JSON Export”Export and share Grafana dashboards:
- Navigate to the dashboard in Grafana.
- Click the share icon (top right).
- Select “Export” → “View JSON”.
- Save the JSON file.
- Import on another Grafana instance.
Alerting with Prometheus AlertManager
Section titled “Alerting with Prometheus AlertManager”# Prometheus alert rule for ZFS pool capacitygroups: - name: truenas_alerts rules: - alert: ZFSPoolCapacityHigh expr: zfs_pool_used_bytes / zfs_pool_size_bytes > 0.85 for: 5m labels: severity: warning annotations: summary: "ZFS pool {{ $labels.pool }} is above 85% capacity''description: "The TrueNAS dashboard provides a real-time overview of system health: Comprehensive educational content coverage with definitions and practice problems."Log Analysis Deep Dive
Section titled “Log Analysis Deep Dive”Centralized Log Aggregation
Section titled “Centralized Log Aggregation”For environments with multiple TrueNAS systems or other servers:
ELK Stack (Elasticsearch, Logstash, Kibana):
- Install Filebeat on TrueNAS to forward logs to Logstash.
- Logstash parses and enriches the logs.
- Elasticsearch stores and indexes the logs.
- Kibana provides visualization and search.
Loki + Grafana (lightweight alternative):
- Install Promtail on TrueNAS to forward logs to Loki.
- Loki stores logs in a compressed index.
- Grafana provides LogQL queries and visualization.
- Much lighter than ELK, suitable for smaller deployments.
Log Retention Policies
Section titled “Log Retention Policies”# Configure log rotation in TrueNAS# Navigate to System → Advanced → Syslog# Set maximum log file size (default: 10 MB)# Set maximum number of archived log files (default: 5)Capacity Planning Deep Dive
Section titled “Capacity Planning Deep Dive”Growth Rate Calculation
Section titled “Growth Rate Calculation”# Track pool usage over time#!/bin/bashLOG="/var/log/pool_capacity.log"echo "$(date "+%Y-%m-%d'),$(zpool list -Hp -o capacity tank),$(zpool list -Hp -o used tank)" >> "$LOG"
# Calculate growth rate (last 30 days)tail -30 "$LOG" | awk -F',' ' NR>1 { used_diff = $3 - prev_used days_diff = NR - 1 printf "Daily growth: %.1f GB/day\n", used_diff / days_diff } { prev_used = $3 }'Capacity Planning Spreadsheet
Section titled “Capacity Planning Spreadsheet”| Dataset | Current Usage | Monthly Growth | Months to 80% | Action Date |
|---|---|---|---|---|
| tank/data | 4.2 TB | 50 GB | 12 | 2026-04 |
| tank/media | 8.7 TB | 100 GB | 3 | 2025-07 |
| tank/backups | 2.1 TB | 30 GB | 18 | 2027-08 |
When to Expand
Section titled “When to Expand”| Current Usage | Recommended Action |
|---|---|
| < 50% | Monitor monthly, no action needed |
| 50–70% | Plan expansion within 6 months |
| 70–80% | Order drives, schedule expansion |
| 80–90% | Urgent: expand within 2 weeks |
| > 90% | Critical: expand immediately |
Expansion Methods
Section titled “Expansion Methods”- Add vdevs: Add new vdevs to the pool (increases both capacity and performance).
- Replace with larger drives: Replace drives one at a time with larger drives (increases capacity only).
- Cloud sync archival: Move cold data to cloud storage.
- Data pruning: Delete unnecessary snapshots, old logs, and temporary files.
Summary
Section titled “Summary”This topic covers the essential concepts and techniques related to monitoring and alerting, including key principles and practical applications.
Key concepts include:
- core concepts and definitions
- key principles and frameworks
- practical applications
- common techniques and methods
- evaluation and critical analysis
A thorough understanding of these concepts, combined with regular practice and review, is essential for mastery of this topic.
Worked Examples
Section titled “Worked Examples”Worked examples demonstrating the application of key concepts are covered in the detailed sub-pages linked above.