How to automate installation of Nagios

Source: Internet
Author: User
Tags config curl openssl openldap

Because the Nagios source code installation process is more cumbersome, so the entire compilation of the installation process into a script to allow the system to automatically run, so as to reduce human intervention, improve efficiency.

Ideas from the "dl528888" blog, http://dl528888.blog.51cto.com/

Experimental environment: CentOS 6.3 x86_64, close firewall, SELinux set to Disabled

Installation package: nagios-3.4.1.tar.gz

Nagios-plugins-1.4.16.tar.gz

Nrpe-2.13.tar.gz

Place the script nagiosauto.sh and Nagios installation package nagios-3.4.1.tar.gz and plug-in installation packages nagios-plugins-1.4.16.tar.gz and nrpe-2.13.tar.gz in the directory/usr/ LOCAL/SRC, and execute the nagiosauto.sh script to install.

After the script executes, opens the browser, enters the Http://ip/nagios, prompts to enter the user name and the password, respectively nagiosadmin and you set the password to enter the Nagios control interface.

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/soft/tools/

Detailed configuration of Nagios needs to be studied further.

#!/bin/bash #auto install Nagios #v2.0--Add Nrpe and correct path #2012 -12-10 lang=c nagiosdir= "/usr/l Ocal/nagios "function Init_pack () #安装需要的包和库文件 {yum-y install gcc gcc-c++ autoconf libjpeg libjpeg-d  Evel 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 libto Ol-ltdl Bison libtool vim-enhanced gd*} function install_httpd () #安装httpd和php Service {yum-y Insta 
ll 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/gro UP)]; Then GroUpadd nagcmd fi usermod-g nagcmd nagios usermod-g Apache} function Nagcmd () 
    #编译安装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= $n Agiosdir make install make install-init make Install-config make Install-commandmod E make install-webconf cd/usr/local/src/nagios-plugins-1.4.16./configure--with-nagios-user=nagi OS--with-nagios-group=nagios--perfix= $nagiosdir make && make install Cd/usr/local/src/nrpe-2 
      
    ./configure make Install-plugin make Install-daemon make Install-daemon-config HTPASSWD-BC $nagiosdir/etc/htpasswd.users nagiosadmin "bcd123" #设置自己的密码 chown-r nagios:nagios $NAGIOSDI R 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

This article is from the "Strive for" blog, please be sure to keep this source http://carllai.blog.51cto.com/1664997/1060606

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.