nagios监控的安装
本文中,物理机IP 192.168.1.105
虚拟linux主机ip 192.168.1.10
安装apache和php
Apache 和Php 不是安装nagios 所必须的,但是nagios提供了web监控界面,通过web监控界面可以清晰的看到被监控主机、资源的运行状态,
因此,安装一个web服务是很必要的。
需要注意的是,nagios在nagios3.1.x版本以后,配置web监控界面时需要php的支持。
这里我们下载的nagios版本为nagios-3.4.3,因此在编译安装完成apache后,还需要编译php模块,
这里选取的php版本为php5.4.10。 [root@rhel6 ~]# tar xjf httpd-2.2.32.tar.bz2
[root@rhel6 ~]# cd httpd-2.2.32
[root@rhel6 httpd-2.2.32]# ./configure --prefix=/usr/local/apache2
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu Configuring Apache Portable Runtime library ... checking for APR... reconfig
configuring package in srclib/apr now
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
Configuring APR library
Platform: x86_64-unknown-linux-gnu
checking for working mkdir -p... yes
APR Version: 1.5.2
checking for chosen layout... apr
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/root/httpd-2.2.32/srclib/apr':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
configure failed for srclib/apr
#上面安装记录我们发现,是缺少依赖组件,这里我们检查nagios所需要的支持套件的安装情况,没有安装的全部进行yum安装
[root@rhel6 httpd-2.2.32]# rpm -q gcc glibc glibc-common gd gd-devel xinetd openssl-devel
[root@rhel6 httpd-2.2.32]# rpm -q gcc glibc glibc-common gd gd-devel xinetd openssl-devel
package gcc is not installed
glibc-2.12-1.132.el6.x86_64
glibc-common-2.12-1.132.el6.x86_64
package gd is not installed
package gd-devel is not installed
package xinetd is not installed
package openssl-devel is not installed
[root@rhel6 httpd-2.2.32]# yum install -y gcc gd gd-devel xinetd openssl-devel
#编译安装
[root@rhel6 httpd-2.2.32]# ./configure --prefix=/usr/local/apache2
[root@rhel6 httpd-2.2.32]# make && make install
测试配置文件和启动(service httpd start)
[root@rhel6 apache2]# /usr/local/apache2/bin/apachectl -t
[root@rhel6 apache2]# /usr/local/apache2/bin/apachectl
##使用其他主机访问一定要注意关闭防火墙!或者配置好防火墙策略,要不是访问不了的!
[root@rhel6 apache2]# service iptables status [root@rhel6 apache2]# service iptables stop 到此apache安装完成! z设置开机自启动
chkconfig --add httpd
chkconfig httpd --level 345 on
安装Php
# wget http://cn2.php.net/distributions/php-5.5.10.tar.gz
# tar zxvf php-5.5.10.tar.gz
# cd php-5.5.10
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs
有报错如下
[root@rhel6 php-5.5.10]# yum install -y libxml2-devel libxml2
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs
# make && make install
配置apache
找到apache 的配置文件/usr/local/apache2/conf/httpd.conf
找到:
User daemon
Group daemon
修改为
User nagios
Group nagios
然后找到
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
修改为
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
接着增加如下内容:
AddType application/x-httpd-php .php
为了安全起见,一般情况下要让nagios 的web 监控页面必须经过授权才能访问,这需要增加验证配置,即在httpd.conf 文件最后添加如下信息:
#setting for nagios
ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
<Directory "/usr/local/nagios/sbin">
AuthType Basic
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>
Alias /nagios "/usr/local/nagios/share"
<Directory "/usr/local/nagios/share">
AuthType Basic
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName "nagios Access"
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>
2.nagios安装配置
#安装nagios前准备工作
[root@rhel6 ~]# groupadd nagios
[root@rhel6 ~]# useradd nagios -g nagios -s /sbin/nologin
[root@rhel6 ~]# mkdir /usr/local/nagios
[root@rhel6 ~]# chown -R nagios:nagios /usr/local/nagios
[root@rhel6 ~]# tar xzvf nagios-3.2.0.tar.gz
[root@rhel6 nagios-3.2.0]# ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios *** Configuration summary for nagios 3.2.0 08-12-2009 ***: General Options:
-------------------------
Nagios executable: nagios
Nagios user/group: nagios,nagios
Command user/group: nagios,nagios
Embedded Perl: no
Event Broker: yes
Install ${prefix}: /usr/local/nagios
Lock file: ${prefix}/var/nagios.lock
Check result directory: ${prefix}/var/spool/checkresults
Init directory: /etc/rc.d/init.d
Apache conf.d directory: /etc/httpd/conf.d
Mail program: /bin/mail
Host OS: linux-gnu Web Interface Options:
------------------------
HTML URL: http://localhost/nagios/
CGI URL: http://localhost/nagios/cgi-bin/
Traceroute (used by WAP): /bin/traceroute Review the options above for accuracy. If they look okay,
type 'make all' to compile the main program and CGIs. [root@rhel6 nagios-3.2.0]# make all
[root@rhel6 nagios-3.2.0]# make install
[root@rhel6 nagios-3.2.0]# make install-init 生成init启动脚本
[root@rhel6 nagios-3.2.0]# make install-config 生成一些模板配置文件 [root@rhel6 nagios-3.2.0]# make install-commandmode 设置相应的权限
[root@rhel6 nagios-3.2.0]# make install-webconf 为Nagios设置Web验证的密码账号nagiosadmin
[root@rhel6 nagios-3.2.0]/usr/local/apache2/bin/htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin 设置nagios开机自启动
[root@rhel6 nagios-3.2.0]# chkconfig --add nagios
[root@rhel6 nagios-3.2.0]# chkconfig nagios --level 345 on
3.nagios-plugin安装
[root@rhel6 ~]# tar xzvf nagios-plugins-1.4.14.tar.gz
[root@rhel6 ~]# cd nagios-plugins-1.4.14
[root@rhel6 nagios-plugins-1.4.14]# ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios
[root@rhel6 nagios-plugins-1.4.14]# make && make install
4.重新启动Apache和nagios
service httpd restart
service nagios restart
检查配置文件
[root@rhel6 ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Nagios Core 3.2.0
Copyright (c) 2009 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2009
License: GPL
Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config file '/usr/local/nagios/etc/objects/commands.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/contacts.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/timeperiods.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/templates.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/localhost.cfg'...
Read object config files okay...
Running pre-flight check on configuration data...
Checking services...
Checked 8 services.
Checking hosts...
Checked 1 hosts.
Checking host groups...
Checked 1 host groups.
Checking service groups...
Checked 0 service groups.
Checking contacts...
Checked 1 contacts.
Checking contact groups...
Checked 1 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 24 commands.
Checking time periods...
Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
我在做这个的时候遇到这样问题,web界面登陆用户名和密码确认都对,就是一直登陆不进去,后来资料研究发现是上图橙色文字/usr/local/nagios/etc/htpasswd.users路径错写成/usr/local/nagios/etc/htpasswd导致,具体为啥会这样我也说不清,希望大神看到解毒,修改后可以登陆。
但是此时又出现了另外一个问题 You don't have permission to access /nagios/ on this server
出现这个问题原因很多种
1.php是否正确安装,可用php -v看下,如未安装可用使用yum一键安装 yum -y install php
2.httpd配置文件是否正确
下图中的配置如果是deny from all是万不能行的,我就是深受其害,改为allow from all,
http服务重启 service httpd restart
到此一切就能正确访问啦,欢迎大家伙沟通交流。
nagios监控的安装的更多相关文章
- 在Nginx中搭建Nagios监控平台
本文只做Nginx下Nagiox安装的说明,其它关于Nagios监控的详细配置请参考我的另一篇文章[Ubuntu 10.04下构建Nagios监控平台] Nagios依赖PHP环境和perl环境.由于 ...
- smartmontools的安装使用和实现对磁盘的Nagios监控
安装 首先从sourceforge下载最新的安装版本. 解压编译 $ tar -zxvf smartmontools-6.4.tar.gz $ cd smartmontools-6.4 $ ./con ...
- Nagios+pnp4nagios+rrdtool 安装配置nagios被监控端NRPE配置(二)
NRPE监控插件基础 NRPE总共由两部分组成: (1).check_nrpe插件,运行在监控主机上. (2).NRPE daemon,运行在远程的linux主机上(通常就是被监控机) 整个的监控过程 ...
- 自动安装脚本-------------基于LVMP搭建Nagios 监控
Mysql初始化参数(mysql-5.6.31) /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local ...
- Nagios 系统监控基本安装配置过程详解
Nagios 是一款免费的开源 IT 基础设施监控系统,功能强大,灵活性强,能有效监控 Windows.Linux.VMware 和 Unix 主机状态,交换机.路由器等网络设置等.一旦主机或服务状态 ...
- CentOS 7.4 下安装部署Nagios监控系统详细攻略(三)
Nagios是一个流行的电脑系统和网络监控程序,它检测主机和服务,当异常发生和解除时能提醒用户.它是基于GPLv2开发的开源软件,可免费获得及使用. nagios工作原理 nagios的功能是监控服务 ...
- Nagios监控平台搭建
Nagios是一款开源的免费网络监视工具,能有效监控Windows.Linux和Unix的主机状态,交换机路由器等网络设置,打印机等.在系统或服务状态异常时发出邮件或短信报警第一时间通知网站运维人员, ...
- 一步步实现Nagios监控linux主机及飞信报警
一步步实现Nagios监控linux主机及飞信报警 上篇文章介绍了在linux主机上架设nagios监控服务,并对windows主机进行服务状态变化的监控,这次我们继续上次内容. 首先实现n ...
- centos shell编程6一些工作中实践脚本 nagios监控脚本 自定义zabbix脚本 mysql备份脚本 zabbix错误日志 直接送给bc做计算 gzip innobackupex/Xtrabackup 第四十节课
centos shell编程6一些工作中实践脚本 nagios监控脚本 自定义zabbix脚本 mysql备份脚本 zabbix错误日志 直接送给bc做计算 gzip innobacku ...
随机推荐
- ssh in depth
前两天写了一篇关于ssh的相对比较入门的文章,重点介绍了ssh在免密登录场景下的应用. 本文试图对ssh更高级的话题做一下探讨,重点探讨一下ssh tunneling https://www.ssh. ...
- altermanager使用报错
报错如下: level=warn ts=2019-01-24T09:20:01.122920737Z caller=cluster.go:148 component=cluster err=" ...
- OpenResty下载安装教程
原文链接:http://www.studyshare.cn/software/details/1174/0 一.OpenResty简介 OpenResty是一个全功能的 Web 应用服务器.它打包了标 ...
- java中创建线程的3种方法
1.继承Thread类优点:可以直接使用Thread类中的方法,代码比较简单.缺点:继承Thread类之后不能继承其他类. 2.实现Runable接口优点:实现接口,比影响继承其他类或实现接口.缺点: ...
- vue路由切换时内容组件的滚动条回到顶部
在使用vue的时候会出现切换路由的时候滚动条保持在原来的位置,要切换路由的时候滚动条回到顶部才有更好的用户体验 1.当页面整体都要滚动到顶部的情况 router.afterEach(() => ...
- 英语aeroides海蓝宝石aeroides单词
海蓝宝石(aeroides,Aquamarine)是一种含铍.铝的硅酸盐,与祖母绿.乌兰孖努以及碧玺等统称为彩色宝石.海蓝宝石的颜色为天蓝色至海蓝色或带绿的蓝色,它的颜色形成主要是由于含微量的二价铁离 ...
- FreePascal - Typhon如何添加不能识别单元?
Typhon 32位 6.9 问题:想使用LSUtils单元,这个单元在Lazarus里面,直接引入就可以使用,而且单元头注释明显写明是CodeTyphon工程的一部分,那么正常在Typhon只要引入 ...
- 【数据库】数据库入门(三): SQL
SQL: 结构化查询语言(Structured Query Language) SQL 是由 IBM 公司首先开发产生,它是关系型数据库最早出现的商用语言之一.1974年,IBM 公司 San Jos ...
- springboot使用阿里fastjson来解析数据
1.spring boot默认使用的json解析框架是jackson,使用fastjson需要配置,首先引入fastjson依赖 pom.xml配置如下: <project xmlns=&quo ...
- Redhat6.5安装oracle11g
Redhat6.5安装oracle11g 一. 安装环境 linux服务器:Redhat 6.5 64位 oracle版本:oracle11gR2 远程windows服务器:已安装Xmanage ...