0
点赞
收藏
分享

微信扫一扫

Nagios 配置工具 Nconf

松鼠树屋 2023-01-27 阅读 99


安装参考:​​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/ ,进行配置

Nagios 配置工具 Nconf_apache

Nagios 配置工具 Nconf_apache_02

Nagios 配置工具 Nconf_ios_03

Nagios 配置工具 Nconf_ios_04

Nagios 配置工具 Nconf_apache_05

Nagios 配置工具 Nconf_apache_06

Nagios 配置工具 Nconf_ios_07

Nagios 配置工具 Nconf_html_08

Nagios 配置工具 Nconf_apache_09

# 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。

Nagios 配置工具 Nconf_apache_10

Nagios 配置工具 Nconf_html_11

 

举报

相关推荐

0 条评论