用Python编写Nagios Hadoop监控脚本
功能
- 监控dfs使用比例
- 监控datanode 运行情况
- 监控tasktracker 运行情况
一、将附件py文件放到nagios的插件目录
我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$
}
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
}
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
}
具体下载目录在 /2012年资料/1月/9日/用Python编写Nagios Hadoop监控脚本/
-- end --
相关推荐
wenwst 2020-02-13
CoolGe 2014-03-21
soilzhang 2015-01-21
shuyun00 2015-05-22
tpzmz0 2019-10-27
Billow 2011-06-04
Linuxest 2011-05-23
libowenhit 2011-05-22
carrieyang 2011-05-18
HelloC先生 2010-10-02
功夫熊猫 2009-11-01
Will0 2009-07-07
李迟 2009-02-20
loveyy 2019-07-18
nes00 2015-01-21
thone00 2014-01-14
silenter00 2011-06-27
devilbuqi 2014-11-24