Skip to main content

VMStat Data Source

The VMStat data source monitors the performance of the local Linux/Unix host by running the vmstat system utility and parsing its output. When the data source starts, it launches a persistent vmstat process that reports system statistics at a configurable interval. The output is continuously monitored and parsed into Mango data points, providing real-time visibility into CPU utilization, memory usage, swap activity, I/O operations, and system scheduling metrics.

This data source is useful for monitoring the health of the server running Mango, tracking resource utilization trends, and setting up alerts for performance issues such as high CPU usage, memory exhaustion, or excessive swap activity.

Overview

PropertyValue
ModulemangoAutomation-VMStat
Protocolvmstat (Linux)
DirectionPolling
Typical UseLinux system resource monitoring (CPU, memory, I/O)

Prerequisites

  • A Linux or Unix operating system on the Mango server. The VMStat data source is not available on Windows.
  • The vmstat utility must be installed and accessible to the Mango process. On most Linux distributions, vmstat is included in the procps or procps-ng package and is available by default.
  • Sufficient permissions for the Mango process to execute vmstat.

Configuration

Data Source Settings

SettingDescription
NameA descriptive name for the data source.
Poll secondsHow often the vmstat process reports data back to Mango. This sets the -n interval parameter of the vmstat command.
Output scaleAdjusts byte-based values to different scales for readability. Options include: bytes, k (kilobytes, 1024-based), KB (kilobytes, 1000-based), m (megabytes, 1024-based), and MB (megabytes, 1000-based).

Data Point Configuration

Each data point maps to a specific column in the vmstat output. The available attributes correspond to the standard vmstat output fields.

CategoryAttributeDescription
ProcsrNumber of processes waiting for run time (run queue length).
ProcsbNumber of processes in uninterruptible sleep (blocked).
MemoryswpdAmount of virtual memory (swap) used.
MemoryfreeAmount of idle (free) memory.
MemorybuffAmount of memory used as buffers.
MemorycacheAmount of memory used as cache.
SwapsiAmount of memory swapped in from disk per second.
SwapsoAmount of memory swapped out to disk per second.
IObiBlocks received from a block device per second.
IOboBlocks sent to a block device per second.
SysteminNumber of interrupts per second, including the clock.
SystemcsNumber of context switches per second.
CPUusTime spent running user (non-kernel) code, as a percentage.
CPUsyTime spent running kernel (system) code, as a percentage.
CPUidIdle time, as a percentage.
CPUwaTime spent waiting for I/O, as a percentage.
CPUstTime stolen from a virtual machine, as a percentage.

For detailed descriptions of each attribute, see the vmstat man page.

Common Patterns

Server Health Monitoring

Create a VMStat data source with points for CPU idle time (id), memory free, swap used, and I/O wait. Configure event detectors to alert when:

  • CPU idle drops below 10% (high CPU utilization)
  • Free memory drops below a threshold
  • Swap usage exceeds a threshold (indicating memory pressure)
  • I/O wait exceeds 20% (indicating disk bottleneck)

Capacity Planning

Track CPU utilization, memory usage, and I/O metrics over time to identify trends. Rising CPU utilization or growing swap usage may indicate that the server needs more resources or that the Mango configuration needs optimization (fewer data points, longer poll periods, etc.).

Virtual Machine Performance

In virtualized environments, the st (steal time) metric shows time taken from the virtual machine by the hypervisor. Monitor this to detect when the VM host is over-committed and your Mango instance is not receiving its allocated CPU time.

Correlating System Performance with Mango Load

Combine VMStat data with Internal data source metrics (work item queues, poll durations, database write throughput) to correlate Mango application behavior with underlying system performance. This helps distinguish between application-level issues and infrastructure-level bottlenecks.

Disk I/O Monitoring

Monitor the bi (blocks in) and bo (blocks out) metrics to track disk I/O patterns. High block I/O combined with high I/O wait often indicates that the database or logging system is bottlenecked on disk performance.

Troubleshooting

Data Source Fails to Start

  1. Verify that vmstat is installed on the system. Run which vmstat or vmstat 1 1 from the command line to confirm.
  2. Ensure the Mango process has permission to execute vmstat. On some hardened systems, process execution may be restricted.
  3. Check that the operating system is Linux or Unix. This data source is not supported on Windows.

Missing or Zero Values

  1. Some vmstat attributes may not be available on all Linux distributions or kernel versions. For example, the st (steal time) field is only present on systems running as virtual machines with a hypervisor that reports steal time.
  2. The first line of vmstat output typically shows averages since boot rather than current values. The data source skips this initial line and uses subsequent reports.

Unexpected Scale

  1. If memory values appear much larger or smaller than expected, check the Output scale setting. Switching between bytes, kilobytes, and megabytes changes the magnitude of reported values.
  2. Remember that vmstat uses 1024-based units for the lowercase scale options (k, m) and 1000-based units for the uppercase options (KB, MB).

Process Terminates Unexpectedly

  1. If the vmstat process is killed by the operating system (e.g., by an out-of-memory killer), the data source will stop producing values. Restart the data source to launch a new vmstat process.
  2. Check system logs (/var/log/syslog or dmesg) for OOM killer events if the process dies repeatedly.