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文件说明:

nagios系列(一)centos6.5环境部署nagios服务端的更多相关文章

  1. Rsync同步部署web服务端配置

    Rsync同步部署web服务端配置 1,参数详解: -v, --verbose 详细模式输出. -q, --quiet 精简输出模式. -c, --checksum 打开校验开关,强制对文件传输进行校 ...

  2. Linux 部署 iSCSI 服务端

    Linux 部署 iSCSI 服务端 服务端实验环境 iSCSI-server :RHEL8 IP:192.168.121.10 一.服务端安装 target 服务和 targetcli 命令行工具 ...

  3. 如何将phantomjs单独部署在服务端

    如何将phantomjs单独部署在服务端 文章目录 一. 容我分析(lao dao)几句 二. 服务端 Look here 服务端phantomjs搭建 web端搭建及如何调用phantomjs 三. ...

  4. IntelliJ IDEA openfire 使用IntelliJ IDEA 部署OPENFIRE 服务端

    用MyEclipse部署OF的步骤,网上有很多,可以自行google,这里要记录的是用据说最好用的JAVA编辑器IntelliJ IDEA来部署OF服务端.试了好多下,终于成功了,记录下. 直接上图吧 ...

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

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

  6. CentOS6部署VNC服务端

    VNC (Virtual Network Computer)是虚拟网络计算机的缩写.VNC 是在基于 UNIX 和 Linux 操作系统的免费的开源软件,远程控制能力强大,高效实用,其性能可以和 Wi ...

  7. zookeeper系列之:独立模式部署zookeeper服务

    一.简述 独立模式是部署zookeeper服务的三种模式中最简单和最基础的模式,只需一台机器即可,独立模式仅适用于学习,开发和生产都不建议使用独立模式.本文介绍以独立模式部署zookeeper服务器的 ...

  8. 如何部署Icinga服务端

    Icinga是Nagios的一个变种,配置,使用方式几乎一样,而且完全兼容Nagios的插件.所以下面的部署方案对Nagios同样使用. 它还推出了两个中文版本,icinga-cn原版和icinga- ...

  9. 部署zabbix服务端和客户端和网页

    一:安装zabbix服务端 1.部署准备 命令:iptables -F     #关闭防火墙命令:systemctl stop firewalld    #关闭防火墙 设置解析,自建yum源 命令:c ...

随机推荐

  1. CDQZ.OPENJUDGE DataStructure22

    我觉得这是很重要的一些题目.它们都在这里:硕巨结构 Challenge 0:给定数列,单点修改,单点查询修改.煞有介事,不过一数组耳. Challenge 1:给定数列,单点修改,单点查询第k次操作后 ...

  2. 【洛谷P1248】加工生产调度

    题目大意:某工厂收到了n个产品的订单,这n个产品分别在A.B两个车间加工,并且必须先在A车间加工后才可以到B车间加工.某个产品i在A.B两车间加工的时间分别为Ai.Bi.怎样安排这n个产品的加工顺序, ...

  3. MySQL常用辅助语句

    查看索引: mysql> show index from user_info; +-----------+------------+----------+--------------+----- ...

  4. JVM性能调优2:JVM性能调优参数整理

    序号 参数名 说明 JDK 默认值 使用过 1 JVM执行模式 2 -client-server 设置该JVM运行与Client 或者Server Hotspot模式,这两种模式从本质上来说是在JVM ...

  5. emptyDir与hostPath

    目录 Volume类型 emptyDir hostPath Volume类型 volume是kubernetes Pod中多个容器访问的共享目录.volume被定义在pod上,被这个pod的多个容器挂 ...

  6. yolo3的改变

    转自:https://zhuanlan.zhihu.com/p/35394369 YOLOv3的前世今生 2013年,R-CNN横空出世,目标检测DL世代大幕拉开. 各路豪杰快速迭代,陆续有了SPP, ...

  7. 【转载】掌握 HTTP 缓存——从请求到响应过程的一切(下)

    作者:Ulrich Kautz 编译:胡子大哈 翻译原文:http://huziketang.com/blog/posts/detail?postId=58bd4dd1204d50674934c3b0 ...

  8. 如何使用Ajax从FastReport Web API获取报表

    在文章“如何在ASP.NET Web API中使用FastReport.Net”中,我们已经讨论了如何创建一个用于生成报表的Web服务.然后我们会收到报表的链接,现在我们来看看如何获​​取报表并使用a ...

  9. buildroot构建项目(五)--- u-boot 2017.11 适配开发板修改 3 ---- 系统启动初始化之二

    一.cpu_init_crit 当执行完时钟初始化后,程序执行: bl    cpu_init_crit 跳转到CPU初始化处进行,在其中主要是执行 caches 的关闭 和 MMU的关闭,之后跳转到 ...

  10. string字符串js操作

    String 对象方法 方法 描述 anchor() 创建 HTML 锚. big() 用大号字体显示字符串. blink() 显示闪动字符串. bold() 使用粗体显示字符串. charAt() ...