check_linux_stats

check_linux_stats

With this script you can monitor your system-basic. Such as Cpu Usage, Mem Usage, Interfaces and more. Just simple and easy to handle.

Options:

Flag Description
--help print this help message
-C, --cpu check cpu usage
-P, --proc check the processes number
-M, --memory check memory usage (memory used, swap used and memory cached)
-N, --network=NETWORK USAGE check network usage in resq or bytes (default bytes)
-D, --disk=DISK USAGE check disk usage
-I, --io=DISK IO USAGE check disk I/O (r/w on /dev/sd*)
-L, --load=LOAD AVERAGE check load average
-F, --file=FILE STATS check open files (file alloc, inode alloc)
-S, --socket=SOCKET STATS socket usage (tcp, udp, raw)
-p, --pattern eth0,eth1...sda1,sda2.../usr,/tmp
-w, --warning warning thresold
-c, --critical critical thresold
-s, --sleep default 1 sec.
-u, --unit %, KB, MB or GB left on disk usage, default : MB REQS OR BYTES on disk io statistics, default : REQS
-V, --version version number

Example:

  • Cpu usage :

    ./check_linux_stats.pl -C -w 90 -c 100 -s 5
    
    CPU OK : idle 99.80% | user=0.00% system=0.20% iowait=0.00% idle=99.80%;90;100
    
  • Load average :

    ./check_linux_stats.pl -L -w 10,8,5 -c 20,18,15
    
    LOAD AVERAGE OK : 0.20,0.07,0.16 | load1=0.20;10;20;0 load5=0.07;8;18;0 load15=0.16;5;15;0
  • Memory usage :

    ./check_linux_stats.pl -M -w 99,50 -c 100,50
    
    MEMORY OK : used 94.52% |MemUsed=94.52%;99;100 SwapUsed=0.01;50;50 MemCached=39.66
  • Disk usage :

    ./check_linux_stats.pl -D -w 10 -c 5 -p /,/usr,/tmp,/var
    
    DISK WARNING used : / 3331.80MB on 3875.09MB (8.86% free) /usr 10084.27MB on 14528.41MB (25.43% free)| /=3331.80MB /usr=10084.27MB
    
  • Disk I/O :

    ./check_linux_stats.pl -I -w 100,70 -c 150,100 -p sda1,sda2,sda4
    
    DISK I/O OK | sda2_read=0.00;100;150 sda2_write=0.00;70;100 sda4_read=0.00;100;150 sda4_write=0.00;70;100 sda1_read=0.00;100;150 sda1_write=0.00;70;100
    
  • Network usage :

    ./check_linux_stats.pl -N -w 30000 -c 45000 -p eth0
    
    NET USAGE OK eth0:8021.78KB | eth0_txbyt=3461.39KB eth0_txerrs=0.00KB eth0_rxbyt=4560.40KB eth0_rxerrs=0.00KB
    
  • Open files :

    ./check_linux_stats.pl -F -w 10000,150000 -c 15000,250000
    
    OPEN FILES OK allocated: 1728 (inodes: 70390) | fhalloc=1728;10000;15000;411810 inalloc=70390;150000;250000;100250 dentries=50754
    
  • Socket usage :

    ./check_linux_stats.pl -S -w 1000 -c 2000
    
    SOCKET USAGE OK : used 257 |used=257;1000;2000 tcp=18 udp=5 raw=0
    
  • Number of procs :

    ./check_linux_stats.pl -P -w 1000 -c 2000
    
    PROCS OK : count 272 |count=272;1000;2000 runqueue=2 blocked=0 running=2 new=0.98
    
  • Process mem & cpu :

    ./check_linux_stats.pl -T -w 2000000000 -c 3000000000 -p /var/run/jonas.pid
    
    PROCESSES OK | java_vsize=1804918784;2000000000;3000000000 java_nswap=0 java_cnswap=0 java_cpu=0
    

Important:

This script require Sys::Statistics::Linux