由于nagios的源码安装过程比较繁琐,于是将整个编译安装过程写进脚本让系统自动运行,这样减少人为干预,提高效率。
思路来源于“dl528888”的博客,http://dl528888.blog.51cto.com/
实验环境:centos 6.3 x86_64, 关闭防火墙,SELinux设为Disabled
安装包: nagios-3.4.1.tar.gz
nagios-plugins-1.4.16.tar.gz
nrpe-2.13.tar.gz
将该脚本nagiosauto.sh 和nagios的安装包nagios-3.4.1.tar.gz和插件安装包nagios-plugins-1.4.16.tar.gz 以及nrpe-2.13.tar.gz放在目录/usr/local/src下,并执行nagiosauto.sh脚本即可进行安装。
脚本执行完后,打开浏览器,输入http://ip/nagios, 提示输入用户名和密码,分别为nagiosadmin 和你所设置的密码 即可进入nagios的控制界面。
更多精彩内容:http://www.bianceng.cnhttp://www.bianceng.cn/soft/tools/
关于nagios的详细配置还需继续深入研究。
#!/bin/bash #auto install nagios #v2.0 -- add nrpe and correct path #2012-12-10 LANG=C nagiosdir="/usr/local/nagios" function init_pack() #安装需要的包和库文件 { yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool-ltdl bison libtool vim-enhanced gd* } function install_httpd() #安装httpd和php 服务 { yum -y install httpd* php* chkconfig httpd on service httpd restart } function user_group() #添加nagios用户和组 { if [ ! $(grep 'nagios' /etc/passwd) ]; then useradd nagios fi if [ ! $(grep 'nagcmd' /etc/group) ]; then groupadd nagcmd fi usermod -G nagcmd nagios usermod -G nagcmd apache } function install_nagios() #编译安装nagios { cd /usr/local/src tar zxvf nagios-3.4.1.tar.gz tar zxvf nagios-plugins-1.4.16.tar.gz tar zxvf nrpe-2.13.tar.gz cd /usr/local/src/nagios ./configure --with-command-group=nagcmd --prefix=$nagiosdir make all make install make install-init make install-config make install-commandmode make install-webconf cd /usr/local/src/nagios-plugins-1.4.16 ./configure --with-nagios-user=nagios --with-nagios-group=nagios --perfix=$nagiosdir make && make install cd /usr/local/src/nrpe-2.13 ./configure make all make install-plugin make install-daemon make install-daemon-config htpasswd -bc $nagiosdir/etc/htpasswd.users nagiosadmin "bcd123" #设置自己的密码 chown -R nagios:nagios $nagiosdir chmod -R 755 $nagiosdir chcon -R --reference=/var/www/html/ $nagiosdir chkconfig --add nagios chkconfig nagios on $nagiosdir/bin/nagios -v $nagiosdir/etc/nagios.cfg service nagios start } init_pack install_httpd user_group install_nagios
本文出自 “努力为之” 博客,请务必保留此出处http://carllai.blog.51cto.com/1664997/1060606
以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索脚本
, ncurses
, tar
, libpng c
, make
, nagios
, install
local
ubunto如何安装nagios、nagios 安装、nagios安装与配置、nagios安装配置、pnp4nagios安装配置,以便于您获取更多的相关知识。