一起搭建linux监控平台之nagios(三)被监控端的环境部署
2012-11-10 09:39
821 查看
这次被监控主要有2种:
1.web服务器
2.mysql服务器
所以得先保证nginx/apache 或者mysql服务的启动;
下面是mysql监控端部署的函数installmysql () 脚本如下
下面是web端部署的脚本
验证安装是否成功的方式,与第一篇相同
还是得手敲(悲剧)!!
这样就可以了
本文出自 “TNT、运维之路” 博客,请务必保留此出处http://tntdba.blog.51cto.com/1199791/1056180
1.web服务器
2.mysql服务器
所以得先保证nginx/apache 或者mysql服务的启动;
下面是mysql监控端部署的函数installmysql () 脚本如下
installmysql () { yum install xinetd -y service xinetd start cd $path useradd -s /sbin/nologin nagios tar -zxvf nagios-plugins-1.4.14.tar.gz cd nagios-plugins-1.4.14 ./configure --prefix=$nagiospath --with-nagios-user=nagios --with-nagios-group=nagios make make install cd $path tar -zxvf nrpe-2.12.tar.gz cd nrpe-2.12 ./configure make all make install make install-plugin make install-daemon make install-daemon-config make install-xinetd read -p " Please input the nagios server IP: " serverip echo "nrpe 5666/tcp #nrpe" >> /etc/services sed -i "s#only_from.*#only_from = 127.0.0.1 $serverip#" /etc/xinetd.d/nrpe chkconfig --add xinetd chkconfig xinetd on cd $path tar -zxvf check_mysql_health-2.1.tar.gz cd check_mysql_health-2.1 ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-perl=/usr/bin/perl make make install yum install perl-DBI perl-DBD-MySQL -y cd $path tar -zxvf check_iftraffic.tar.gz chmod +x check_iftraffic chmod +x check_mem.sh chmod +x check_cpu.sh chmod +x ip_conn.sh cp check_mem.sh /usr/local/nagios/libexec cp check_cpu.sh /usr/local/nagios/libexec cp check_iftraffic /usr/local/nagios/libexec cp ip_conn.sh /usr/local/nagios/libexec read -p "please input the mysql password: " mysqlpwd read -p "please input the nagios for mysql's password: " nagiospwd mysql -uroot -p$mysqlpwd -e "create database nagios;" mysql -uroot -p$mysqlpwd -e "grant select on nagios.* to nagios@'$serverip' identified by '$nagiospwd' ;" mysql -uroot -p$mysqlpwd -e "flush privileges; " cp $path/cfg/nrpe.cfg /usr/local/nagios/etc/ chown -R nagios.nagios /usr/local/nagios service xinetd restart echo "##############################" echo "#########**the result**#######" lsof -i:5666 echo "------------------------------" /usr/local/nagios/libexec/check_nrpe -H localhost }
下面是web端部署的脚本
installweb () { yum install xinetd -y service xinetd start cd $path useradd -s /sbin/nologin nagios tar -zxvf nagios-plugins-1.4.14.tar.gz cd nagios-plugins-1.4.14 ./configure --prefix=$nagiospath --with-nagios-user=nagios --with-nagios-group=nagios make make install cd $path tar -zxvf nrpe-2.12.tar.gz cd nrpe-2.12 ./configure make all make install make install-plugin make install-daemon make install-daemon-config make install-xinetd read -p " Please input the nagios server IP: " serverip echo "nrpe 5666/tcp #nrpe" >> /etc/services sed -i "s#only_from.*#only_from = 127.0.0.1 $serverip#" /etc/xinetd.d/nrpe chkconfig --add xinetd chkconfig xinetd on cd $path tar -zxvf check_iftraffic.tar.gz chmod +x check_iftraffic chmod +x check_mem.sh chmod +x check_cpu.sh chmod +x ip_conn.sh cp check_mem.sh /usr/local/nagios/libexec cp check_cpu.sh /usr/local/nagios/libexec cp check_iftraffic /usr/local/nagios/libexec cp ip_conn.sh /usr/local/nagios/libexec cp $path/cfg/nrpe.cfg /usr/local/nagios/etc/nrpe.cfg chown -R nagios.nagios /usr/local/nagios service xinetd restart echo "###################################" echo "######### the result ########" echo "-----------------------------------" lsof -i:5666 echo "-----------------------------------" /usr/local/nagios/libexec/check_nrpe -H localhost }
验证安装是否成功的方式,与第一篇相同
还是得手敲(悲剧)!!
这样就可以了
本文出自 “TNT、运维之路” 博客,请务必保留此出处http://tntdba.blog.51cto.com/1199791/1056180
相关文章推荐
- 一起搭建linux监控平台之nagios(二)监控端环境部署
- 一起搭建linux监控平台之nagios(一)lamp环境
- 一起搭建linux监控平台之nagios(五)使用以及相关说明
- 一起搭建linux监控平台之nagios(四)监控端添加服务
- Linux系统搭建Nagios监控平台
- Linux下nginx+nagios 监控平台搭建
- 使用Vagrant在Windows平台搭建嵌入式Linux开发环境(1)虚拟环境部署
- Linux服务篇之十:构建Nagios监控平台
- Linux 环境下搭建 Jenkins(Hudson)平台
- Linux 环境下搭建 Jenkins(Hudson)平台
- Linux监控平台搭建(主动模式和被动模式、添加主机、添加自定义模板、处理图形中的乱码、自动发现)
- Nagios监控平台搭建
- 在Linux平台下部署Java web环境和发布Java web程序
- Linux平台swift语言开发学习环境搭建
- influxdb+grafana搭建业务监控平台前篇-相关环境搭建
- 在linux平台下Asterisk环境搭建的过程
- Linux下的Jenkins+Tomcat+Maven+Gitlab+Shell环境的搭建使用(jenkins自动化部署)
- 深入浅出 - Android系统移植与平台开发(六)- 搭建基于Linux的Android开发环境
- Hadoop平台搭建之Linux实验环境
- linux监控平台搭建-磁盘