SlideShare a Scribd company logo
Linux Monitoring and Troubleshooting
By
MySQL Consulting
Team
About MyDBOPS
• MySQL Consulting
• MySQL Support
• Remote DBA support.
• Expert MySQL solutions
• MariaDB, Percona, Galera, TokuDB are
supported too.
Agenda
• Introduction
• Linux Architecture
• Devices we monitor
• Important tools
• Examples
INTRODUCTION
 Unix-like computer operating system.
 The monitoring and maintenance of the system is the most important task.
 There are many commands line utilities created for this purpose.
CPU l
Network Bandwidth
Memory usage
Disk usage
Syslogs & A
Running processes
etc.
Linux Architecture
Devices we monitor
users
Important tools
netstat
free
Df
Du
ps
history
lsof
top
systat
Sar
iostat
vmstat
Pidstat
mpstat
ping
telnet
ifconfig
w & uptime
who
whoami
Top
 Small tool, pre-installed in many unix systems.
 Display all running and active real time process
in ordered list & updates it regularly.
 CPU usage, Memory usage, Swap Memory, Cache Size,
Buffer Size, Process PID, User, Commands and much
more
 shows high memory and cpu utilization of a running
processes.
sysstat
 powerful logging and monitoring tool for Linux/Unix systems.
 contains utilities to monitor system performance and usage activity.
 used to monitor system performance and troubleshoot problems.
 sysstat is a go-to for power users and can log and track pretty much everything going on
within
your Linux box.
To install :
• redhat based - yum install sysstat
• Debian based - apt-get install sysstat
sar
 Sar(System Activity Report) is part of the sysstat package.
 collects and displays ALL system activities statistics.
 can monitor performance of various Linux subsystems (CPU, Memory, I/O..) in real time.
 also collect all performance data on an on-going basis, store them, and do historical analysis to
identify bottlenecks.
 collected information can be used with ksar to plot graphs.
Sar examples
CPU Usage of ALL CPUs (sar -u)
 This gives the cumulative real-time CPU usage of all CPUs.
 sar -u 1 3 Displays real time CPU usage every 1 second
for 3 times.
 “-P ALL” indicates that it should displays statistics for ALL
the individual Cores.
%user - % of cpu utilz. that occurred while executing at user level
%nice – at user level with nice priority.
%system – at sytem level
%iowait - % of time that cpu were idle during which s/m had an
outstanding disk I/O request
%idle – idle & s/m did not have an oustanding disk i/o
%steal - % of time spent in involuntary wait by cpu/cpu’s
Sar examples
• Memory Free and Used (sar -r)
 This reports the memory statistics.
 “1 3 reports for every 1 seconds a total of 3 times.″
 focus on “kbmemfree” and “kbmemused” for free and used memory.
Sar examples
• Overall I/O Activities (sar -b)
 This reports I/O statistics.
 “1 3 reports for every 1 seconds a total of 3 times.″
 tps – Transactions per second (this includes both read and write)
 rtps – Read transactions per second
 wtps – Write transactions per second
 bread/s – Bytes read per second
 bwrtn/s – Bytes written per second
Sar examples
• Individual Block Device I/O Activities (sar -d)
 To identify the activities by the individual block devices
(i.e a specific mount point, or LUN, or partition)
 The device name (DEV column) can display the actual
device name, use “sar -d”
tps –no of transfer per second
rd_sec/s – no sector read from device
wr_sec/s – no of sectors write from
device
avgrq-sz – avg size in sectors of the
req that were issued to device.
avgqu-sz – avg queue length of
request
await – avg time for i/o req.
svctm – avg service time for i/o req
%util – % of cputime during which i/o
req where issued
Sar examples
• Reports run queue and load average (sar -q)
 This reports the run queue size and load average of last 1 minute, 5 minutes, and 15 minutes.
 “1 3 reports for every 1 seconds a total of 3 times.″
runq-sz – run queue length
(no of task wtng for run time)
plist-sz – no of tasks in the task list
Sar examples
• To view previous records(sar –f)
 To view old day records
 Followed by path of old files
 Maintains one month records
sar -f /var/log/sa/sa15
sar -f /var/log/sa/sa15 -q 1 3
LC_ALL=C sar -f /var/log/sa/sa14 -A
iostat
 simple tool that will collect and show system
input and output storage device statistics.
 often used to trace storage device performance
issues including devices, local disks, remote disks
such as NFS.
%user - % of cpu utilz. that occurred while executing at user level
%nice – at user level with nice priority.
%system – at sytem level
%iowait - % of time that cpu were idle during which s/m had an
outstanding disk I/O request
%idle – idle & s/m did not have an oustanding disk i/o
%steal - % of time spent in involuntary wait by cpu/cpu’s
blk_read/s – amt of data read from device
blk_wrtn/s – amt of data write to device
Blk_read - total no of block reads
Blk_wrtn - total no of block writes
vmstat
 Summary information of Memory, Processes, Paging etc.
 used to display statistics of virtual memory, kernerl threads, disks, system processes, I/O
blocks, interrupts, CPU activity and much more.
r: The no of processes waiting for run time. b - The no of processes in uninterruptable sle
bi: Blocks sent to a block device (blocks/s). bo-: Blocks received from a block device (blocks/s).
si – Amount of memory swapped in from disk (kB/s). so – Amount of memory swapped to disk (kB/s).
in: The no of interrupts/s including the clock. cs : The number of context switches per second.
us: user time sy: system time id: idle time
pidstat
 pidstat is a part of sysstat utility.
 To monitor an individual process which is managed by kernel and generate report.
 Can also be used for monitoring the child processes of selected tasks.
 reports various statistics including CPU used by a process, disk usage statistics of a process,
statistics for threads associated with selected tasks and child processes.
Display statistics for all running process - pidstat -p ALL
Display statistics for a particular process - pidstat -p pid (process id of application)
Display statistics based on process name - pidstat -C “mysql”
Display Statistics of Dependent Process in
Tree Format using –t - pidstat -t -C "mysql"
mpstat
 mpstat is a part of sysstat utility.
 To monitor CPU utilization in our system.
 Will be more useful if our system has multiple processor.
Print CPU utilization per processors - mpstat -P 0 , mpstat -P 1
Print all CPU Utilization - mpstat -P ALL
Print CPU utilization using intervals - mpstat 3 4
Print mpstat version - mpstat -V
netstat
 monitoring incoming and outgoing network packets statistics as well as interface statistics.
 very useful tool for every system administrator to monitor network performance and
troubleshoot network related problems..
free
 built-in command that displays the total amount of free and used physical memory on your
machine.
 also displays the buffers used by the kernel at that given moment.
df
 df is an abbreviation for disk free.
 pre-installed program in all unix systems used to display the amount of available disk space for
filesystem which the user have access to.
du
 Linux “du” (Disk Usage) is a standard Unix/Linux command.
 used to check the information of disk usage of files and
directories on a machine.
 has many parameter options that can be used to get the
results in many formats.
 also displays the files and directory sizes in a recursively
manner.
ps
 basic commands for viewing the processes running on the system
 It provides a snapshot of the current processes along with detailed information like user id, cpu
usage, memory usage, command name etc.
 It does not display data in real time like top or htop commands.
lsof
 lsof meaning 'List Open Files' is used to find out which files are open by which process.
 when a disk cannot be un-mounted as it says the files are being used.
lsof some examples
 List User Specific Opened Files
lsof -u mydbops
 Exclude User with ‘^’ Character
lsof -i -u^root
 Kill all Activity of Particular User
kill -9 `lsof -t -u mydbops`
 List all Network Connections
lsof -i
 Search by PID
lsof -p 1
ping
 used to find out whether the peer host/gateway is reachable.
 how much time it takes for that data to be exchanged.
 default ping waits for 1 second before sending the next packet. increase or decrease using
option -i.
ping 122.166.212.214
ping -i 5 122.166.212.214
ping -c 3 122.166.212.214
telnet
 used for interactive communication with another host using the TELNET protocol.
 command mode.
Syntax : telnet host port
w & uptime
 w - displays information about the users currently on the machine, and their processes
 uptime - Tell how long the system has been running.
who & whoami
 who - prints information about all users who are currently logged in.
 Displays the username, line, and time of all currently logged-in sessions.
 whoami - This command prints the username associated with the current effective user ID.
history
 The history command can be used to list Bash's log of the commands you have typed:
 The history command performs one of several operations related to recently-executed
commands recorded in a history.
Syntax: history
Eg: history | less
 Search the history using Control+R
How MyDBOPS Can Help You
• MySQL Consulting
• MySQL Support
• Remote DBA
• 24 * 7 Support
Contact : mysqlsupport@mydbops.com
Thank You

More Related Content

What's hot

Linux Memory Management
Linux Memory ManagementLinux Memory Management
Linux Memory Management
Ni Zo-Ma
 
Module 13 - Troubleshooting
Module 13 - TroubleshootingModule 13 - Troubleshooting
Module 13 - Troubleshooting
T. J. Saotome
 
Best Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized EnvironmentsBest Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized Environments
Jignesh Shah
 
Boosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uringBoosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uring
ShapeBlue
 
BPF: Tracing and more
BPF: Tracing and moreBPF: Tracing and more
BPF: Tracing and more
Brendan Gregg
 

What's hot (20)

Kernel Recipes 2017: Using Linux perf at Netflix
Kernel Recipes 2017: Using Linux perf at NetflixKernel Recipes 2017: Using Linux perf at Netflix
Kernel Recipes 2017: Using Linux perf at Netflix
 
LinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking WalkthroughLinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking Walkthrough
 
Linux Troubleshooting
Linux TroubleshootingLinux Troubleshooting
Linux Troubleshooting
 
Linux memory-management-kamal
Linux memory-management-kamalLinux memory-management-kamal
Linux memory-management-kamal
 
The basic concept of Linux FIleSystem
The basic concept of Linux FIleSystemThe basic concept of Linux FIleSystem
The basic concept of Linux FIleSystem
 
UM2019 Extended BPF: A New Type of Software
UM2019 Extended BPF: A New Type of SoftwareUM2019 Extended BPF: A New Type of Software
UM2019 Extended BPF: A New Type of Software
 
PostgreSQL on EXT4, XFS, BTRFS and ZFS
PostgreSQL on EXT4, XFS, BTRFS and ZFSPostgreSQL on EXT4, XFS, BTRFS and ZFS
PostgreSQL on EXT4, XFS, BTRFS and ZFS
 
[232] 성능어디까지쥐어짜봤니 송태웅
[232] 성능어디까지쥐어짜봤니 송태웅[232] 성능어디까지쥐어짜봤니 송태웅
[232] 성능어디까지쥐어짜봤니 송태웅
 
BPF - in-kernel virtual machine
BPF - in-kernel virtual machineBPF - in-kernel virtual machine
BPF - in-kernel virtual machine
 
Linux memory
Linux memoryLinux memory
Linux memory
 
Linux Memory Management
Linux Memory ManagementLinux Memory Management
Linux Memory Management
 
Storage Management in Linux OS.ppt
Storage Management in Linux OS.pptStorage Management in Linux OS.ppt
Storage Management in Linux OS.ppt
 
Velocity 2015 linux perf tools
Velocity 2015 linux perf toolsVelocity 2015 linux perf tools
Velocity 2015 linux perf tools
 
Module 13 - Troubleshooting
Module 13 - TroubleshootingModule 13 - Troubleshooting
Module 13 - Troubleshooting
 
Best Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized EnvironmentsBest Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized Environments
 
Linux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old SecretsLinux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old Secrets
 
Boosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uringBoosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uring
 
Memory management in Linux
Memory management in LinuxMemory management in Linux
Memory management in Linux
 
BPF: Tracing and more
BPF: Tracing and moreBPF: Tracing and more
BPF: Tracing and more
 
Basic 50 linus command
Basic 50 linus commandBasic 50 linus command
Basic 50 linus command
 

Similar to Linux monitoring and Troubleshooting for DBA's

Perf stat windows
Perf stat windowsPerf stat windows
Perf stat windows
Accenture
 

Similar to Linux monitoring and Troubleshooting for DBA's (20)

linux monitoring and performance tunning
linux monitoring and performance tunning linux monitoring and performance tunning
linux monitoring and performance tunning
 
Refining Linux
Refining LinuxRefining Linux
Refining Linux
 
Bedtime Stories on Operating Systems.pdf
Bedtime Stories on Operating Systems.pdfBedtime Stories on Operating Systems.pdf
Bedtime Stories on Operating Systems.pdf
 
Designing Tracing Tools
Designing Tracing ToolsDesigning Tracing Tools
Designing Tracing Tools
 
16aug06.ppt
16aug06.ppt16aug06.ppt
16aug06.ppt
 
Linux System Monitoring
Linux System Monitoring Linux System Monitoring
Linux System Monitoring
 
Designing Tracing Tools
Designing Tracing ToolsDesigning Tracing Tools
Designing Tracing Tools
 
The New Systems Performance
The New Systems PerformanceThe New Systems Performance
The New Systems Performance
 
Basics of unix
Basics of unixBasics of unix
Basics of unix
 
Linux Systems Performance 2016
Linux Systems Performance 2016Linux Systems Performance 2016
Linux Systems Performance 2016
 
operating system
operating systemoperating system
operating system
 
this is the slide design for chapter 4 of reource monitoring and mamangemnt
this is the  slide design for chapter 4 of reource monitoring and mamangemntthis is the  slide design for chapter 4 of reource monitoring and mamangemnt
this is the slide design for chapter 4 of reource monitoring and mamangemnt
 
Perf stat windows
Perf stat windowsPerf stat windows
Perf stat windows
 
Advanced Operating Systems......Process Management
Advanced Operating Systems......Process ManagementAdvanced Operating Systems......Process Management
Advanced Operating Systems......Process Management
 
Chapter 1 Introduction to Operating System Concepts
Chapter 1 Introduction to Operating System ConceptsChapter 1 Introduction to Operating System Concepts
Chapter 1 Introduction to Operating System Concepts
 
Os
OsOs
Os
 
Os
OsOs
Os
 
Jana treek 4
Jana treek 4Jana treek 4
Jana treek 4
 
KCC_Final.pdf
KCC_Final.pdfKCC_Final.pdf
KCC_Final.pdf
 
Types of operating system
Types of operating systemTypes of operating system
Types of operating system
 

More from Mydbops

Efficient MySQL Indexing and what's new in MySQL Explain
Efficient MySQL Indexing and what's new in MySQL ExplainEfficient MySQL Indexing and what's new in MySQL Explain
Efficient MySQL Indexing and what's new in MySQL Explain
Mydbops
 

More from Mydbops (20)

Efficient MySQL Indexing and what's new in MySQL Explain
Efficient MySQL Indexing and what's new in MySQL ExplainEfficient MySQL Indexing and what's new in MySQL Explain
Efficient MySQL Indexing and what's new in MySQL Explain
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
PostgreSQL Schema Changes with pg-osc - Mydbops @ PGConf India 2024
PostgreSQL Schema Changes with pg-osc - Mydbops @ PGConf India 2024PostgreSQL Schema Changes with pg-osc - Mydbops @ PGConf India 2024
PostgreSQL Schema Changes with pg-osc - Mydbops @ PGConf India 2024
 
Choosing the Right Database: Exploring MySQL Alternatives for Modern Applicat...
Choosing the Right Database: Exploring MySQL Alternatives for Modern Applicat...Choosing the Right Database: Exploring MySQL Alternatives for Modern Applicat...
Choosing the Right Database: Exploring MySQL Alternatives for Modern Applicat...
 
Mastering Aurora PostgreSQL Clusters for Disaster Recovery
Mastering Aurora PostgreSQL Clusters for Disaster RecoveryMastering Aurora PostgreSQL Clusters for Disaster Recovery
Mastering Aurora PostgreSQL Clusters for Disaster Recovery
 
Navigating Transactions: ACID Complexity in Modern Databases- Mydbops Open So...
Navigating Transactions: ACID Complexity in Modern Databases- Mydbops Open So...Navigating Transactions: ACID Complexity in Modern Databases- Mydbops Open So...
Navigating Transactions: ACID Complexity in Modern Databases- Mydbops Open So...
 
AWS RDS in MySQL 2023 Vinoth Kanna @ Mydbops OpenSource Database Meetup 15
AWS RDS in MySQL 2023 Vinoth Kanna @ Mydbops OpenSource Database Meetup 15AWS RDS in MySQL 2023 Vinoth Kanna @ Mydbops OpenSource Database Meetup 15
AWS RDS in MySQL 2023 Vinoth Kanna @ Mydbops OpenSource Database Meetup 15
 
Data-at-scale-with-TIDB Mydbops Co-Founder Kabilesh PR at LSPE Event
Data-at-scale-with-TIDB Mydbops Co-Founder Kabilesh PR at LSPE EventData-at-scale-with-TIDB Mydbops Co-Founder Kabilesh PR at LSPE Event
Data-at-scale-with-TIDB Mydbops Co-Founder Kabilesh PR at LSPE Event
 
MySQL Transformation Case Study: 80% Cost Savings & Uninterrupted Availabilit...
MySQL Transformation Case Study: 80% Cost Savings & Uninterrupted Availabilit...MySQL Transformation Case Study: 80% Cost Savings & Uninterrupted Availabilit...
MySQL Transformation Case Study: 80% Cost Savings & Uninterrupted Availabilit...
 
Scaling-MongoDB-with-Horizontal-and-Vertical-Sharding Mydbops Opensource Data...
Scaling-MongoDB-with-Horizontal-and-Vertical-Sharding Mydbops Opensource Data...Scaling-MongoDB-with-Horizontal-and-Vertical-Sharding Mydbops Opensource Data...
Scaling-MongoDB-with-Horizontal-and-Vertical-Sharding Mydbops Opensource Data...
 
Mastering MongoDB Atlas: Essentials of Diagnostics and Debugging in the Cloud...
Mastering MongoDB Atlas: Essentials of Diagnostics and Debugging in the Cloud...Mastering MongoDB Atlas: Essentials of Diagnostics and Debugging in the Cloud...
Mastering MongoDB Atlas: Essentials of Diagnostics and Debugging in the Cloud...
 
Data Organisation: Table Partitioning in PostgreSQL
Data Organisation: Table Partitioning in PostgreSQLData Organisation: Table Partitioning in PostgreSQL
Data Organisation: Table Partitioning in PostgreSQL
 
Navigating MongoDB's Queryable Encryption for Ultimate Security - Mydbops
Navigating MongoDB's Queryable Encryption for Ultimate Security - MydbopsNavigating MongoDB's Queryable Encryption for Ultimate Security - Mydbops
Navigating MongoDB's Queryable Encryption for Ultimate Security - Mydbops
 
Data High Availability With TIDB
Data High Availability With TIDBData High Availability With TIDB
Data High Availability With TIDB
 
Mastering Database Migration_ Native replication (8.0) to InnoDB Cluster (8.0...
Mastering Database Migration_ Native replication (8.0) to InnoDB Cluster (8.0...Mastering Database Migration_ Native replication (8.0) to InnoDB Cluster (8.0...
Mastering Database Migration_ Native replication (8.0) to InnoDB Cluster (8.0...
 
Enhancing Security of MySQL Connections using SSL certificates
Enhancing Security of MySQL Connections using SSL certificatesEnhancing Security of MySQL Connections using SSL certificates
Enhancing Security of MySQL Connections using SSL certificates
 
Exploring the Fundamentals of YugabyteDB - Mydbops
Exploring the Fundamentals of YugabyteDB - Mydbops Exploring the Fundamentals of YugabyteDB - Mydbops
Exploring the Fundamentals of YugabyteDB - Mydbops
 
Time series in MongoDB - Mydbops
Time series in MongoDB - Mydbops Time series in MongoDB - Mydbops
Time series in MongoDB - Mydbops
 
TiDB in a Nutshell - Power of Open-Source Distributed SQL Database - Mydbops
TiDB in a Nutshell - Power of Open-Source Distributed SQL Database - MydbopsTiDB in a Nutshell - Power of Open-Source Distributed SQL Database - Mydbops
TiDB in a Nutshell - Power of Open-Source Distributed SQL Database - Mydbops
 
Achieving High Availability in PostgreSQL
Achieving High Availability in PostgreSQLAchieving High Availability in PostgreSQL
Achieving High Availability in PostgreSQL
 

Recently uploaded

Recently uploaded (20)

Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Buy Epson EcoTank L3210 Colour Printer Online.pdf
Buy Epson EcoTank L3210 Colour Printer Online.pdfBuy Epson EcoTank L3210 Colour Printer Online.pdf
Buy Epson EcoTank L3210 Colour Printer Online.pdf
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Agentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdfAgentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdf
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 

Linux monitoring and Troubleshooting for DBA's

  • 1. Linux Monitoring and Troubleshooting By MySQL Consulting Team
  • 2. About MyDBOPS • MySQL Consulting • MySQL Support • Remote DBA support. • Expert MySQL solutions • MariaDB, Percona, Galera, TokuDB are supported too.
  • 3. Agenda • Introduction • Linux Architecture • Devices we monitor • Important tools • Examples
  • 4. INTRODUCTION  Unix-like computer operating system.  The monitoring and maintenance of the system is the most important task.  There are many commands line utilities created for this purpose. CPU l Network Bandwidth Memory usage Disk usage Syslogs & A Running processes etc.
  • 8. Top  Small tool, pre-installed in many unix systems.  Display all running and active real time process in ordered list & updates it regularly.  CPU usage, Memory usage, Swap Memory, Cache Size, Buffer Size, Process PID, User, Commands and much more  shows high memory and cpu utilization of a running processes.
  • 9. sysstat  powerful logging and monitoring tool for Linux/Unix systems.  contains utilities to monitor system performance and usage activity.  used to monitor system performance and troubleshoot problems.  sysstat is a go-to for power users and can log and track pretty much everything going on within your Linux box. To install : • redhat based - yum install sysstat • Debian based - apt-get install sysstat
  • 10. sar  Sar(System Activity Report) is part of the sysstat package.  collects and displays ALL system activities statistics.  can monitor performance of various Linux subsystems (CPU, Memory, I/O..) in real time.  also collect all performance data on an on-going basis, store them, and do historical analysis to identify bottlenecks.  collected information can be used with ksar to plot graphs.
  • 11. Sar examples CPU Usage of ALL CPUs (sar -u)  This gives the cumulative real-time CPU usage of all CPUs.  sar -u 1 3 Displays real time CPU usage every 1 second for 3 times.  “-P ALL” indicates that it should displays statistics for ALL the individual Cores. %user - % of cpu utilz. that occurred while executing at user level %nice – at user level with nice priority. %system – at sytem level %iowait - % of time that cpu were idle during which s/m had an outstanding disk I/O request %idle – idle & s/m did not have an oustanding disk i/o %steal - % of time spent in involuntary wait by cpu/cpu’s
  • 12. Sar examples • Memory Free and Used (sar -r)  This reports the memory statistics.  “1 3 reports for every 1 seconds a total of 3 times.″  focus on “kbmemfree” and “kbmemused” for free and used memory.
  • 13. Sar examples • Overall I/O Activities (sar -b)  This reports I/O statistics.  “1 3 reports for every 1 seconds a total of 3 times.″  tps – Transactions per second (this includes both read and write)  rtps – Read transactions per second  wtps – Write transactions per second  bread/s – Bytes read per second  bwrtn/s – Bytes written per second
  • 14. Sar examples • Individual Block Device I/O Activities (sar -d)  To identify the activities by the individual block devices (i.e a specific mount point, or LUN, or partition)  The device name (DEV column) can display the actual device name, use “sar -d” tps –no of transfer per second rd_sec/s – no sector read from device wr_sec/s – no of sectors write from device avgrq-sz – avg size in sectors of the req that were issued to device. avgqu-sz – avg queue length of request await – avg time for i/o req. svctm – avg service time for i/o req %util – % of cputime during which i/o req where issued
  • 15. Sar examples • Reports run queue and load average (sar -q)  This reports the run queue size and load average of last 1 minute, 5 minutes, and 15 minutes.  “1 3 reports for every 1 seconds a total of 3 times.″ runq-sz – run queue length (no of task wtng for run time) plist-sz – no of tasks in the task list
  • 16. Sar examples • To view previous records(sar –f)  To view old day records  Followed by path of old files  Maintains one month records sar -f /var/log/sa/sa15 sar -f /var/log/sa/sa15 -q 1 3 LC_ALL=C sar -f /var/log/sa/sa14 -A
  • 17. iostat  simple tool that will collect and show system input and output storage device statistics.  often used to trace storage device performance issues including devices, local disks, remote disks such as NFS. %user - % of cpu utilz. that occurred while executing at user level %nice – at user level with nice priority. %system – at sytem level %iowait - % of time that cpu were idle during which s/m had an outstanding disk I/O request %idle – idle & s/m did not have an oustanding disk i/o %steal - % of time spent in involuntary wait by cpu/cpu’s blk_read/s – amt of data read from device blk_wrtn/s – amt of data write to device Blk_read - total no of block reads Blk_wrtn - total no of block writes
  • 18. vmstat  Summary information of Memory, Processes, Paging etc.  used to display statistics of virtual memory, kernerl threads, disks, system processes, I/O blocks, interrupts, CPU activity and much more. r: The no of processes waiting for run time. b - The no of processes in uninterruptable sle bi: Blocks sent to a block device (blocks/s). bo-: Blocks received from a block device (blocks/s). si – Amount of memory swapped in from disk (kB/s). so – Amount of memory swapped to disk (kB/s). in: The no of interrupts/s including the clock. cs : The number of context switches per second. us: user time sy: system time id: idle time
  • 19. pidstat  pidstat is a part of sysstat utility.  To monitor an individual process which is managed by kernel and generate report.  Can also be used for monitoring the child processes of selected tasks.  reports various statistics including CPU used by a process, disk usage statistics of a process, statistics for threads associated with selected tasks and child processes. Display statistics for all running process - pidstat -p ALL Display statistics for a particular process - pidstat -p pid (process id of application) Display statistics based on process name - pidstat -C “mysql” Display Statistics of Dependent Process in Tree Format using –t - pidstat -t -C "mysql"
  • 20. mpstat  mpstat is a part of sysstat utility.  To monitor CPU utilization in our system.  Will be more useful if our system has multiple processor. Print CPU utilization per processors - mpstat -P 0 , mpstat -P 1 Print all CPU Utilization - mpstat -P ALL Print CPU utilization using intervals - mpstat 3 4 Print mpstat version - mpstat -V
  • 21. netstat  monitoring incoming and outgoing network packets statistics as well as interface statistics.  very useful tool for every system administrator to monitor network performance and troubleshoot network related problems..
  • 22. free  built-in command that displays the total amount of free and used physical memory on your machine.  also displays the buffers used by the kernel at that given moment.
  • 23. df  df is an abbreviation for disk free.  pre-installed program in all unix systems used to display the amount of available disk space for filesystem which the user have access to.
  • 24. du  Linux “du” (Disk Usage) is a standard Unix/Linux command.  used to check the information of disk usage of files and directories on a machine.  has many parameter options that can be used to get the results in many formats.  also displays the files and directory sizes in a recursively manner.
  • 25. ps  basic commands for viewing the processes running on the system  It provides a snapshot of the current processes along with detailed information like user id, cpu usage, memory usage, command name etc.  It does not display data in real time like top or htop commands.
  • 26. lsof  lsof meaning 'List Open Files' is used to find out which files are open by which process.  when a disk cannot be un-mounted as it says the files are being used.
  • 27. lsof some examples  List User Specific Opened Files lsof -u mydbops  Exclude User with ‘^’ Character lsof -i -u^root  Kill all Activity of Particular User kill -9 `lsof -t -u mydbops`  List all Network Connections lsof -i  Search by PID lsof -p 1
  • 28. ping  used to find out whether the peer host/gateway is reachable.  how much time it takes for that data to be exchanged.  default ping waits for 1 second before sending the next packet. increase or decrease using option -i. ping 122.166.212.214 ping -i 5 122.166.212.214 ping -c 3 122.166.212.214
  • 29. telnet  used for interactive communication with another host using the TELNET protocol.  command mode. Syntax : telnet host port
  • 30. w & uptime  w - displays information about the users currently on the machine, and their processes  uptime - Tell how long the system has been running.
  • 31. who & whoami  who - prints information about all users who are currently logged in.  Displays the username, line, and time of all currently logged-in sessions.  whoami - This command prints the username associated with the current effective user ID.
  • 32. history  The history command can be used to list Bash's log of the commands you have typed:  The history command performs one of several operations related to recently-executed commands recorded in a history. Syntax: history Eg: history | less  Search the history using Control+R
  • 33. How MyDBOPS Can Help You • MySQL Consulting • MySQL Support • Remote DBA • 24 * 7 Support Contact : mysqlsupport@mydbops.com