Swap Memory Monitoring
Use This InfluxDB Integration for FreeLinux RAM (random access memory) is divided into chunks called pages. Swapping is the process by which Linux moves pages of memory from RAM into disk to free up memory. The combined size of physical memory and swap space is how much virtual memory a system has available.
Swapping is used because it allows a system to use more memory than physically available. This allows users to run more active applications than their computer hardware would be able to support without memory paging. The potential downside of this type of memory management is that disk is far slower than RAM, which means that if swapping isn’t done efficiently, the performance of the application will drop massively as the computer waits for memory to move from disk back into RAM. A computer constantly swapping memory is said to be thrashing and will be very slow. Thrashing will continue until the user closes some of the open applications or the operating system itself shuts down the processes.
Why use a Telegraf plugin for Swap?
The Telegraf plugin for Swap makes it easy to monitor what is happening with Swap Memory on your Linux system. You can then use Telegraf to output your metric data to 40 different data stores for long-term storage and analysis. These metrics could be used to optimize the memory usage of your application and improve user experience. This generally involves finding ways to break up huge data structures stored in memory.
How to monitor Swap using the Telegraf plugin
The Telegraf plugin for Linux Swap Memory doesn’t require any configuration beyond just putting the input plugin into your configuration file like below:
# Read metrics about swap memory usage [[inputs.swap]] # no configuration
Key Swap metrics to use for monitoring
Some of the important Swap metrics that you should proactively monitor include:
free
(int, bytes): free swap memorytotal
(int, bytes): total swap memoryused
(int, bytes): used swap memoryused_percent
(float, percent): percentage of swap memory usedin
(int, bytes): data swapped in since last boot calculated from page numberout
(int, bytes): data swapped out since last boot calculated from page number