用python编写nagios hadoop监控脚本
功能
我centos5.5 64bit机器的目录是“/usr/lib64/nagios/plugins”
二、添加命令vi?/etc/nagios/objects/commands.cfg
?
?
define command {command_name check_dfs
command_line python $USER1$/check_hadoop_dfs.py -w $ARG1$ -c $ARG2$
}
define command {
command_name check_datanode
command_line python $USER1$/check_hadoop_datanode.py -w $ARG1$ -c $ARG2$
}
define command {
command_name check_tasktracker
command_line python $USER1$/check_hadoop_tasktracker.py -w $ARG1$ -c $ARG2$
}
?
三、为主机配置命令:vi?/etc/nagios/objects/localhost.cfg?
?
?
define service{use local-service ; Name of service template to use
host_name CNC-BJ-5-3N1
service_description Hadoop DFS Space
check_command check_dfs!30!20
}
define service{
use local-service ; Name of service template to use
host_name CNC-BJ-5-3N1
service_description Hadoop Datanode
check_command check_datanode!18!15
}
define service{
use local-service ; Name of service template to use
host_name CNC-BJ-5-3N1
service_description Hadoop Tasktracker
check_command check_tasktracker!18!15
}
?
-- end --
?
?
?