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
| Property | Value |
|---|---|
| Module | mangoAutomation-VMStat |
| Protocol | vmstat (Linux) |
| Direction | Polling |
| Typical Use | Linux 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
vmstatutility must be installed and accessible to the Mango process. On most Linux distributions,vmstatis included in theprocpsorprocps-ngpackage and is available by default. - Sufficient permissions for the Mango process to execute
vmstat.
Configuration
Data Source Settings
| Setting | Description |
|---|---|
| Name | A descriptive name for the data source. |
| Poll seconds | How often the vmstat process reports data back to Mango. This sets the -n interval parameter of the vmstat command. |
| Output scale | Adjusts 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.
| Category | Attribute | Description |
|---|---|---|
| Procs | r | Number of processes waiting for run time (run queue length). |
| Procs | b | Number of processes in uninterruptible sleep (blocked). |
| Memory | swpd | Amount of virtual memory (swap) used. |
| Memory | free | Amount of idle (free) memory. |
| Memory | buff | Amount of memory used as buffers. |
| Memory | cache | Amount of memory used as cache. |
| Swap | si | Amount of memory swapped in from disk per second. |
| Swap | so | Amount of memory swapped out to disk per second. |
| IO | bi | Blocks received from a block device per second. |
| IO | bo | Blocks sent to a block device per second. |
| System | in | Number of interrupts per second, including the clock. |
| System | cs | Number of context switches per second. |
| CPU | us | Time spent running user (non-kernel) code, as a percentage. |
| CPU | sy | Time spent running kernel (system) code, as a percentage. |
| CPU | id | Idle time, as a percentage. |
| CPU | wa | Time spent waiting for I/O, as a percentage. |
| CPU | st | Time 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
- Verify that
vmstatis installed on the system. Runwhich vmstatorvmstat 1 1from the command line to confirm. - Ensure the Mango process has permission to execute
vmstat. On some hardened systems, process execution may be restricted. - Check that the operating system is Linux or Unix. This data source is not supported on Windows.
Missing or Zero Values
- Some
vmstatattributes 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. - The first line of
vmstatoutput typically shows averages since boot rather than current values. The data source skips this initial line and uses subsequent reports.
Unexpected Scale
- 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.
- Remember that
vmstatuses 1024-based units for the lowercase scale options (k, m) and 1000-based units for the uppercase options (KB, MB).
Process Terminates Unexpectedly
- If the
vmstatprocess 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 newvmstatprocess. - Check system logs (
/var/log/syslogordmesg) for OOM killer events if the process dies repeatedly.
Related Pages
- Data Sources Overview — General data source and data point concepts
- Internal Data Source — Monitor Mango's own JVM and system health metrics
- SSH Data Source — Execute commands on remote hosts for system monitoring via SSH
- High CPU Usage — Diagnose CPU issues using vmstat and internal metrics