Utilities System Monitoring - bcl1713/nixos GitHub Wiki

System Resource Monitoring

This guide covers the system resource monitoring capabilities included in this configuration, explaining available tools, integration with Waybar, and customization options.

Overview

The system monitoring module provides:

  • Terminal-based resource monitoring tools (htop, btop, bottom)
  • Graphical monitoring applications
  • Waybar integration for status display
  • Custom system statistics commands
  • Comprehensive resource visibility

Configuration Options

The system monitoring module is configured through userPackages.utilities.system.monitoring:

userPackages.utilities.system.monitoring = {
  enable = true;                # Master switch for all monitoring tools
  
  topTools = {
    enable = true;             # Terminal-based monitoring tools
  };
  
  graphical = {
    enable = true;             # GUI monitoring applications
  };
  
  waybar = {
    enable = true;             # Waybar integration
    cpu.enable = true;         # CPU usage display
    memory.enable = true;      # Memory usage display
    disk.enable = true;        # Disk usage display
    temperature.enable = true; # Temperature monitoring
  };
};

These options can be set in your profiles/personal/home.nix file.

Terminal-Based Monitoring

When topTools.enable = true, the following terminal utilities are available:

htop

A classic, interactive process viewer with enhanced features:

htop

Key features:

  • Process tree view
  • Resource usage graphs
  • User-friendly interface
  • Detailed process information

btop

An enhanced monitoring tool with more detailed graphs:

btop

Key features:

  • Modern UI with detailed graphs
  • Disk I/O visualization
  • Network usage monitoring
  • Temperature sensing

bottom

A stylish resource monitor with customizable widgets:

btm

Key features:

  • Rust-based performance
  • Clean, customizable interface
  • Process management
  • Detailed statistics

Graphical Monitoring

When graphical.enable = true, the following GUI tools are installed:

GNOME System Monitor

A comprehensive graphical resource monitor:

gnome-system-monitor

Key features:

  • Process management
  • Resource history graphs
  • Disk usage visualization
  • Network monitoring

Glances

A web-based cross-platform monitoring tool:

glances

Key features:

  • Web interface
  • Remote monitoring capabilities
  • Comprehensive system view
  • Alert system

Waybar Integration

When waybar.enable = true and its sub-options are enabled, system metrics appear in your Waybar:

CPU Module

Shows CPU usage percentage with a processor icon:

waybar.cpu.enable = true;

This displays:

  • Current CPU usage percentage
  • Visual indicator via color changes
  • Hover tooltip with additional info

Memory Module

Shows RAM usage with memory chip icon:

waybar.memory.enable = true;

This displays:

  • Memory usage percentage
  • Tooltip showing used/total memory in GB
  • Regular updates at 5-second intervals

Disk Module

Shows storage usage with disk icon:

waybar.disk.enable = true;

This displays:

  • Percentage of used disk space
  • Path being monitored (default: /)
  • Hover tooltip with detailed usage info

Temperature Module

Shows system temperature with appropriate icon:

waybar.temperature.enable = true;

This displays:

  • Current temperature in Celsius
  • Dynamic icon based on temperature range
  • Warning indicator for high temperatures

Quick System Stats

A custom script is provided for quick system information:

system-stats

This command shows:

  • CPU usage summary
  • Memory usage details
  • Disk space information
  • System temperatures (if available)
  • Top processes by CPU and memory usage

Customizing Monitoring

Waybar Customization

You can customize the appearance of monitoring modules in Waybar by editing your custom CSS:

/* In ~/.config/waybar/style.css or through Home Manager */

#cpu {
  color: #fab387;  /* Peach color from Catppuccin */
  border-bottom: 2px solid #fab387;
  margin-right: 10px;
}

#memory {
  color: #cba6f7;  /* Mauve color from Catppuccin */
  border-bottom: 2px solid #cba6f7;
  margin-right: 10px;
}

/* Additional styling... */

Monitoring Performance Impact

Resource monitoring tools themselves consume system resources. To minimize impact:

  • Close monitoring tools when not in use
  • Reduce update frequency for continuous monitors
  • Limit the number of metrics displayed in Waybar
  • Use lightweight tools for routine monitoring

Troubleshooting Monitoring Tools

Common Issues

  1. High resource usage from monitoring tools:

    • Increase update intervals
    • Use lighter alternatives (e.g., htop instead of btop)
    • Limit the metrics being monitored
  2. Missing temperature readings:

    • Ensure lm_sensors is properly configured
    • Run sudo sensors-detect to detect hardware
    • Check if your hardware exposes temperature sensors
  3. Waybar modules not displaying:

    • Verify the module is enabled in configuration
    • Check Waybar's JSON configuration
    • Look for errors in Waybar's log output

Diagnostic Commands

To troubleshoot monitoring issues:

# Check if sensors are detected
sensors

# Verify system statistics are available
cat /proc/stat
cat /proc/meminfo

# Check Waybar status
systemctl --user status waybar

# View Waybar logs
journalctl --user -u waybar

Integration with Other Tools

Power Management Integration

Monitoring tools integrate well with power management:

userPackages.utilities.powerManagement = {
  enable = true;
  indicator.enable = true;
};

This adds a power profile indicator to Waybar that shows your current power profile (balanced, performance, powersave).

Disk Usage Analysis

For in-depth storage analysis, combine with disk usage tools:

userPackages.utilities.diskUsage = {
  enable = true;
  interactiveTools.enable = true;
  graphicalTools.enable = true;
};

This provides tools like ncdu and baobab for detailed disk usage visualization.

Related Pages