需求描述:

  最近准备给线上生产环境部署监控平台,对各个系统的资源使用情况,服务进行监控,采用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. Android——requestWindowFeature()的应用

    Android开发中经常会在setContentView(R.layout.XXX); 前设置requestWindowFeature(XXXX). 他的意思是需要软件全屏显示.自定义标题(使用按钮等 ...

  2. Selenium (1) —— Selenium安装与测试(101 Tutorial)

    Selenium (1) -- Selenium安装与测试(101 Tutorial) jvm版本: 1.8.0_65 selenium版本: v2.48.0 (Standalone Selenium ...

  3. Sahi (2) —— https/SSL配置(102 Tutorial)

    Sahi (2) -- https/SSL配置(102 Tutorial) jvm版本: 1.8.0_65 sahi版本: Sahi Pro 6.1.0 参考来源: Sahi官网 Sahi Quick ...

  4. 全国地区的省份、城市、区县 最新Sql脚本

    IF (EXISTS(SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TB_Province]') AND type =' ...

  5. Centos7.3防火墙配置

    1.查看firewall服务状态 systemctl status firewalld 2.查看firewall的状态 firewall-cmd --state 3.开启.重启.关闭.firewall ...

  6. Linux source命令

    Linux source命令   Linux source命令: 通常用法:source filepath 或 . filepath 功能:使当前shell读入路径为filepath的shell文件并 ...

  7. HtmlUnitDriver 网页内容动态抓取

    #抓取内容 WebDriver driver = new HtmlUnitDriver(false); driver.get(url); String html = driver.getPageSou ...

  8. Network In Network——卷积神经网络的革新

    Network In Network 是13年的一篇paper 引用:Lin M, Chen Q, Yan S. Network in network[J]. arXiv preprint arXiv ...

  9. iPhone开发中,关于视图跳转的总结(转)

    iPhone开发中,关于视图跳转的总结 iPhone开发中从一个视图跳到另一个视图有三种方法: 1. self.view addSubView:view .self.window addSubView ...

  10. e613. Modifying the Focus Traversal Order

    JFrame frame = new JFrame(); JButton component1 = new JButton("1"); JButton component2 = n ...