cat /usr/lib/nagios/plugins/check_benchmark.pl
#!/usr/bin/perl
# check_benchmark.pl [OK|WARNING|CRITICAL|UNKNOWN] timeinsecond description

$STATUS = $ARGV[0];
$TIMES = $ARGV[1];
$DESC = $ARGV[2];
my %ERRORS = ('OK' => 0, 'WARNING' => 1, 'CRITICAL' => 2, 'UNKNOWN' => 3);

$exit = 0;
if ( $STATUS eq "OK" ) {
    $exit = 0;
} elsif ( $STATUS eq "WARNING" ) {
    $exit = 1;
} elsif ( $STATUS eq "CRITICAL" ) {
    $exit = 2;
} else { $exit = 3; }

print "$STATUS, $DESC\n";
sleep($TIMES);

exit $exit;

Commands.cfg

define command{
        command_name                    check_benchmark_CRITICAL_0s
        command_line                    $USER1$/check_benchmark.pl CRITICAL 0 "Test benchmark CRITICAL"
}

define command{
        command_name                    check_benchmark_CRITICAL_3s
        command_line                    $USER1$/check_benchmark.pl CRITICAL 3 "Test benchmark CRITICAL"
}

define command{
        command_name                    check_benchmark_OK_0s
        command_line                    $USER1$/check_benchmark.pl OK 0 "Test benchmark OK"
}

define command{
        command_name                    check_benchmark_OK_2s
        command_line                    $USER1$/check_benchmark.pl OK 2 "Test benchmark OK"
}

define command{
        command_name                    check_benchmark_OK_5s
        command_line                    $USER1$/check_benchmark.pl OK 5 "Test benchmark OK"
}

define command{
        command_name                    check_benchmark_UNKNOWN_0s
        command_line                    $USER1$/check_benchmark.pl UNKNOWN 0 "Test benchmark UNKNOWN"
}

define command{
        command_name                    check_benchmark_WARNING_0s
        command_line                    $USER1$/check_benchmark.pl WARNING 0 "Test benchmark WARNING"
}

define command{
        command_name                    check_benchmark_WARNING_1s
        command_line                    $USER1$/check_benchmark.pl WARNING 1 "Test benchmark WARNING"
}

Service.cfg

define service{
        host_name                               host_bench
        service_description             service_bench_01
        use                             generic-service
        check_command                   check_benchmark_CRITICAL_0s
        max_check_attempts                      5
        normal_check_interval           1
        retry_check_interval            3
        check_period                    24x7
}

define service{
        host_name                               host_bench
        service_description             service_bench_02
        use                             generic-service
        check_command                   check_benchmark_OK_0s
        max_check_attempts                      3
        normal_check_interval           1
        retry_check_interval            3
}
define service{
        host_name                               host_bench
        service_description             service_bench_03
        use                             generic-service
        check_command                   check_benchmark_OK_2s
        max_check_attempts                      10
        normal_check_interval           2
        retry_check_interval            1
        check_period                    24x7
}
define service{
        host_name                               host_bench
        service_description             service_bench_04
        use                             generic-service
        check_command                   check_benchmark_OK_5s
        max_check_attempts                      3
        normal_check_interval           1
        retry_check_interval            1
        check_period                    24x7
}
define service{
        host_name                               host_bench
        service_description             service_bench_05
        use                             generic-service
        check_command                   check_benchmark_UNKNOWN_0s
        max_check_attempts                      3
        normal_check_interval           1
        retry_check_interval            1
        check_period                    24x7
}
define service{
        host_name                               host_bench
        service_description             service_bench_06
        use                             generic-service
        check_command                   check_benchmark_WARNING_0s
        max_check_attempts                      2
        normal_check_interval           1
        retry_check_interval            1
        check_period                    24x7
}
define service{
        host_name                               host_bench
        service_description             service_bench_07
        use                             generic-service
        check_command                   check_benchmark_WARNING_1s
        max_check_attempts                      10
        normal_check_interval           1
        retry_check_interval            1
}
define service{
        host_name                               host_bench
        service_description             service_bench_08
        use                             generic-service
        check_command                   check_benchmark_OK_2s
        max_check_attempts                      1
        normal_check_interval           1
        retry_check_interval            1
}
define service{
        host_name                               host_bench
        service_description             service_bench_09
        use                             generic-service
        check_command                   check_benchmark_CRITICAL_0s
        max_check_attempts                      5
        normal_check_interval           1
        retry_check_interval            1
}
define service{
        host_name                               host_bench
        service_description             service_bench_10
        use                             generic-service
        check_command                   check_benchmark_WARNING_1s
        max_check_attempts                      1
        normal_check_interval           1
        retry_check_interval            1
        check_period                    24x7
}
supervision/benchmark_monitoring.txt · Dernière modification: 2017/07/07 14:42 (modification externe)
CC Attribution-Noncommercial-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0