linux环境中nagios(nagios core)安装?nagios安装?
需求描述:
最近准备给线上生产环境部署监控平台,对各个系统的资源使用情况,服务进行监控,采用nagios core版本进行部署,
nagios core是开源版本的软件,是免费的nagios XI是上夜班.
环境信息:
操作系统版本:RedHat 6.6 x64
安装过程:
1.将SElinx设置为disabled或者permissive
[root@testvm02 ~]# sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
[root@testvm02 ~]# getenforce
Permissive
2.安装依赖的软件包
yum install -y gcc glibc glibc-common wget unzip httpd php gd gd-devel perl postfix
3.下载,上传nagios-core的软件包
下载地址:
https://www.nagios.org/downloads/nagios-core/thanks/?skip=1&product_download=nagioscore-source
本例安装的版本:
nagios-4.4.1.tar.gz
上传软件到指定的目录中:
[root@testvm02 ~]# cd /opt/softwares/;ls -l #实际情况中可以上传软件到自己指定的目录中.
total
-rw-r--r--. root root Jul : nagios-4.4..tar.gz
4.解压,编译,安装
[root@testvm02 nagios-4.4.]# tar zxf nagios-4.4..tar.gz
[root@testvm02 nagios-4.4.]# cd nagios-4.4.
[root@testvm02 nagios-4.4.]# ./configure
[root@testvm02 nagios-4.4.]# make all
5.创建用户,用户组
[root@testvm02 nagios-4.4.]# make install-groups-users
groupadd -r nagios
useradd -g nagios nagios
[root@testvm02 nagios-4.4.]# usermod -a -G nagios apache
[root@testvm02 nagios-4.4.1]# id nagios
uid=500(nagios) gid=499(nagios) groups=499(nagios)
[root@testvm02 nagios-4.4.1]# id apache
uid=48(apache) gid=48(apache) groups=48(apache),499(nagios
6.创建二进制命令,CGI,html文件
[root@testvm02 nagios-4.4.]# make install
7.安装相关的进程文件(安装启动脚本),增加httpd开机启动,nagios开机启动
[root@testvm02 nagios-4.4.]# make install-daemoninit
/usr/bin/install -c -m -d -o root -g root /etc/init.d
/usr/bin/install -c -m -o root -g root startup/default-init /etc/init.d/nagios *** Init script installed *** [root@testvm02 nagios-4.4.1]# chkconfig --level 2345 httpd on
[root@testvm02 nagios-4.4.1]# chkconfig --list | grep httpd
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@testvm02 nagios-4.4.1]# chkconfig --list | grep nagios
nagios 0:off 1:off 2:on 3:on 4:on 5:on 6:off
8.安装外部命令文件
[root@testvm02 nagios-4.4.1]# make install-commandmode
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/var/rw
chmod g+s /usr/local/nagios/var/rw *** External command directory configured ***
9.安装配置文件
[root@testvm02 nagios-4.4.]# make install-config
/usr/bin/install -c -m -o nagios -g nagios -d /usr/local/nagios/etc
/usr/bin/install -c -m -o nagios -g nagios -d /usr/local/nagios/etc/objects
/usr/bin/install -c -b -m -o nagios -g nagios sample-config/nagios.cfg /usr/local/nagios/etc/nagios.cfg
/usr/bin/install -c -b -m -o nagios -g nagios sample-config/cgi.cfg /usr/local/nagios/etc/cgi.cfg
/usr/bin/install -c -b -m -o nagios -g nagios sample-config/resource.cfg /usr/local/nagios/etc/resource.cfg
/usr/bin/install -c -b -m -o nagios -g nagios sample-config/template-object/templates.cfg /usr/local/nagios/etc/objects/templates.cfg
/usr/bin/install -c -b -m -o nagios -g nagios sample-config/template-object/commands.cfg /usr/local/nagios/etc/objects/commands.cfg
/usr/bin/install -c -b -m -o nagios -g nagios sample-config/template-object/contacts.cfg /usr/local/nagios/etc/objects/contacts.cfg
/usr/bin/install -c -b -m -o nagios -g nagios sample-config/template-object/timeperiods.cfg /usr/local/nagios/etc/objects/timeperiods.cfg
/usr/bin/install -c -b -m -o nagios -g nagios sample-config/template-object/localhost.cfg /usr/local/nagios/etc/objects/localhost.cfg
/usr/bin/install -c -b -m -o nagios -g nagios sample-config/template-object/windows.cfg /usr/local/nagios/etc/objects/windows.cfg
/usr/bin/install -c -b -m -o nagios -g nagios sample-config/template-object/printer.cfg /usr/local/nagios/etc/objects/printer.cfg
/usr/bin/install -c -b -m -o nagios -g nagios sample-config/template-object/switch.cfg /usr/local/nagios/etc/objects/switch.cfg *** Config files installed *** Remember, these are *SAMPLE* config files. You'll need to read
the documentation for more information on how to actually define
services, hosts, etc. to fit your particular needs.
备注:这些都是一些示例配置文件,同时比如nagios.cfg在启动nagios的时候需要使用到.
10.安装apache配置文件即httpd配置文件
[root@testvm02 nagios-4.4.]# make install-webconf
/usr/bin/install -c -m sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf
if [ -eq ]; then \
ln -s /etc/httpd/conf.d/nagios.conf /etc/apache2/sites-enabled/nagios.conf; \
fi *** Nagios/Apache conf file installed ***
11.配置防火墙或者关闭防火墙
配置允许8端口进入:
iptables -I INPUT -p tcp --destination-port -j ACCEPT
service iptables save
关闭防火墙,关闭开机启动: service iptables stop
[root@testvm02 nagios-4.4.1]# chkconfig --level 2345 iptables off
[root@testvm02 nagios-4.4.1]# chkconfig --list | grep iptables
iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:of
12.创建nagios管理账号
[root@testvm02 nagios-4.4.]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password: #输入新密码
Re-type new password: #再次输入密码,进行确认
Adding password for user nagiosadmin
13.启动apache服务,nagios core服务
[root@testvm02 nagios-4.4.]# service httpd start
[root@testvm02 nagios-4.4.]# service nagios start
14.通过页面进行访问测试
访问地址:http://192.168.53.25/nagios 输入nagios管理账号,密码进行登录.

登录成功之后,页面如下:

查看Hosts,Services有如下的报错:

备注:以上错误提示,表示没有某些命令,即在/usrlocal/nagios/libexex中灭有命令,需要安装nagios-plugins来安装相应的命令
15.下载,上传nagios-plugins压缩包
下载地址:
https://www.nagios.org/downloads/nagios-plugins/
软件包:nagios-plugins-2.2.1.tar.gz
[root@testvm02 softwares]# cd /opt/softwares/;ls -l nagios-plugins*
-rw-r--r--. root root Jul : nagios-plugins-2.2..tar.gz
16.安装依赖的软件包,解压,编译,安装
yum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils
[root@testvm02 softwares]# tar zxf nagios-plugins-2.2..tar.gz
[root@testvm02 softwares]# cd nagios-plugins-2.2.
[root@testvm02 nagios-plugins-2.2.]# ./configure
[root@testvm02 nagios-plugins-2.2.1]# make
[root@testvm02 nagios-plugins-2.2.1]# make install
备注:插件安装完成
17.重新在nagios页面进行测试,在HOSTS中的localhost的命令菜单中点击."Re-schedule the next check",查看hosts状态

备注:说明命令已经成功,对于services中的检查,也会在一定时间之后,达到调度时间进行状态的修改.
Servies的状态:

18.针对HTTP的检查,在本地的/var/www/html中创建index.html文件就可以解决这个警告
[root@testvm02 libexec]# cd /var/www/html/
[root@testvm02 html]# touch index.html
配置完成之后,http服务的状态:

到此,所有的nagios-core,nagios-plugins已经安装完成!
文档创建时间:2018年7月31日12:58:55
linux环境中nagios(nagios core)安装?nagios安装?的更多相关文章
- 【事件中心 Azure Event Hub】在Linux环境中(Ubuntu)安装Logstash的简易步骤及配置连接到Event Hub
在文章([事件中心 Azure Event Hub]使用Logstash消费EventHub中的event时遇见的几种异常(TimeoutException, ReceiverDisconnected ...
- linux环境中安装ftp服务
需求说明: 今天项目中有一个新的需求,需要在linux环境中搭建一个ftp服务,在此记录下. 操作过程: 1.通过yum的方式安装ftp服务对应的软件包 [root@testvm01 ~]# yum ...
- (3)ElasticSearch在linux环境中安装与配置head插件
1.简介 ElasticSearch-Head跟Kibana一样也是一个针对ElasticSearch集群操作的API的可视化管理工具,它提供了集群管理.数据可视化.增删改查.查询语句等功能,最重要还 ...
- 在离线环境中发布.NET Core至Windows Server 2008
在离线环境中发布.NET Core至Windows Server 2008 0x00 写在开始 之前一篇博客中写了在离线环境中使用.NET Core,之后一边学习一边写了一些页面作为测试,现在打算发布 ...
- 在离线环境中使用.NET Core
在离线环境中使用.NET Core 0x00 写在开始 很早开始就对.NET Core比较关注,一改微软之前给人的印象,变得轻量.开源.跨平台.最近打算试着在工作中使用.但工作是在与互联网完全隔离的网 ...
- Linux环境中Openfire安装指南
Linux环境中Openfire安装指南 安装环境: 安装软件:Openfire 4_1_0 http://download.igniterealtime.org/openfire/openfire_ ...
- [转]在离线环境中发布.NET Core至Windows Server 2008
本文转自:http://www.cnblogs.com/durow/p/5765145.html 0x00 写在开始 之前一篇博客中写了在离线环境中使用.NET Core,之后一边学习一边写了一些页面 ...
- 她娇羞道“不用这样细致认真的说啊~~”———详细图解在Linux环境中创建运行C程序
她娇羞说,不用这样细致认真的说啊———详细图解在Linux环境中创建运行C程序“不,这是对学习的负责”我认真说到 叮叮叮,停车,让我们看看如何在Linux虚拟机环境中,创建运行C程序 详细图解在Lin ...
- 理解 Linux 网络栈(2):非虚拟化Linux 环境中的 Segmentation Offloading 技术
本系列文章总结 Linux 网络栈,包括: (1)Linux 网络协议栈总结 (2)非虚拟化Linux环境中的网络分段卸载技术 GSO/TSO/UFO/LRO/GRO (3)QEMU/KVM + Vx ...
- [软件测试]Linux环境中简单清爽的Google Test (GTest)测试环境搭建(初级使用)
本文将介绍单元测试工具google test(GTEST)在linux操作系统中测试环境的搭建方法.本文属于google test使用的基础教程.在linux中使用google test之前,需要对如 ...
随机推荐
- 【进阶修炼】——改善C#程序质量(8)
122,以<Company>.<Component>作为命名空间. 如Microsoft.Windows.Design.也可以用域名作为空间,如www.microsoft.co ...
- 【C】——pthread_mutex_lock
函数名 pthread_mutex_lock, pthread_mutex_trylock, pthread_mutex_unlock - lock and unlock a mutex SYNOPS ...
- 利用SpringCloud搭建一个最简单的微服务框架
http://blog.csdn.net/caicongyang/article/details/52974406 1.微服务 微服务主要包含服务注册,服务发现,服务路由,服务配置,服务熔断,服务降级 ...
- R-table和tapply函数
table可统计数据的频数 tapply可根据因子.向量和要计算的函数计算 > class<-c(1,2,3,2,1,2,1,3) > class[1] 1 2 3 > c(8 ...
- 使用Photoshop合成两张不完整的图片
一.准备工作 软件环境:PhotoshopCS6 目标:将两张不完整的图片合并成一张完整的图片. 二.操作步骤 1,新建一张画布,参数:15*12厘米,像素300. 2,对第一张不完整的图片选择魔棒工 ...
- Java如何滚动几个小时和几个月?
在Java中,如何滚动几个小时和几个月? 本示例展示了如何使用calender类的roll()方法滚动月(不改变年)或小时(不更改月或年). package com.yiibai; import ja ...
- Spring JDBC RowMapper接口示例
JdbcTemplate类使用org.springframework.jdbc.core.RowMapper <T>接口在每行的基础上映射ResultSet的行.该接口的实现执行将每行映射 ...
- e816. 创建工具栏
A toolbar can be either horizontal or vertical. When the orientation is horizontal, the objects in t ...
- e813. 获得当前选择的菜单或菜单项
The currently selected menu or menu item in a JMenu or JPopupMenu is tracked by MenuSelectionManager ...
- C#或者.NET下的强制垃圾回收办法
转载 2011年03月16日 17:21:00 标签: c# / .net / button / object / stream / class 8185 今天来谈谈C#的GC,也就是垃圾回收机制,非 ...