Table of Contents

, ,

Скрипт проверки уровня LA

#!/usr/bin/perl

use strict;

my $email = '[email protected]';

open my $PROC, "/proc/loadavg" or die $!;

while (<$PROC>) {
    /(^\d{0,3}).\d{0,}\s(.*)/;
    my $la = $1;
    if($la gt 10) {
        system("top -b -n 2 | /usr/sbin/sendmail -sVPS_LA $email");
    }
}

close $PROC or die $!;