博客列表 >自动安装NAGIOS可用环境脚本

自动安装NAGIOS可用环境脚本

Altura的博客
Altura的博客原创
2017年07月26日 13:02:17790浏览

/root 有文件nagios-3.5.1.tar.gz

chmod u+x

wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-3.5.1.tar.gz#_ga=2.13033203.573490116.1500534596-612837492.1500534596


#!/bin/bash

setenforce 0 && /etc/init.d/iptables stop

echo “please input files on /root/ directry”

yum install gcc glibc glibc-common php gdgd-devel libpng libmng libjpeg zlib -y &>/dev/null

yum install httpd -y &&/etc/init.d/httpd start &>/dev/null

cat >/var/www/html/index.php <<HH

<?php

phpinfo();

?>

HH

useradd nagios && groupadd Yang

usermod -G Yang nagios && usermod -G Yang apache

if [ ! -f /root/nagios-3.5.1.tar.gz ] ;

then

echo “install package is not exits”

echo “please input package on /root/”

fi

cd ~;tar -xf nagios-3.5.1.tar.gz -C /usr/local/src/

cd /usr/local/src/nagios

./configure –with–command-group=Yang && make all && make install && make install-init && make install-commandmode && make install-config && make install-webconf

if [ $? -eq 0 ] ;then

echo “nagios already installed”

else

echo “nagios install is faulse”

fi

/etc/init.d/httpd restart

echo ” 配置Nagiosadmin用户密码,pleae input password”

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

/etc/init.d/httpd restart

ln -s /usr/local/nagios/bin/* /usr/bin/ && echo ” 软连接创建ok”

nagios -d /usr/local/nagios/etc/nagios.cfg

clear

echo ” 开始安装插件”

if [ ! -f /root/nagios-plugins-2.1.1.tar.gz ];then

echo ” 插件包不存在”

fi

cd ~;tar -xf nagios-plugins-2.1.1.tar.gz -C /usr/local/src/

cd /usr/local/src/nagios-plugins-2.1.1/

./configure –with-nagios-user=nagios –with-group=Yang && make -j 2 && make install

if [ $? -eq 0 ] ;then

echo ” 插件安装成功”

else

echo ” 插件安装失败”

fi

/etc/init.d/httpd restart && echo “Nagios配置成功”

echo “Thank for using”

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议