网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

一键安装nagios

一键安装nagios

创新互联建站于2013年成立,是专业互联网技术服务公司,拥有项目成都做网站、成都网站制作网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元南川做网站,已为上家服务,为南川各地企业和个人服务,联系电话:18980820575


此脚本仅仅适用于centos 6.4 x86_64,yum安装的httpd和php,这里的安装过程以后我会整理一份手工安装版本的 需要源码安装的  请期待后面的更新。

nagios的报警之强大目前还没有别的软件可以比肩,也是运维人员必须要掌握的一个软件。包括nagios脚本的开发,各种应用的监控。这里先给新手朋友一个如何安装nagios的思路.

直接上脚本

#!/bin/bash
#Date: 2013/12/6
#BY:renzhenxing
#install nagios-server or nagios-plugs
read -p "Please input your nagiosadmin's password:" a
selinux=`grep SELINUX=enforcing /etc/selinux/config | awk -F "=" '{print $2}'`
if [ "$selinux" == "enforcing" ]
   then
      echo "your system Selinux not shut down,"
      exit 1
fi
yum install -y wget gcc gcc++ gcc* bc net-snmp net-snmp-utils net-snmp-libs  libpng libpng-devel libjpeg libjpeg-devel openssl098e gd* gd2* openssl-devel* openssl*
cd /usr/local/src
if [ -f nagios-4.0.1.tar.gz ]
then
     echo ".........................................nagios.tar.gz..................is OK!!!"
else
     echo "nagios.tar.gz.............................is not ok!!!..................download"
     wget http://jaist.dl.sourceforge.net/project/nagios/nagios-4.x/nagios-4.0.1/nagios-4.0.1.tar.gz
fi
if [ -f nagios-plugins-1.5.tar.gz ]
then
    echo "............................................nagios-plugs .................is ok!!!"
else
    echo "nagios-plugins-1.5.tar.gz....................is not ok !!!! ..............download"
    wget https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz
fi
if [ -f nrpe-2.15.tar.gz ]
then
   echo "............................................nrpe-2.15.tar.gz.................is ok!!!"
else
   echo "..................................nrpe-2.15.tar.gz...is not ok!!!............download"
   wget http://jaist.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
fi
###add install nagios ID:
useradd -m nagios
echo "nagios" | passwd --stdin nagios
###add install  gid:
groupadd nagcmd
###daemon 为apache运行账号:
usermod -a -G nagcmd daemon
###install nagios-4.0.1.tar.gz
tar -zxf nagios-4.0.1.tar.gz && cd nagios-4.0.1
./configure --with-command-group=nagcmd --with-gd-lib=/usr/local/libgd/lib/ --with-gd-inc=/usr/local/libgd/include/
make all
make install
make install-init
make install-config
make install-commandmode
cd ../
cat >>/etc/httpd/conf/httpd.conf<
#  SSLRequireSSL
   Options ExecCGI
   AllowOverride None
   Order allow,deny
   Allow from all
#  Order deny,allow
#  Deny from all
#  Allow from 127.0.0.1
   AuthName "Nagios Access"
   AuthType Basic
   AuthUserFile /usr/local/nagios/etc/htpasswd.users
   Require valid-user

Alias /nagios "/usr/local/nagios/share"

#  SSLRequireSSL
   Options None
   AllowOverride None
   Order allow,deny
   Allow from all
#  Order deny,allow
#  Deny from all
#  Allow from 127.0.0.1
   AuthName "Nagios Access"
   AuthType Basic
   AuthUserFile /usr/local/nagios/etc/htpasswd.users
   Require valid-user

EOF
##########################################################
###location nagios admin   password(default:che100):
htpasswd -cb /usr/local/nagios/etc/htpasswd.users nagiosadmin $a
###service httpd server:
service httpd restart
###install nagios-plugs(default:/usr/local/nagios/):
tar -xzf nagios-plugins-1.5.tar.gz
cd nagios-plugins-1.5
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
cd ../
###install nrpe:
tar -zxf nrpe-2.15.tar.gz
cd nrpe-2.15
./configure && make all && make install-plugin
###禁用suexec的功能.此功能对CGI的执行路径进行了限制
setenforce 0
###stop iptables:
service iptables stop
###start nagios  server:
service nagios restart
echo "--------------- nagios server install ok!!!------------------------"
echo "  "
echo "--------------service nagios start is start -----------------------"
echo "  "

安装之后访问:

http://你的服务器的IP/nagios

默认的用户名是:nagiosadmin      密码是脚本开始时候让你输入的密码。

说明:

ps:由于本人的shell 脚本比较烂,有想法的朋友可以指点一下。

附件:http://down.51cto.com/data/2363876

当前标题:一键安装nagios
当前URL:http://bjjierui.cn/article/jgjsep.html

其他资讯