File: check_users.t

package info (click to toggle)
monitoring-plugins 2.3.3-5%2Bdeb12u2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,996 kB
  • sloc: ansic: 63,549; sh: 14,212; perl: 7,390; makefile: 487
file content (30 lines) | stat: -rw-r--r-- 873 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#! /usr/bin/perl -w -I ..
#
# Logged in Users Tests via check_users
#
# Trick: This ckeck requires at least 1 user logged in. These commands should
#        leave a session open forever in the background:
#
#   $ ssh -tt localhost </dev/null >/dev/null 2>/dev/null &
#   $ disown %1

use strict;
use Test;
use NPTest;

use vars qw($tests);
BEGIN {$tests = 8; plan tests => $tests}

my $successOutput = '/^USERS OK - [0-9]+ users currently logged in/';
my $failureOutput = '/^USERS CRITICAL - [0-9]+ users currently logged in/';

my $t;

$t += checkCmd( "./check_users 1000 1000", 0, $successOutput );
$t += checkCmd( "./check_users    0    0", 2, $failureOutput );
$t += checkCmd( "./check_users -w 0:1000 -c 0:1000", 0, $successOutput );
$t += checkCmd( "./check_users -w 0:0 -c 0:0", 2, $failureOutput );

exit(0) if defined($Test::Harness::VERSION);
exit($tests - $t);