Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1601438
  • 博文数量: 184
  • 博客积分: 3044
  • 博客等级: 中校
  • 技术积分: 2467
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-25 15:04
文章分类

全部博文(184)

文章存档

2022年(4)

2021年(3)

2020年(1)

2019年(5)

2018年(13)

2017年(6)

2016年(10)

2015年(11)

2014年(11)

2013年(13)

2012年(23)

2011年(25)

2010年(2)

2008年(1)

2007年(5)

2006年(51)

分类: 系统运维

2016-06-17 18:49:05


config.inc.php里面的项
$cfg["check_results_dir"]="/var/log/nagios/spool/checkresults"
这个目录一定要是apache与nagios用户都有可读写权限
php send_nrdp.php  --url= --token=98jstd044855 --host=11111 --service=iostat  --state=1 --output="The service looks okay"
Nagios(1主+Cluster)
#vim /usr/local/nagios/etc/nagios.cfg 
check_external_commands=1 # 配置nagios检查扩展命令 
accept_passive_service_checks=1 # 配置接受被动服务检测的结果 
accept_passive_host_checks=1 #配置接受被动主机检测的结果 
配置:nrdp
从Git上下载nrdp文件
解压到/usr/local/nrdp目录下
cd /usr/local/nrdp/
ls
CHANGES.TXT  clients  install-html  INSTALL.TXT  LICENSE.TXT  nrdp.conf  server


cp nrpd.conf  /etc/httpd/conf.d/


修改 server/config.inc.php的内容:
1:$cfg["nagios_command_group"]="nagios"
2:$cfg["command_file"]="/var/spool/nagios/cmd/nagios.cmd"
3:$cfg["check_results_dir"]="/var/log/nagios/spool/checkresults"


#把apache用户加到nagios组里
usermod -G nagios apache
/var/log/nagios/spool/checkresults 权限修改
chmod -R 775 checkresults




cluster




#vim nagios.cfg 
enable_notifications=0 //阻止它直接送出任何通知信息 
obsess_over_services=1 // 配置为强迫型服务(obsess over services)类型 
ocsp_command=submit_check_result //定义一个强迫型服务处理(ocsp)命令 
obsess_over_hosts=1 
ochp_command=submit_hostcheck_result
#vim command.cfg 
define command{ 
                 command_name submit_check_result //添加这条命令
# --state=$SERVICESTATEID$这个注意:不能写成SERVICESTATE,不然state得不到!
command_line /usr/bin/php  $USER1$/send_nrdp.php --url= --token=98jstd044855  --host=$HOSTNAME$ --service='$SERVICEDESC$' --state=$SERVICESTATEID$ --output='$SERVICEOUTPUT$|$SERVICEPERFDATA$'





define command {
        command_name   submit_hostcheck_result
        command_line /usr/bin/php  $USER1$/send_nrdp.php --url= --token=98jstd044855  --host=$HOSTNAME$  --state=$HOSTSTATEID$ --output='$HOSTOUTPUT$|$HOSTPERFDATA$'
}




define service {
        host_name                       KSC160523105950_3
        service_description             Current_Load
        use                             local-service
active_checks_enabled        0
passive_checks_enabled      1
        check_command                   check_shi_load!15,15,15!30,25,20
check_freshness        1
notification_interval       300
        freshness_threshold           86400
        register                        1
        notifications_enabled           1
contact_groups                  nagiosadmin
}




submit_hostcheck_result

阅读(3932) | 评论(0) | 转发(0) |
0

上一篇:nagvis问题处理

下一篇:tcpcopy 使用

给主人留下些什么吧!~~