Nagios 配置工具 Nconf

安装参考:http://www.nconf.org/dokuwiki/doku.php?id=nconf:help:documentation:start:installation

# 下载解压
wget https://sourceforge.net/projects/nconf/files/nconf/1.3.0-0/nconf-1.3.0-0.tgz --no-check-certificate
tar -zxvf nconf-1.3.0-0.tgz -C /var/www/html/

# 创建数据库及账号
create database nconf;
grant all privileges on nconf.* to nconf@'%' identified by'nconf'; 
flush privileges;

# 导入表结构和元素据
mysql -unconf -pnconf -P3366 -h10.10.10.8 nconf < INSTALL/create_database.sql  

# 授权访问
chown -R apache.apache config/ temp/ static_cfg/ output/

# 打开站点:http://10.10.10.8/nconf/

打开站点:http://10.10.10.8/nconf/ ,进行配置

# WEB 设置的相关配置,保存在此目录中的配置文件中
/var/www/html/nconf/config

# 最后,可删除文件
rm -rf INSTALL INSTALL.php UPDATE UPDATE.php 

编辑文件 ../nconf/config/deployment.ini ,添加以下脚本,用于将 nconf 的变更部署到 nagios 中。

# vim /var/www/html/nconf/config/deployment.ini

[extract config]
type        = local
source_file = "/var/www/html/nconf/output/NagiosConfig.tgz"
target_file = "/var/www/html/nconf/temp/"
action      = extract
reload_command = "sudo /bin/systemctl daemon-reload"

[copy collector config]
type        = local
source_file = "/var/www/html/nconf/temp/Default_collector/"
target_file = "/usr/local/nagios/etc/Default_collector/"
action      = copy

[copy global config]
type        = local
source_file = "/var/www/html/nconf/temp/global/"
target_file = "/usr/local/nagios/etc/global/"
action      = copy
reload_command = "sudo /bin/systemctl daemon-reload"

因为 apache 无权限执行 “sudo /bin/systemctl” ,需要设置权限:

sed -i 's@^Defaults.*requiretty@#Defaults    requiretty@' /etc/sudoers
sed -i 's@\(^root.*\)@\1\napache  ALL=(ALL)       NOPASSWD:/usr/bin/sudo,/bin/systemctl@' /etc/sudoers

完成后刷新 nconf ,可以看到以下页面出现了按钮 “Deploy”,点击后配置部署到 nagios。

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值