测试环境部署文档
更新时间:2023-10-15 02:31:01 阅读量: 综合文库 文档下载
测试环境部署文档 一. nagios安装与配置
1. 安装前的准备
1.1 支持php
# yum -y install httpd gcc glibc glibc-common php gd gd-devel libpng libmng libjpeg zlib openssl openssl-devel # service httpd restart # chkconfig httpd on
# vim /var/www/html/index.php
二. 监控中心(172.168.9.79)nagios安装
1. 1. 主程序安装
[root@tianyun ~]# groupadd nagcmd
[root@tianyun ~]# useradd nagios -G nagcmd //组nagcmd用于从Web接口执 行外部命令,将用户nagios和apache加入该组
[root@tianyun ~]# gpasswd -a apache nagcmd /usr/sbin/usermod -G nagcmd apache
[root@tianyun ~]# grep nagcmd /etc/group nagcmd:x:500:nagios,apache
[root@tianyun ~]# tar xvf nagios-3.2.0.tar.gz [root@tianyun ~]# cd nagios-3.2.0 [root@tianyun nagios-3.2.0]# ./configure --prefix=/usr/local/nagios --with-command-group=nagcmd
[root@tianyun nagios-3.2.0]# make all [root@tianyun nagios-3.2.0]# make install //安装nagios的grep nagcmd /etc/group主程序,CGI和HTML文件
[root@tianyun nagios-3.2.0]# make install-init //生成/etc/rc.d/init.d/nagios启动脚本
[root@tianyun nagios-3.2.0]# make install-config //安装nagios示例配置文件,这里安装的路径是/usr/local/nagios/etc
[root@tianyun nagios-3.2.0]# make install-commandmode //设定相应nagios工作目录的权限
[root@tianyun nagios-3.2.0]# make install-webconf //安装Nagios的WEB配置文件到Apache的conf.d目录下
[root@tianyun ~]# ls /usr/local/nagios/ //查看nagios安装文件 bin etc libexec sbin share var
[root@tianyun ~]# ls /usr/local/nagios/libexec/ //目前没有任何插件
1.2 安装插件
[root@tianyun ~]# tar xvf nagios-plugins-1.4.14.tar.gz
[root@tianyun ~]# cd nagios-plugins-1.4.14
[root@tianyun nagios-plugins-1.4.14]# ./configure \\
--with-nagios-user=nagios \\ --with-nagios-group=nagcmd \\ --prefix=/usr/local/nagios
[root@tianyun nagios-plugins-1.4.14]# make
[root@tianyun nagios-plugins-1.4.14]# make install [root@tianyun ~]# ls /usr/local/nagios/libexec/
check_apt check_file_age check_log check_oracle check_tcp
check_breeze check_flexlm check_mailq check_overcr check_time
check_by_ssh check_ftp check_mrtg check_ping check_udp
check_clamd check_http check_mrtgtraf check_pop check_ups
check_cluster check_icmp check_nagios check_procs check_users
check_dhcp check_ide_smart check_nntp check_real check_wave
check_dig check_ifoperstatus check_nt check_rpc negate
check_disk check_ifstatus check_ntp check_sensors urlize
check_disk_smb check_imap check_ntp_peer check_smtp utils.pm
check_dns check_ircd check_ntp_time check_ssh utils.sh
check_dummy check_load check_nwstat check_swap
1.3 Nagios中文化插件(可选安装)
[root@tianyun ~]# tar xvf nagios-cn-3.2.0.tar.bz2 [root@tianyun ~]# cd nagios-cn-3.2.0
[root@tianyun nagios-cn-3.2.0]# ./configure [root@tianyun nagios-cn-3.2.0]# make all [root@tianyun nagios-cn-3.2.0]# make install
1.4 apache 访问控制
[root@tianyun ~]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin New password:
Re-type new password:
Adding password for user nagiosadmin 1.5启动nagios,httpd
[root@tianyun ~]# chkconfig nagios on [root@tianyun ~]# service nagios start Starting nagios: done.
[root@tianyun ~]# chkconfig httpd on [root@tianyun ~]# service httpd restart 1.6测试访问 http://ip/nagios
输入之前设置的用户名和密码
查看导航栏中:主机、服务,如果能看localhost的监控,说明阶段成功!
=================================================================== nagios文件的具体含义:(/usr/local/nagios/etc/objects) command.cfg 定义nagios能调用的命令; contacts.cfg 定义联系人; localhost.cfg 定义监控本机的对象; printer.cfg 定义对打印机的监控; switch.cfg 定义对交换机的监控; templates.cfg 定义模板; timeperiods.cfg 定义时间对象; windows.cfg 定义监控的windows主机;定义。 三. 增加对本地FTP、NFS监控 定义主机和服务
[root@tianyun ~]# vim /usr/local/nagios/etc/objects/localhost.cfg ... ... ...
# Define a service to \ define service{
use local-service host_name localhost service_description FTP
check_command check_ftp }
# Define a service to \ define service{
use local-service host_name localhost service_description NFS
check_command check_tcp!2049 }
检查配置并重启nagios
[root@tianyun objects]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg [root@tianyun objects]# service nagios restart 四. 监控远程主机
基本步骤: 1. 定义主机 2. 定义服务
主机配置(172.168.9.179)
[root@tianyun objects]# pwd /usr/local/nagios/etc/objects
[root@tianyun objects]# mkdir web mysql oracle
[root@tianyun objects]# vim /usr/local/nagios/etc/nagios.cfg cfg_dir=/usr/local/nagios/etc/objects/web cfg_dir=/usr/local/nagios/etc/objects/mysql cfg_dir=/usr/local/nagios/etc/objects/oracle
配置nagios监控远程主机
一、监控远程主机(172.168.8.79)公共资源 [root@tianyun objects]# pwd /usr/local/nagios/etc/objects
[root@tianyun objects]# cp localhost.cfg web/172.168.8.79.cfg
[root@tianyun ~]# vim /usr/local/nagios/etc/objects/web/172.168.8.79.cfg
######################################################################## ######################################################################## #
# HOST DEFINITION #
######################################################################## ########################################################################
# Define a host for the local machine
define host{
use linux-server host_name web-172.168.8.79 alias web-172.168.8.79 address 172.168.8.79 }
######################################################################## ######################################################################## #
# SERVICE DEFINITIONS #
######################################################################## ########################################################################
define service{
use local-service host_name web-172.168.8.79
service_description SSH
check_command check_ssh }
define service{
use local-service host_name web-172.168.8.79 service_description HTTP
check_command check_http }
define service{
use local-service host_name web-172.168.8.79 service_description FTP
check_command check_ftp
[root@tianyun ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg [root@tianyun ~]# service nagios restart 二、监控主机私有资源
配置被监控端Nagios Client(172.168.8.79) 1. 安装nrpe和nagios插件
[root@client ~]# yum install openssl openssl-devel xinetd gcc make [root@client ~]# groupadd nagcmd
[root@client ~]# useradd nagios -G nagcmd [root@client ~]# grep nagcmd /etc/group nagcmd:x:500:nagios,apache
[root@client ~]# tar xvf nagios-plugins-1.4.14.tar.gz [root@client ~]# cd nagios-plugins-1.4.14
[root@client nagios-plugins-1.4.14]# ./configure && make && make install
[root@client ~]# tar xvf nrpe-2.12.tar.gz [root@client ~]# cd nrpe-2.12
[root@client nrpe-2.12]# ./configure && make && make install [root@client nrpe-2.12]# make install-daemon-config [root@client nrpe-2.12]# make install-xinetd
[root@client nrpe-2.12]# vim /etc/xinetd.d/nrpe # default: on # description: NRPE (Nagios Remote Plugin Executor) service nrpe
正在阅读:
测试环境部署文档10-15
期盼12-13
浙江省杭州市2015年高考数学命题比赛模拟试卷(5)及答案06-23
教师信息技术应用能力提升培训计划.doc07-30
海安县公安局06-22
2014计算机 - 图文10-25
江苏省宝应县画川高级中学高中语文《夏本纪》练习苏教版选修《史记选读》11-09
2011年广州酒店用品展商名录12-15
- 多层物业服务方案
- (审判实务)习惯法与少数民族地区民间纠纷解决问题(孙 潋)
- 人教版新课标六年级下册语文全册教案
- 词语打卡
- photoshop实习报告
- 钢结构设计原理综合测试2
- 2014年期末练习题
- 高中数学中的逆向思维解题方法探讨
- 名师原创 全国通用2014-2015学年高二寒假作业 政治(一)Word版
- 北航《建筑结构检测鉴定与加固》在线作业三
- XX县卫生监督所工程建设项目可行性研究报告
- 小学四年级观察作文经典评语
- 浅谈110KV变电站电气一次设计-程泉焱(1)
- 安全员考试题库
- 国家电网公司变电运维管理规定(试行)
- 义务教育课程标准稿征求意见提纲
- 教学秘书面试技巧
- 钢结构工程施工组织设计
- 水利工程概论论文
- 09届九年级数学第四次模拟试卷
- 部署
- 文档
- 环境
- 测试