mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-03-15 15:14:10 -04:00
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1700 f882894a-f735-0410-b71e-b25c423dba1c
30 lines
874 B
Perl
30 lines
874 B
Perl
#! /usr/bin/perl -w -I ..
|
|
#
|
|
# Load Average Tests via check_load
|
|
#
|
|
# $Id$
|
|
#
|
|
|
|
use strict;
|
|
use Test::More;
|
|
use NPTest;
|
|
|
|
my $res;
|
|
|
|
my $successOutput = '/^OK - load average: [0-9]+\.?[0-9]+, [0-9]+\.?[0-9]+, [0-9]+\.?[0-9]+/';
|
|
my $failureOutput = '/^CRITICAL - load average: [0-9]+\.?[0-9]+, [0-9]+\.?[0-9]+, [0-9]+\.?[0-9]+/';
|
|
|
|
plan tests => 6;
|
|
|
|
$res = NPTest->testCmd( "./check_load -w 100,100,100 -c 100,100,100" );
|
|
cmp_ok( $res->return_code, 'eq', 0, "load not over 100");
|
|
like( $res->output, $successOutput, "Output OK");
|
|
|
|
$res = NPTest->testCmd( "./check_load -w 0,0,0 -c 0,0,0" );
|
|
cmp_ok( $res->return_code, 'eq', 2, "Load over 0");
|
|
like( $res->output, $failureOutput, "Output OK");
|
|
|
|
$res = NPTest->testCmd( "./check_load -r -w 0,0,0 -c 0,0,0" );
|
|
cmp_ok( $res->return_code, 'eq', 2, "Load over 0 with per cpu division");
|
|
like( $res->output, $failureOutput, "Output OK");
|
|
|