Nagios Monitor-Side Automation installation script

Source: Internet
Author: User
Tags php and mysql

Background: Company needs, deployment Nagios monitoring System, multiple server deployment, there will be repeated work, simply written script, automated installation, hope to help everyone.

Script content:

#!/bin/bash

#Filename: nagios.sh

Setenforce 0 #需要关闭selinux,

Yum install-y http php php-mysql mysql mysql-devel mysql-server #安装http, PHP and MySQL, if installed, no harm

Cd/tmp #我的软件包安装在了tmp目录下, this can be casual


wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.0.8.tar.gz #下载nagios压缩包

wget http://www.nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz #下载nagios插件安装包

Tar XF nagios-4.0.8.tar.gz #解包, note that the following package name must match the package name you downloaded

Tar XF nagios-plugins-2.1.1.tar.gz #解包


Groupadd nagcmd #添加nagios命名组

Useradd-g nagcmd nagios #添加nagios用户

Usermod-a-G Nagios Apache


CD nagios-4.0.8/ #现在的路径是/tmp/nagios-4.0.8

./configure--sysconfdir=/etc/nagios--with-commond-group=nagcmd--enable-event-broker #这里也可以直接./configure, I am here to put the Nagios configuration file in the/etc/directory for configuration, where you can freely

Make all #编译

Make install

Make Install-init

Make Install-commandmode

Make Install-config

Make install-webconf #以上这几个步骤必须得有



Cd.. #此时的路径是/tmp/

CD NAGIOS-PLUGINS-2.1.1/

./configure--with-nagios-user=nagios--with-nagios-group=nagios

Make #编译

Make install


Sed-i ' s#use_authentication=1#use_authentication=0#g '/home/cgi.cfg #修改cgi. cfg file, change use_authentication=1 to use_authentication=0, note the path of this file, I am here/etc/nagios/cgi.cfg, is generally in/usr/local/nagios/etc/cgi.cfg.


Chkconfig--add nagios #增加服务

Chkconfig Nagios on #增加启动项


Chown-r nagios.nagcmd/usr/local/nagios/ #nagios目录更改所属主和属组


Htpasswd-c/etc/nagios/htpasswd.users admin #web界面验证密码, here when we need to enter the password, note that the last admin indicates that our login account is admin, of course you can set other



Script is the above content, add Execute permission for script

chmod +x nagios.sh

Execute script

./nagios.sh


When you are finished, start the Nagios service:

Service Nagios Start


Enter Http://ip/nagios in the browser can see the login screen, note, here my login account is the admin, password is your own during the execution of the script entered the password.



This article is from the "Tosagta" blog, please be sure to keep this source http://tsoagta.blog.51cto.com/9747076/1700638

Nagios Monitor-Side Automation installation script

Related Article

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.