利用Nagios检测批量执行脚本能成功吗
来自:网络lionel_do_result.pl
说明:批量执行脚本的输出到/tmp/check_do_result临时文件中 nagios培训 #!/usr/bin/perl
# author:shenxiaoran
use strict;
use lib "/opt/nrpe/libexec";
use utils qw(%ERRORS &print_revision &support &usage ); nagios实施
my $result_state;
my $result_content;
my $status = 'OK';
if ( $ARGV =~ 'help' ) {
print "Function: Nagios testing program installation was successful or failure \n"; 监控软件 print "Usage: $0 \n";
print "Example: lionel_do_result.pl \n";
}
else {
succ_or_fail();
}
sub succ_or_fail() {
open (FILE,"</tmp/check_do_result") || die ("Can't open /tmp/check_do_result $!"); nagios配置 while (<FILE>) {
my @result = split(/:/,$_);
chomp($result_state = $result);
chomp($result_content = $result);
}
close FILE;
if ( $result_state =~ "CRITICAL" ) {
$status = "CRITICAL";
print "Do Reault $status: $result_content "; 开源监控软件
exit "$ERRORS{$status}"
}
else {
print "Do Reault $status: $result_content "; nagios安装
exit "$ERRORS{$status}";
想做Nagios, Zabbix,Cacti,iTop各种交流的,可以进入开源监控工具Nagios交流QQ群号 :476809427
页:
[1]