需求描述:

  最近准备给线上生产环境部署监控平台,对各个系统的资源使用情况,服务进行监控,采用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安装?的更多相关文章

  1. 【事件中心 Azure Event Hub】在Linux环境中(Ubuntu)安装Logstash的简易步骤及配置连接到Event Hub

    在文章([事件中心 Azure Event Hub]使用Logstash消费EventHub中的event时遇见的几种异常(TimeoutException, ReceiverDisconnected ...

  2. linux环境中安装ftp服务

    需求说明: 今天项目中有一个新的需求,需要在linux环境中搭建一个ftp服务,在此记录下. 操作过程: 1.通过yum的方式安装ftp服务对应的软件包 [root@testvm01 ~]# yum ...

  3. (3)ElasticSearch在linux环境中安装与配置head插件

    1.简介 ElasticSearch-Head跟Kibana一样也是一个针对ElasticSearch集群操作的API的可视化管理工具,它提供了集群管理.数据可视化.增删改查.查询语句等功能,最重要还 ...

  4. 在离线环境中发布.NET Core至Windows Server 2008

    在离线环境中发布.NET Core至Windows Server 2008 0x00 写在开始 之前一篇博客中写了在离线环境中使用.NET Core,之后一边学习一边写了一些页面作为测试,现在打算发布 ...

  5. 在离线环境中使用.NET Core

    在离线环境中使用.NET Core 0x00 写在开始 很早开始就对.NET Core比较关注,一改微软之前给人的印象,变得轻量.开源.跨平台.最近打算试着在工作中使用.但工作是在与互联网完全隔离的网 ...

  6. Linux环境中Openfire安装指南

    Linux环境中Openfire安装指南 安装环境: 安装软件:Openfire 4_1_0 http://download.igniterealtime.org/openfire/openfire_ ...

  7. [转]在离线环境中发布.NET Core至Windows Server 2008

    本文转自:http://www.cnblogs.com/durow/p/5765145.html 0x00 写在开始 之前一篇博客中写了在离线环境中使用.NET Core,之后一边学习一边写了一些页面 ...

  8. 她娇羞道“不用这样细致认真的说啊~~”———详细图解在Linux环境中创建运行C程序

    她娇羞说,不用这样细致认真的说啊———详细图解在Linux环境中创建运行C程序“不,这是对学习的负责”我认真说到 叮叮叮,停车,让我们看看如何在Linux虚拟机环境中,创建运行C程序 详细图解在Lin ...

  9. 理解 Linux 网络栈(2):非虚拟化Linux 环境中的 Segmentation Offloading 技术

    本系列文章总结 Linux 网络栈,包括: (1)Linux 网络协议栈总结 (2)非虚拟化Linux环境中的网络分段卸载技术 GSO/TSO/UFO/LRO/GRO (3)QEMU/KVM + Vx ...

  10. [软件测试]Linux环境中简单清爽的Google Test (GTest)测试环境搭建(初级使用)

    本文将介绍单元测试工具google test(GTEST)在linux操作系统中测试环境的搭建方法.本文属于google test使用的基础教程.在linux中使用google test之前,需要对如 ...

随机推荐

  1. mypy 支持静态类型编程的python变种

    每种编程语言都有一群固定的用户,对于那些习惯将不同编程语言用成同样的感觉的人来说,最是难受.因为每种语言都有它独特的设计『哲学』和擅长的应用领域. PHP给大家的一贯的印象都是动态弱类型语言,Pyth ...

  2. [加密]展讯secureboot方案

    Secure Boot方案介绍及实施流程 转自网络 1. Secure boot概述 本文档主要是secure boot方案的介绍和说明,其内容会涵盖以下方面:secure boot的目的和介绍.技术 ...

  3. JVM相关命题的博客整理及总结

    JVM垃圾回收基础介绍 http://www.jianshu.com/p/57457a351b8a 减少JVM中逃逸对象的使用 http://www.importnew.com/23150.html ...

  4. Mac下配置Apache Httpd的Https/SSL

    Mac下配置Apache Httpd的Https/SSL httpd版本: httpd-2.4.17 jdk版本: jdk1.8.0_65 参考来源: Mac下安装Apache Httpd Mac O ...

  5. 【转】26张PPT让你告别拖延症

    不论你如何富有,你都赚不到更多的时间,你也回不到过去.没有那么多的假如,只有指针滴答的时光飞逝和你应该好好把握的现在. 可能的话,请仔细读读PPT原件而不要只是看翻译吧. 1.时间常有,时间优先. 2 ...

  6. 代理ARP

    代理ARP是ARP协议的一个变种. 对于没有配置缺省网关的计算机要和其他网络中的计算机实现通信,网关收到源计算机的 ARP 请求会使用自己的 MAC 地址与目标计算机的 IP地址对源计算机进行应答.代 ...

  7. Google Chrome 未响应。是否立即重新启动?---解决方法(秒速解决)

    Google Chrome 未响应.是否立即重新启动? 解决方法 不当的退出会造成 Google Chrome 无法启动.出现“Google Chrome 未响应.是否立即重新启动?”的错误. 要解决 ...

  8. sql sever读取写入Excel总结

    主要用到openrowset,opendatasource系统函数,这两个函数任意一个都能完成任务 用这种方法可以实现Excel和sqlserver表之间的相互导入导出. 如果使用openrowset ...

  9. Linux sed命令替换文件文件内容

    sed在Linux下是个强大的工具,这里主要说替换: 1.替换并输出(不修改源文件): sed 's/dog/cat/g' file ##dog被替换的内容,cat替换的内容 2.备份后直接替换至源文 ...

  10. MySQL 入门教程

    目录 一.MySQL的相关概念介绍 二.Windows下MySQL的配置 配置步骤 MySQL服务的启动.停止与卸载 三.MySQL脚本的基本组成 四.MySQL中的数据类型 五.使用MySQL数据库 ...