nagios软件安装包存放目录:/home/oldboy/tools
nagios服务安装目录:/usr/local/nagios

1、配置yum源
echo "------ step 1: config yum ------"
cd /etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

报错:
# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
--2016-07-21 09:10:05--  http://mirrors.aliyun.com/repo/Centos-6.repo
Resolving mirrors.aliyun.com... failed: Name or service not known.
wget: unable to resolve host address “mirrors.aliyun.com”
是不能解析域名,编辑DNS即可
[root@node4 yum.repos.d]# vim /etc/resolv.conf 
nameserver 192.168.8.251

2、配置profile文件
echo "------ step 2: config  profile------"
echo 'export LC_ALL=C'>> /etc/profile
source /etc/profile

3、停用防火墙和selinux
echo "------ step 3: stop iptables and selinux------"
/etc/init.d/iptables stop
chkconfig iptables off
setenforce 0
也可以用脚本
if [ -f /etc/selinux/config ]; then
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
setenforce 0
fi

4、时间同步
echo "------ step 4: config time sync------"
/usr/sbin/ntpdate pool.ntp.org
echo '#time sync by jack at 2016-7-21'>>/var/spool/cron/root
echo '*/10 * * * * /usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1'>>/var/spool/cron/root
crontab -l

5、安装依赖包
echo "------ step 5: install gcc and lamp env etc------"
yum install gcc glibc glibc-common -y
yum install gd gd-devel -y
yum install httpd php php-gd -y
yum install mysql* -y

6、添加nagios用户和组
echo "------ step 6: add nagios  user and group------"
/usr/sbin/useradd -m nagios
#/usr/sbin/useradd apache
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd apache

7、安装服务端软件
echo "------ step 7: download and install nagios------"
[ ! -f oldboy_training_nagios_soft.zip ] && exit 1
unzip oldboy_training_nagios_soft.zip 
tar xzf nagios-3.5.1.tar.gz
cd nagios
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
cd ../
echo "------ step 8: config web auth------"
htpasswd -cb /usr/local/nagios/etc/htpasswd.users jack jack

9、安装插件
echo "------ step 9: install nagios-plugins------"
yum -y install perl-devel
tar zxf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16
./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-perl-modules
make && make install
cd ../
ls /usr/local/nagios/libexec/|wc -l

报错:
check_http.c:312: error: ‘ssl_version’ undeclared (first use in this function)
check_http.c:312: error: (Each undeclared identifier is reported>

解决办法:
yum install -y openssl*

echo "------ step 10: install nrpe------"
tar zxvf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure 
make all
make install-plugin
make install-daemon
make install-daemon-config
cd ..

10、启动nagios和apache
echo "------ step 11: startup service and check------"
/etc/init.d/nagios start
/etc/init.d/httpd start
echo -----------
lsof -i tcp:80
echo ----------
ps -ef|grep nagios
echo "NAGIOS is successfully installed."

echo ok

hosts.cfg文件定义:

services.cfg文件说明:

转载于:https://www.cnblogs.com/reblue520/p/6239771.html

nagios系列(一)centos6.5环境部署nagios服务端相关推荐

  1. 【LDAP】在Centos7环境搭建LDAP服务端

    在Centos7环境搭建LDAP服务端 前言 正文 OpenLDAP介绍 LDIF文件书写规则 OpenLDAP部署 安装服务 配置ldap 修改管理员密码 初始化配置 直接修改配置文件(不建议) 使 ...

  2. .net 部署到服务端IIS,Process调用exe程序无法运行问题解决

    场景: 开发某一功能将html内容转换为pdf,采用第三方插件wkhtmltopdf.exe进行转换.在本地调试正常运行,部署到服务端后文件没有正常生成. IIS中,Process打不开cmd程序,程 ...

  3. windows环境下MySQL服务端和客户端安装,超详细

    windows环境下MySQL服务端和客户端安装,超详细 MySQL简介 MySQL的安装步骤 服务端安装 客户端安装 MySQL简介 MySQL是关系型数据库,由n张互相关联的表组成.一般是c或c+ ...

  4. CentOS8上部署NFS服务端和客户端

    centos8上部署nfs服务端和客户端 文章目录 背景 服务端与客户端信息 配置服务端 安装软件包 编辑配置文件 验证并使配置生效 启动服务端服务 查看服务端状态: 配置客户端: 安装软件包 启动客 ...

  5. 基于nginx环境部署nagios

    安装思路,仅供参考 ####nagios安装 yum install gd-devel -y useradd nagios groupadd nagcmd usermod -a -G nagcmd n ...

  6. CentOS6.6部署VNC服务端

    为什么80%的码农都做不了架构师?>>>    VNC (Virtual Network Computer)是虚拟网络计算机的缩写.VNC 是在基于 UNIX 和 Linux 操作系 ...

  7. linux ntp时间立即同步命令_记一次生产环境部署NTP服务及配置时间同步

    概述 linux服务器在提供服务时,要和其他机器进行请求的交互,实际生产环境中,可能因为时间不同步,导致了服务异常. 下面介绍下怎么部署NTP服务来解决这个问题. ps:强烈吐槽下头条这个新排版功能, ...

  8. Linux环境部署node服务并启动

    Linux环境部署node 一.node下载与安装 1.node下载 2.通过XFTP把下载下来的包传到服务器上 3.解压包 4.建立软链接 二.使用PM2启动node 1.为什么要使用PM2 2.安 ...

  9. openfire运行环境部署+jwchat网页端通信聊天+插件的基础知识+webchat环境配置和下载地址

    研究Openfire快一个月的时间了,最初的项目要求是利用Openfire作为服务器端,在网页端注册或输入登录信息进行类似QQ的聊天.后来需要在网页端加入客服系统实现匿名登录和实名登录功能,实现N个客 ...

最新文章

  1. 华东理工大学计算机应用基础,最新华东理工大学计算机应用基础网上作业及全部答案...
  2. HTML 转 PDF 新姿势
  3. html实现全屏效果原理,HTML5 实现全屏效果
  4. python画图代码七彩蟒蛇-Python实现七彩蟒蛇绘制实例代码
  5. 用ASP.NET AJAX 开发Web程序 — UpdatePanel篇
  6. 另外五个 PHP 设计模式
  7. 吴恩达机器学习作业Python实现(三):多类分类和前馈神经网络
  8. 2022-01-10总结
  9. 计算机科学与技术和信息与计算科学区别,信息与计算科学和计算机科学与技术有什么区别...
  10. SqlSession介绍
  11. Redis的持久化策略
  12. 黑马程序员——String类总结
  13. mysql与oracle语法区别
  14. dhcp、tftp基础
  15. 基于asp.net719圆通快递物流管理系统
  16. TikTok Shop 英国限售商品规则
  17. matplotlib散点图自定义坐标轴(文字坐标轴)
  18. 64位win7下安装SQL Server 2008(图文解说版)
  19. 出现数据库不给访问的情况
  20. 数字信号处理专业术语翻译

热门文章

  1. Oracle - TRUNC, ROUND, CEIL, FLOOR
  2. DropDownList如何绑定DataTable,如何绑定DataSet
  3. python 函数对象(函数式编程 lambda、map、filter、reduce)、闭包(closure)
  4. Pandas入门教程(一)
  5. vue vuex 挂载_GitHub - BingoVue/vuex: 用Vue实现简版vuex
  6. 开发函数计算的正确姿势 —— 排查超时问题
  7. sublime----------快捷键的记录
  8. (原)MongoDB在系统中的使用
  9. android 远程下载与pull解析技术
  10. 20 Tips to Simplify Your Digital and Online Life