升木 发表于 2019-1-13 07:56:17

nagios安装使用介绍

  项目背景:
  为了更好的监控我们的服务器,开源的监控软件是免费的,可以为我们企业省去不少的开支
  

  实验环境:
  虚拟机VMware Workstation 12 player
  服务器端:centos6.4的系统,ip:192.168.0.24 netmask:255.255.255.0
  nagios 3.5.1

  系统默认的yum源的apache服务器
  

  软件介绍:
Nagios是一个可运行在Linux/Unix平台之上的开源监视系统,可以用来监视系统运行状态和网络信息。Nagios可以监视所指定的本地或远程主机以及服务,同时提供异常通知功能。
Nagios可以提供以下几种监控功能。

[*]  监控网络服务(SMTP、POP3、HTTP、NNTP、Ping等)。
[*]  监控主机资源(处理器负荷、磁盘利用率等)。
[*]  简单的插件设计使得用户可以方便地扩展自己服务的检测方法。
[*]  并行服务检查机制。
[*]  具备定义网络分层结构的能力,并使用“parent”主机定义来表达网络主机间的关系,这种关系可被用来发现和明晰主机宕机或不可达状态。
[*]  当服务或主机问题产生与解决时将告警发送给联系人(通过电子邮件、短信、用户定义方式)。
[*]  具备定义事件处理功能,可以在主机或服务的事件发生时获取更多问题定位。
[*]  自动的日志回滚。
[*]  可以支持并实现对主机的冗余监控。
[*]  可选的Web界面用于查看当前的网络状态、通知和故障历史、日志文件等。
Nagios最好用的地方就是它将这些每天管理员做的工作自动化,你只需设定好要监听的端口即可,它会默默地工作,帮忙定时地去检测服务端口的状态,一旦发现问题,会及时发出报警。报警可以是电子邮件也可以是手机,从而使得管理员第一时间就能收到系统的状况。


软件安装:
执行下面脚本

  #!/bin/bash
  #This is nagios in centos6.4 autho install shell
  setenforce 0
  yum install -y gcc gcc-c++ httpd php php-gd glibc glibc-common gd gd-devel perl perl-devel traceroute bind-utils ntpdate mtr wget nc mailx
  wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-3.5.1.tar.gz
  tar zxvfnagios-3.5.1.tar.gz
  cd nagios/
  useradd -m nagios
  groupadd nagcmd
  usermod -a -G nagcmd nagios
  usermod -a -G nagcmd apache
  ./configure --with-command-group=nagcmd
  make all
  make install
  make install-init
  make install-config
  make install-commandmode
  make install-webconf
  htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
  chkconfig--add nagios
  service httpd restart
  service nagios start
  sed -i 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/sysconfig/selinux
  service iptables stop
  chkconfig iptables off
  chkconfig ip6tables off
  

  测试:
  1、在浏览器里面输入ip/nagios回车
http://s1.运维网.com/wyfs02/M01/7C/A2/wKioL1bUPs6wGRZ7AAKMBDvVHnE385.png
  2、登录进去以后http://s4.运维网.com/wyfs02/M00/7C/A2/wKioL1bUP7jDJ_2NAAHK6c3-fQI274.png
  3、随便点点看看
http://s4.运维网.com/wyfs02/M02/7C/A4/wKiom1bUQXzCCgkaAAHtOAfW9As048.png
http://s2.运维网.com/wyfs02/M00/7C/A4/wKiom1bUQYGh7mCzAAIApTQhhpA004.png
http://s4.运维网.com/wyfs02/M00/7C/A3/wKioL1bUQfuQbIhKAALXST_RbwA375.png
  谢谢大家,希望能共同进步。



页: [1]
查看完整版本: nagios安装使用介绍