NagiosQL安装
##YUM安装PHP模块
yum -y install --disablerepo=* --enablerepo=remi php-pecl-ssh2
##下载解压NagiosQL
cd /usr/local/src
wget -nc http://softlayer-dal.dl.sourceforge.net/project/nagiosql/nagiosql/NagiosQL%203.2.0/nagiosql_320.tar.gz
tar -zxvf nagiosql_[0-9]*.tar.gz
mv -f nagiosql32 nagiosql
cp -nr nagiosql /var/www/html/nagiosql
chown -R apache:www /var/www/html/nagiosql
chmod -R g+w /var/www/html/nagiosql
##修正PHP程序错误
#You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`value' at line 4
#http://www.nagiosql.org/forum8/general-questions/3251-add-host-you-have-an-error-in-your-sql-syntax.html
sed -i 's/AND `access_group` IN ($strAccess) ORDER BY `value";/AND `access_group` IN ($strAccess) ORDER BY `value`";/' \
/var/www/html/nagiosql/functions/nag_class.php
##创建NagiosQL导出Nagios/Icinga配置文件目录
mkdir -p /etc/nagiosql/{hosts,services,backup,import}
mkdir -p /etc/nagiosql/backup/{hosts,services}
chown -R apache:www /etc/nagiosql/
chmod -R g+w /etc/nagiosql/
##修改Icinga配置文件权限
chown -R icinga:www /usr/local/icinga/etc/
chmod -R g+w /usr/local/icinga/etc/
chown -R icinga:www /usr/local/icinga/var/rw/
chmod -R g+w /usr/local/icinga/var/rw/
chown -R icinga:www /usr/local/icinga/var/spool/checkresults
chmod -R g+w /usr/local/icinga/var/spool/checkresults
##生成Apache配置文件
cat <<EOF > /etc/httpd/conf.d/nagiosql.conf
Alias /nagiosql "/var/www/html/nagiosql"
<Directory "/var/www/html/nagiosql">
AllowOverride None
Order allow,deny
Allow from all
#
# Use the same value as defined in nagios.conf
#
AuthName "Icinga Access"
AuthType Basic
AuthUserFile /usr/local/icinga/etc/htpasswd.users
Require valid-user
</Directory>
EOF
##重载Apache
service httpd reload
##网站安装NagiosQL
#访问http://服务器IP/nagiosql
##备份现有Icinga配置文件,准备导入
\cp -R `grep "^cfg_dir" /usr/local/icinga/etc/icinga.cfg | grep -v "modules" | awk -F= '{print $2}' | xargs` /etc/nagiosql/import
\cp `grep "^cfg_file" /usr/local/icinga/etc/icinga.cfg | awk -F= '{print $2}' | xargs` /etc/nagiosql/import
#在http://服务器IP/nagiosql/admin/import.php,导入/etc/nagiosql/import中所有的cfg文件
#在http://服务器IP/nagiosql/admin/verify.php中写入检测数据和其他数据
##修改配置文件icinga.cfg
#注释现有的cfg_file和非模块cfg_dir,使用4个井号#
sed -i -e 's/^\(cfg_file=.*\)$/####\1/' \
-e 's/^cfg_dir=\(.*modules\)$/@@@\1/;s/^\(cfg_dir=.*\)$/####\1/;s/^@@@\(.*\)$/cfg_dir=\1/' \
/usr/local/icinga/etc/icinga.cfg
#增加NagiosQL配置文件
grep -q "NagiosQL Configuration Files" /usr/local/icinga/etc/icinga.cfg || \
cat <<EOF >> /usr/local/icinga/etc/icinga.cfg
# NagiosQL Configuration Files
cfg_dir=/etc/nagiosql/hosts/
cfg_dir=/etc/nagiosql/services/
cfg_file=/etc/nagiosql/commands.cfg
cfg_file=/etc/nagiosql/contactgroups.cfg
cfg_file=/etc/nagiosql/contacts.cfg
cfg_file=/etc/nagiosql/contacttemplates.cfg
cfg_file=/etc/nagiosql/hostdependencies.cfg
cfg_file=/etc/nagiosql/hostescalations.cfg
cfg_file=/etc/nagiosql/hostextinfo.cfg
cfg_file=/etc/nagiosql/hostgroups.cfg
cfg_file=/etc/nagiosql/hosttemplates.cfg
cfg_file=/etc/nagiosql/servicedependencies.cfg
cfg_file=/etc/nagiosql/serviceescalations.cfg
cfg_file=/etc/nagiosql/serviceextinfo.cfg
cfg_file=/etc/nagiosql/servicegroups.cfg
cfg_file=/etc/nagiosql/servicetemplates.cfg
cfg_file=/etc/nagiosql/timeperiods.cfg
EOF
##检查配置文件icinga.cfg
icinga -v /usr/local/icinga/etc/icinga.cfg
##重载Icinga
service icinga reload
NagiosQL安装的更多相关文章
- 1. Nagios和 NagiosQL安装及配置
目录 1. Nagios 和 NagiosQL简介 2. Nagios+NagiosQL搭建环境说明 3. Nagios.Nagios-plugins和NagiosQL的安装 4. 配置NagiosQ ...
- nagios插件nagiosql安装配置
nagios插件nagiosql安装配置 # Nagiosql install [root@Cagios ~]# yum install -y libssh2 libssh-devel [root@C ...
- Centos 6.x 安装Nagios及WEB管理nagiosql实现windows及linux监控指南
一.Nagios简介 Nagios是一款开源的电脑系统和网络监视工具,能有效监控Windows.Linux和Unix的主机状态,交换机路由器等网络设置,打印机等.在系统或服务状态异常时发出邮件或短信报 ...
- nagios二次开发(五)---nagios和nagiosql的关系
根据对nagios和nagiosql的了解,笔者简要的将二者的关系粗略的梳理了一下,具体情况如下图所示: 从上面的关系图中可以看出,nagios与nagiosql共享了主机.主机组.服务.服务组等.c ...
- nagios二次开发(五岁以下儿童)---nagios和nagiosql关系
基于nagios和nagiosql理解.这将是这两个梳理比较粗糙的简单关系,有关详细信息,请参阅下面的图如: 从上面的关系图中能够看出,nagios与nagiosql共享了主机.主机组.服务 ...
- web配置nagios工具
Nagios是一款开源的免费网络监视工具,能有效监控Windows.Linux和Unix的主机状态,交换机路由器等网络设置,打印机等.在系统或服务状态异常时发出邮件或短信报警第一时间通知网站运维人员, ...
- nagiosQL访问时报错PHP message: PHP Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
nagiosQL安装环境: CentOS release 6.4 (Final) php-5.5.4 nagiosql_320 nginx version: nginx/1.2.3 安装一切正常,当访 ...
- Nginx+nagios安装配置
Nginx+nagios安装配置 [root@Nagios ~]# vi /etc/nginx/nginx.conf server { listen ; server_name localhost; ...
- docker——容器安装tomcat
写在前面: 继续docker的学习,学习了docker的基本常用命令之后,我在docker上安装jdk,tomcat两个基本的java web工具,这里对操作流程记录一下. 软件准备: 1.jdk-7 ...
随机推荐
- PAT_A1138#Postorder Traversal
Source: PAT A1138 Postorder Traversal (25 分) Description: Suppose that all the keys in a binary tree ...
- java获取当前日期的前一天,前一月和前一年
核心:使用Calendar的add(int field, int amount)方法 Calendar ca = Calendar.getInstance();//得到一个Calendar的实例 ca ...
- Bamboo Django Celery定时任务和时间设置
1.Celery加入定时任务 Celery除了可以异步执行任务之外,还可以定时执行任务.在实例代码的基础上写个测试方法: 1 #coding:utf-8 2 from celery.task.sche ...
- 5、SpringBoot+MyBaits+Maven+Idea+pagehelper分页插件
1.为了我们平时方便开发,我们可以在同一个idea窗口创建多个项目模块,创建方式如下 2.项目中pom.xm文件的内容如下 <?xml version="1.0" encod ...
- Mysql学习总结(12)——21分钟Mysql入门教程
21分钟 MySQL 入门教程 目录 一.MySQL的相关概念介绍 二.Windows下MySQL的配置 配置步骤 MySQL服务的启动.停止与卸载 三.MySQL脚本的基本组成 四.MySQL中的数 ...
- APIO2017听课笔记关键词
- hdu 2897简单博弈
#include<stdio.h> int main() { int n,p,q,k; while(scanf("%d%d%d",&n,& ...
- 百度之星2014资格赛 1004 - Labyrinth
先上题目: Labyrinth Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)T ...
- GetBulkRequest PDU的应用
http://blog.csdn.net/wenph2008/article/details/16821617
- 框架统一出参数DTO格式
这个可以没必要定义. 每个接口返回自己的数据格式就好