安装参考: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。
标签:www,Nagios,html,Nconf,file,var,工具,config,nconf From: https://blog.51cto.com/hzc2012/6024070