SAR Cheatsheet



Published: 2018-04-19 18:03:02 +0000
Categories: Misc,

Language

Misc

Description

sar can be an incredibly helpful utility when examining system performance (especially after the fact), but if not used regularly it's easy to forget which flags to use

This short post details a number of useful arguments to pass

Based On

Snippet

# Basic Output
sar

# CPU Usage per Core
sar -P ALL

# Memory Usage
sar -r

# Swap Usage
sar -S

# I/O
sar -b

# I/O by Block Device
sar -d -p

# Check Run Queue and Load Average
sar -q

# Network Stats
sar -n DEV

# Where DEV can be one of the following
# 
# DEV â Displays network devices vital statistics for eth0, eth1, etc.,
# EDEV â Display network device failure statistics
# NFS â Displays NFS client activities
# NFSD â Displays NFS server activities
# SOCK â Displays sockets in use for IPv4
# IP â Displays IPv4 network traffic
# EIP â Displays IPv4 network errors
# ICMP â Displays ICMPv4 network traffic
# EICMP â Displays ICMPv4 network errors
# TCP â Displays TCPv4 network traffic
# ETCP â Displays TCPv4 network errors
# UDP â Displays UDPv4 network traffic
# SOCK6, IP6, EIP6, ICMP6, UDP6 are for IPv6
# ALL â This displays all of the above information. The output will be very long.

# Historic Information
#
# By default, sar will output for the previous 24 hours, 
# however previous days can be checked with
sar -f /var/log/sa/sa15 -n DE

Usage Example

# Check Memory usage for yesterday
sar -f /var/log/sa/sa`date --date='-1 day' +'%d'` -r

Keywords

SAR, cheatsheet, sysstat, system performance, system resources, monitoring, historic,

Latest Posts

Urldecode string (LUA)
FFMPEG Convert YUV444p to YUV420p (BASH)
Forcing FFMPEG to honour segment length in HLS Stream Creator (BASH)
Force CURL to place request to a specific IP (BASH)
Set a variable only if it is undefined (Javascript)
Ignore query string with Nginx caching proxy (NGinx)
Get breakdown of UK and non-UK votes for a Parliamentary Petition (Python)
Decompress Mozilla Firefox jsonlz4 bookmark backup files (Python)
Setting Git author details for a single repo (Git)
Checking Virtual Machine Resource Allocations with Libvirt (BASH)

Copyright © 2019 Ben Tasker | Sitemap | Privacy Policy
Available at snippets.bentasker.co.uk and snippets.6zdgh5a5e6zpchdz.onion