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之前,需要对如 ...
随机推荐
- [算法]谷歌笔试题:Beautiful Numbers
题目描述 思路 这道题就是在说,由多个1组成的数是beautiful的,现在想求出r进制中的r,使得给出的数字转换成r进制,得到beautiful的数字,如果有多种方式转换,那么取1的个数最多的那种情 ...
- SpringCloudConfig与SpringCloudEureka 注册中心与配置中心高可用的意义
所有的配置会缓存在本地,远程配置中心DOWN机,不影响本地使用,只是无法重新请求服务端获取配置的更新. 不管是注册中心的高可用,还是配置中心的高可用.本质上都是保证服务能注册上去或者能从配置中心获取配 ...
- 17个CSS知识点整理
1.对WEB标准以及W3C的理解与认识 标签闭合.标签小写.不乱嵌套.提高搜索机器人搜索几率:使用外链css和js脚本.结构行为表现的分离.文件下载与页面速度更快:内容能被更多的用户所访问.内容能被更 ...
- 自定义垂直拖动的seekbar进度条
系统自定义的seekbar为横向拖动的样式,需要纵向的时则需要自己定义,网上很多说了重写系统SeekBar中onDraw()的方法,但是我使用的时候不知道为什么拖动条和点偏离了,不在一条直线上,好气. ...
- C++ 定时器任务类实现
#ifndef __TIMERTASK_H_ #define __TIMERTASK_H_ /* 定时器任务基类 */ #include "asr_taskinterface.h" ...
- 百度echarts极速入门
1.http://echarts.baidu.com/ 进入官网 2.打开官方示例 3.随便打开一个列子并打开f12浏览器调试模式,找到例子的iframe地址 4.打开地址 5.下载例子,so eas ...
- C语言中重要的小知识汇总
用于整理记录一些C语言下的小知识点: 1. 在C语言中,怎么查看一个数据类型占用了多少个字节大小呢? 可以使用sizeof(int)/sizeof(double)等来查看某数据类型到底用了几个字节: ...
- 第三百八十三节,Django+Xadmin打造上线标准的在线教育平台—第三方模块django-simple-captcha验证码
第三百八十三节,Django+Xadmin打造上线标准的在线教育平台—第三方模块django-simple-captcha验证码 下载地址:https://github.com/mbi/django- ...
- [转]Android--多线程之Handler
原文:http://www.cnblogs.com/plokmju/p/android_Handler.html 前言 Android的消息传递机制是另外一种形式的“事件处理”,这种机制主要是为了解决 ...
- C#基础--------------------C#正则表达式
为了避免以后这样的情况,在此记录下正则表达式的一些基本使用方法附带小的实例.让以后在使用时能一目了然知道他的使用,为开发节约时间,同时也分享给大家 正则元字符 在说正则表达式之前我们先来看看通配符,我 ...