Friday, February 8, 2019

A simple daily health check for linux

#!/bin/bash                                                                                                                                                             
# Author: Abu Rayyan Jeffry                                                                                                                                             
# Date : 8/2/2019                                                                                                                                                       
# Version: 1                                                                                                                                                            
                                                                                                                                                                        
#check cpu                                                                                                                                                              
iostat | head -5                                                                                                                                                        
                                                                                                                                                                        
#check memory                                                                                                                                                           
free -g | egrep -iw "total|Mem|Swap"                                                                                                                                    
                                                                                                                                                                        
#check disk                                                                                                                                                             
echo                                                                                                                                                                    
df -h / /var                                                                                                                                                            

Sample output
عينة الإخراج

[root@xxxxxx bin]# ./health-check.sh                                                                                                                                
Linux 2.6.32-696.1.1.el6.x86_64 (xxxxxx)    02/08/2019      _x86_64_        (32 CPU)                                                                                
                                                                                                                                                                        
avg-cpu:  %user   %nice %system %iowait  %steal   %idle                                                                                                                 
           0.16    0.00    0.20    0.01    0.00   99.63                                                                                                                 
                                                                                                                                                                        
             total       used       free     shared    buffers     cached                                                                                               
Mem:           268         52        215          0          0         47                                                                                               
Swap:           15          0         15                                                                                                                                
                                                                                                                                                                        
Filesystem            Size  Used Avail Use% Mounted on                                                                                                                  
/dev/mapper/vg_macbjm03-lv_root                                                                                                                                         
                       50G   15G   32G  32% /                                                                                                                           
/dev/mapper/vg_macbjm03-lv_var                                                                                                                                          
                      336G   48G  272G  15% /var


للنطام لينكس فحص صحي بسيط 

No comments:

Post a Comment