Load & Memory monitoring using SAR

Is there any way to get my server’s load and memory usage history from commandline?

Yes, it’s possible by using the commandline utility SAR. System Activity Reporter is abbreviated as SAR. It is an important tool to monitor server’s different important metrics at different points of time. Using SAR it will be possible to monitor the performance of various Linux subsystems (CPU, Memory, I/O..) in real time. If you had a problem with your server performance, you can check the resource usage history by using SAR utility. There are a lot of options are available with SAR. Here I’m explaining the usage of load average andmemory usage analysing steps.

 

sysstat - daemon 
SAR for load monitoring purpose

sar -q

The above command will report load averages at different times. (It fetch data from /var/log/sa(sysstat)/sa*, where sa* represent the date like sa10,sa11,sa12etc).

Examples

>> sar -q  

It simply list current day’s load averages starting from 12:00:00, with 10 minute interval.

sar

>> sar -q 1 5

It list load averages 5 times from when we enter this with an interval of 1 sec.

sar

>> sar -q -f /var/log/sa/sa23

Previous dates details are stored in the directory “/var/log/sa/”. The switch “f” along with the command SAR can fetch previous days details.

sar

SAR for memory monitoring purpose

sar -r 

Report memory details.

Examples

>> sar -r 

It simply list current day’s memory usage averages starting from 12:00:00, with 10 minute interval.

sar

>> sar -r 1 5

It list memory usage averages 5 times from when we enter this with an interval of 1 sec.

sar

>> sar -r -f /var/log/sa/sa23

Fetch data from /var/log/sa/sa23.

sar

That’s it!!

转载于:https://my.oschina.net/stevewang1/blog/850293

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值