来自:网络
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[0] =~ '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 [ /u/230619]@result[/url] = split(/:/,$_);
chomp($result_state = $result[0]);
chomp($result_content = $result[1]);
}
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
|