{"id":760,"date":"2016-08-12T11:43:08","date_gmt":"2016-08-12T10:43:08","guid":{"rendered":"http:\/\/www.haxed.me.uk\/?p=760"},"modified":"2016-08-12T11:44:27","modified_gmt":"2016-08-12T10:44:27","slug":"using-sar-tell-story","status":"publish","type":"post","link":"https:\/\/haxed.me.uk\/index.php\/2016\/08\/12\/using-sar-tell-story\/","title":{"rendered":"Using Sar to tell a story"},"content":{"rendered":"<p>So, a customer is experiencing slowness\/sluggishness in their app. You know there is not issue with the hypervisor from instinct, but instinct isn&#8217;t enough. Using tools like xentop, sar, bwm-ng are critical parts of live and historical troubleshooting. <\/p>\n<p>Sar can tell you a story, if you can ask the storyteller the write questions, or even better, pick up the book and read it properly. You&#8217;ll understand what the plot, scenario, situation and exactly how to proceed with troubleshooting by paying attention to these data and knowing which things to check under certain circumstances. <\/p>\n<p>This article doesn&#8217;t go in depth to that, but it gives you a good reference of a variety of tests, the most important being, cpu usage, io usage, network usage, and load averages. <\/p>\n<h1> CPU Usage of all processors <\/h1>\n<pre>\r\n# Grab details live\r\nsar -u 1 3\r\n\r\n# Use historical binary sar file\r\n# sa10 means '10th day' of current month.\r\nsar -u -f \/var\/log\/sa\/sa10 \r\n<\/pre>\n<h1> CPU Usage of a particular Processor <\/h1>\n<pre>\r\nsar -P ALL 1 1\r\n<\/pre>\n<p>&#8216;-P 1&#8217; means check only the 2nd Core. (Core numbers start from 0).<\/p>\n<pre>\r\nsar -P 1 1 5\r\n<\/pre>\n<p>The above command displays real time CPU usage for core number 1, every 1 second for 5 times.<\/p>\n<h1> Observing Changes in Memory over time <\/h1>\n<pre>\r\nsar -r 1 3\r\n<\/pre>\n<p>The above command provides memory stats every 1 second for a total of 3 times.<\/p>\n<h1> Observing Swap usage over time <\/h1>\n<pre>\r\nsar -S 1 5\r\n<\/pre>\n<p>The above command reports swap statistics every 1 seconds, a total 3 times.<\/p>\n<h1> Overall I\/O activity <\/h1>\n<pre>\r\nsar -b 1 3 \r\n<\/pre>\n<p>The above command checks every 1 seconds, 3 times.<\/p>\n<h1> Individual Block Device I\/O Activities <\/h1>\n<p>This is a useful check for LUN , block devices and other specific mounts<\/p>\n<pre>\r\nsar -d 1 1 \r\nsar -p d\r\n<\/pre>\n<p>DEV &#8211; indicates block device, i.e. sda, sda1, sdb1 etc.<\/p>\n<h1> Total Number processors created a second \/ Context switches <\/h1>\n<pre>\r\nsar -w 1 3\r\n<\/pre>\n<h1> Run Queue and Load Average <\/h1>\n<pre>\r\nsar -q 1 3 \r\n<\/pre>\n<p>This reports the run queue size and load average of last 1 minute, 5 minutes, and 15 minutes. \u201c1 3\u201d reports for every 1 seconds a total of 3 times.<\/p>\n<h1> Report Network Statistics <\/h1>\n<pre>\r\nsar -n KEYWORD\r\n<\/pre>\n<p>KEYWORDS Available;<\/p>\n<p>    DEV \u2013 Displays network devices vital statistics for eth0, eth1, etc.,<br \/>\n    EDEV \u2013 Display network device failure statistics<br \/>\n    NFS \u2013 Displays NFS client activities<br \/>\n    NFSD \u2013 Displays NFS server activities<br \/>\n    SOCK \u2013 Displays sockets in use for IPv4<br \/>\n    IP \u2013 Displays IPv4 network traffic<br \/>\n    EIP \u2013 Displays IPv4 network errors<br \/>\n    ICMP \u2013 Displays ICMPv4 network traffic<br \/>\n    EICMP \u2013 Displays ICMPv4 network errors<br \/>\n    TCP \u2013 Displays TCPv4 network traffic<br \/>\n    ETCP \u2013 Displays TCPv4 network errors<br \/>\n    UDP \u2013 Displays UDPv4 network traffic<br \/>\n    SOCK6, IP6, EIP6, ICMP6, UDP6 are for IPv6<br \/>\n    ALL \u2013 This displays all of the above information. The output will be very long.<\/p>\n<pre>\r\nsar -n DEV 1 1\r\n<\/pre>\n<h1> Specify Start Time <\/h1>\n<pre>\r\nsar -q -f \/var\/log\/sa\/sa11 -s 11:00:00\r\n<\/pre>\n<pre>\r\nsar -q -f \/var\/log\/sa\/sa11 -s 11:00:00 | head -n 10\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>So, a customer is experiencing slowness\/sluggishness in their app. You know there is not issue with the hypervisor from instinct, but instinct isn&#8217;t enough. Using tools like xentop, sar, bwm-ng are critical parts of live and historical troubleshooting. Sar can &hellip; <a href=\"https:\/\/haxed.me.uk\/index.php\/2016\/08\/12\/using-sar-tell-story\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[58,15,63,10,28,9,4,3],"tags":[],"class_list":["post-760","post","type-post","status-publish","format-standard","hentry","category-benchmarking","category-cloud","category-disk-tools","category-filesystem","category-interweb","category-linux","category-networking","category-security"],"_links":{"self":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/760","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/comments?post=760"}],"version-history":[{"count":2,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/760\/revisions"}],"predecessor-version":[{"id":762,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/760\/revisions\/762"}],"wp:attachment":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/media?parent=760"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/categories?post=760"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/tags?post=760"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}