nagios服务器端自动安装脚本
2013-05-03 15:14
423 查看
1、操作系统centos6.2 最小化安装
破公司非得弄个nagios自动化安装,以前倒是写过一个客户端的自动化安装,这回得写服务器的自动化安装了,额 由于附件大于2M 所以上传到下载中心了,没注意不小心要了4个豆。有豆的话可以直接下载,没有的话也没关系 我把脚本贴上来 就是需要下载一些软件包而已
下载地址 http://down.51cto.com/data/775915
[root@mail nagios]# vi nagios.sh
#!/bin/bash
#install xinetd
rpm -ivh xinetd-2.3.14-33.el6.x86_64.rpm
#install bianyi huanjing
yum -y install zlib-devel openssl-devel libtermcap-devel libxml2-devel gcc-c++ libtool-ltdl-devel curl-devel make gcc gd gd-devel mailx
#intsall apache
yum -y install httpd
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
sed -i 's/Listen 80/Listen 8181/g' /etc/httpd/conf/httpd.conf
sed -i 's/index.html/index.html index.php/g' /etc/httpd/conf/httpd.conf
cat nagios.conf >>/etc/httpd/conf/httpd.conf
service httpd start
#install php
yum -y install php php-devel
echo -e "AddType application/x-httpd-php .php .phtml" >>/etc/httpd/conf/httpd.conf
@
"nagios.sh" 86L, 2599C
sed -i 's/127.0.0.1/$IP/g' /etc/xinetd.d/nrpe
echo -e "nrpe 5666/tcp #nrpe" >>/etc/services
service xinetd start
#config
cat command >>/usr/local/nagios/etc/objects/commands.cfg
#iptables -A INPUT -p tcp --dport 8181 -j ACCEPT
#iptables -A INPUT -p tcp --dport 5666 -j ACCEPT
#echo -e "-A INPUT -p tcp --dport 8181 -j ACCEPT"
#echo -e "-A INPUT -p tcp --dport 5666 -j ACCEPT"
mv /etc/sysconfig/iptables /etc/sysconfig/iptables.bak
mv iptables /etc/sysconfig/
chmod 600 /etc/sysconfig/iptables
service iptables restart
#create nagiosadmin
touch /usr/local/nagios/etc/htpasswd.users
chown -R nagios:nagios /usr/local/nagios
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
service httpd restart
不多说了搞运维的基本上都能看懂上面的代码
因为原来机器的80端口被占用所以我用的是8181端口
http://192.168.X.X:8181/nagios/
破公司非得弄个nagios自动化安装,以前倒是写过一个客户端的自动化安装,这回得写服务器的自动化安装了,额 由于附件大于2M 所以上传到下载中心了,没注意不小心要了4个豆。有豆的话可以直接下载,没有的话也没关系 我把脚本贴上来 就是需要下载一些软件包而已
下载地址 http://down.51cto.com/data/775915
[root@mail nagios]# vi nagios.sh
#!/bin/bash
#install xinetd
rpm -ivh xinetd-2.3.14-33.el6.x86_64.rpm
#install bianyi huanjing
yum -y install zlib-devel openssl-devel libtermcap-devel libxml2-devel gcc-c++ libtool-ltdl-devel curl-devel make gcc gd gd-devel mailx
#intsall apache
yum -y install httpd
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
sed -i 's/Listen 80/Listen 8181/g' /etc/httpd/conf/httpd.conf
sed -i 's/index.html/index.html index.php/g' /etc/httpd/conf/httpd.conf
cat nagios.conf >>/etc/httpd/conf/httpd.conf
service httpd start
#install php
yum -y install php php-devel
echo -e "AddType application/x-httpd-php .php .phtml" >>/etc/httpd/conf/httpd.conf
@
"nagios.sh" 86L, 2599C
sed -i 's/127.0.0.1/$IP/g' /etc/xinetd.d/nrpe
echo -e "nrpe 5666/tcp #nrpe" >>/etc/services
service xinetd start
#config
cat command >>/usr/local/nagios/etc/objects/commands.cfg
#iptables -A INPUT -p tcp --dport 8181 -j ACCEPT
#iptables -A INPUT -p tcp --dport 5666 -j ACCEPT
#echo -e "-A INPUT -p tcp --dport 8181 -j ACCEPT"
#echo -e "-A INPUT -p tcp --dport 5666 -j ACCEPT"
mv /etc/sysconfig/iptables /etc/sysconfig/iptables.bak
mv iptables /etc/sysconfig/
chmod 600 /etc/sysconfig/iptables
service iptables restart
#create nagiosadmin
touch /usr/local/nagios/etc/htpasswd.users
chown -R nagios:nagios /usr/local/nagios
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
service httpd restart
不多说了搞运维的基本上都能看懂上面的代码
因为原来机器的80端口被占用所以我用的是8181端口
http://192.168.X.X:8181/nagios/
相关文章推荐
- 用SHELL脚本自动化安装Nagios服务器端和客户端的
- 用SHELL脚本自动化安装Nagios服务器端和客户端的
- 用SHELL脚本自动化安装Nagios服务器端和客户端的
- Cagios.sh 自动安装nagios cacti zabbix munin的脚本
- 用SHELL脚本自动化安装Nagios服务器端和客户端
- nagios自动安装脚本
- 用SHELL脚本自动化安装Nagios服务器端和客户端的
- nagios+LAMP自动安装脚本
- 自动安装脚本-------------基于LVMP搭建Nagios 监控
- 使用shell脚本自动化安装Nagios服务器端和客户端
- nagios+LAMP自动安装脚本
- 用SHELL脚本自动化安装Nagios服务器端和客户端的
- 用SHELL脚本自动化安装Nagios服务器端和客户端的
- nagios自动安装脚本(一个脚本实现服务端+客户端自动安装)
- 用SHELL脚本自动化安装Nagios服务器端和客户端的 推荐
- hadoop自动安装脚本
- linux杂谈(三):自动安装脚本kickstart
- [shell]为CentOS创建自动安装模块的脚本
- 用脚本实现自动安装windows
- 自动安装squid+iptables上网代理及上网行为管理脚本(二)。