【移动应用开发技术】Nagios监控系统安装文档_第1页
【移动应用开发技术】Nagios监控系统安装文档_第2页
【移动应用开发技术】Nagios监控系统安装文档_第3页
【移动应用开发技术】Nagios监控系统安装文档_第4页
【移动应用开发技术】Nagios监控系统安装文档_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

【移动应用开发技术】Nagios监控系统安装文档

服务器端:硬件环境:虚拟机环境软件环境:Centos-6.2x86-64Lamp环境Nagios-3.2.0版本Nagios-plugins-1.4.13插件版本Pnp-0.4.14版本Rrdtool-1.2.14版本Nrpe-2.12版本客户端:硬件环境:物理机和虚拟机软件环境:Linux客户端:linux服务器端与linux客户端监控原理:更多内容:/directory/p_w_picpath/93Centos-6.X-x86-64Nrpe-2.12版本Windows客户端:Windows2008R2Windows2003R2需开启Snmp服务服务器端安装一,安装前准备:1,解决perl编译问题:后面编译的软件有perl程序,这里要提前设置下环境变量。批量执行命令如下:echo'exportLC_ALL=C'>>/etc/profiletail-1/etc/profilesource/etc/profileecho$LC_ALL2,关闭防火墙,安装完后启动防火墙。/etc/init.d/iptablesstop/etc/init.d/iptablesstart2.1解决系统时间同步。echo‘*/5****/usr/sbin/ntpdate’>>/var/spool/cron/root[root@nagios~]#crontab-l*/5****/usr/sbin/ntpdate>/dev/null2>&13,安装nagios所需基础软件包批量执行命令如下:yuminstallgccglibcglibc-common-yyuminstallgdgd-devel-yyuminstallhttpdphpphp-gd-y3.1创建nagios需要的用户及组批量命令:/usr/sbin/useradd-mnagios/usr/sbin/useraddapache/usr/sbin/groupaddnagcmd/usr/sbin/usermod-a-Gnagcmdnagios/usr/sbin/usermod-a-Gnagcmdapacheid-n-Gnagiosid-n-Gapachegroupsnagiosgroupsapache3.2下载软件包mkdir-p/server/soft/sourceforge/nagiosplug/nagios-plugins-1.4.16.tar.gz二,安装nagiostarzxfnagios-3.2.0.tar.gzcdnagios-3.2.0./configure--with-command-group=nagcmdmakeallmakeinstallmakeinstall-initmakeinstall-commandmodemakeinstall-configmakeinstall-webconf提示:如果是编译安装的httpd是,可以执行./configure--with-command-group=nagcmd--with-httpd-conf=/usr/local/apache2/conf/extra增加一个编译参数即指定编译nagiosweb配置的生产路径。然后编辑vi/usr/local/apache2/conf/httpd.conf增加Includeconf/extra/nagios.conf1,创建nagiosweb监控界面登入时需要的用户名及密码htpasswd-c/usr/local/nagios/etc/htpasswd.usersadmin输入密码即可cat/usr/local/nagios/etc/htpasswd.users提示:如果为单独编译的apache,则操作命令如下/usr/local/apache2/bin/htpasswd-c/usr/local/nagios/etc/htpasswd.usersadmin2,添加接收监控报警的email地址vi/usr/local/nagios/etc/objects/contacts.cfg+35emailnagios@localhost改为:emailbaochengcai@快速命令:sed-I's#nagios@localhost#baochengcai@#'/usr/local/nagios/etc/objects/contacts.cfg3,启动邮件服务。/etc/init.d/sendmailstartchkconfigsendmailonchkconfig--listsendmail如果sendmail启动比较缓慢,可以修改/etc/hostsnagioslocalhost.localdomainlocalhost#增加主机名hostname4,配置apache服务启动apache并加入系统开机自启动:/etc/init.d/httpdstartchkconfighttpdon5,安装nagios插件软件包tarzxfnagios-plugins-1.4.13.tar.gzcdnagios-plugins-1.4.13./configure--with-nagios-user=nagios--with-nagios-group=nagios--enable-perl-modulesmakemakeinstallls/usr/local/nagios/libexec/|wc-l#编译如遇到make:***[all]Error2则configure加--with-mysql=/usr/local/mysql解决chkconfignagiosonchkconfig--listnagios6,验证nagios配置文件(检查语法)简单方法:/etc/init.d/nagioscheckconfig[root@nagios~]#/etc/init.d/nagioscheckconfigRunningconfigurationcheck...OK./usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfgTotalWarnings:0TotalErrors:0Thingslookokay-Noseriousproblemsweredetectedduringthepre-flightcheck#TotalWarnings:警告和TotalErrors:错误都为0,表示配置正常。#TotalErrors:如果不为0必须解决,否则nagios无法启动。#TotalWarnings:这个如果不为0可以启动nagios。启动nagios服务/etc/init.d/nagiosstart检查nagios进程:ps-ef|grepnagios|grep-vgrep检查selinux是否关闭setenforce0sed-i's#SELINUX=enforcing#SELINUX=disabled#'/etc/selinux/configgetenforce7,安装nrpe软件:tarzxfnrpe-2.12.tar.gzcdnrpe-2.12./configuremakeallmakeinstall-pluginmakeinstall-daemonmakeinstall-daemon-confignagios服务器端安装结束,后续需要调整参数。**Nagios添加多账户管理检查当前系统账号:[root@nagios~]#cat/usr/local/nagios/etc/htpasswd.usersadmin:HMcYqU.5Bh5bkxiaomin:$apr1$GFzBDndr$Rd6Qvbc58PCUTPXNjhs8E1chenkaixiong:$apr1$M6RLaWz8$8Ghi27zHStHaSZ9W1DVgs/添加系统登录账号:[root@nagios~]#htpasswd-m/usr/local/nagios/etc/htpasswd.userschengcaiNewpassword:Re-typenewpassword:Addingpasswordforuserchengcai[root@nagiosetc]#cat/usr/local/nagios/etc/htpasswd.usersadmin:HMcYqU.5Bh5bkxiaomin:$apr1$GFzBDndr$Rd6Qvbc58PCUTPXNjhs8E1chenkaixiong:$apr1$M6RLaWz8$8Ghi27zHStHaSZ9W1DVgs/chengcai:$apr1$lXiSe1w4$HxIw6xSwjon5NshKfbbSx0配置账号权限:[root@nagiosetc]#egrep-v"^#|^$"cgi.cfgmain_config_file=/usr/local/nagios/etc/nagios.cfgphysical_html_path=/usr/local/nagios/shareurl_html_path=/nagiosshow_context_help=0use_pending_states=1use_authentication=1use_ssl_authentication=0authorized_for_system_information=nagiosadmin,adminauthorized_for_configuration_information=nagiosadmin,adminauthorized_for_system_commands=nagiosadmin,adminauthorized_for_all_services=nagiosadmin,adminauthorized_for_all_hosts=nagiosadmin,adminauthorized_for_all_service_commands=nagiosadmin,adminauthorized_for_all_host_commands=nagiosadmin,adminauthorized_for_read_only=xiaomin,chenkaixiong,chengcai#注:只给chengcai账号只读权限,如果想给该账号更多权限,可根据配置添加。default_statusmap_layout=5default_statuswrl_layout=4ping_syntax=/bin/ping-n-U-c5$HOSTADDRESS$refresh_rate=90escape_html_tags=1action_url_target=_blanknotes_url_target=_blanklock_author_names=1客户端安装:-linux:1,解决perl编译问题:后面编译的软件有perl程序,这里要提前设置下环境变量。批量执行命令如下:yum-yinstallperl-develperlecho'exportLC_ALL=C'>>/etc/profiletail-1/etc/profilesource/etc/profileecho$LC_ALL2,关闭防火墙,安装完后启动防火墙。/etc/init.d/iptablesstop/etc/init.d/iptablesstart2.1解决系统时间同步。echo‘*/5****/usr/sbin/ntpdate’>>/var/spool/cron/root[root@nagios~]#crontab-l*/5****/usr/sbin/ntpdate>/dev/null2>&13,在nagios客户端安装插件mkdir-p/server/softcd/server/softrz-y(oldboy_tracining_nagios_soft.zip)#老男孩提供的软件包。unzipoldboy_tracining_nagios_soft.zip3.1安装nagios-plugins-1.4.13.tar.gz/usr/sbin/useraddnagios-M-s/sbin/nologintarzxfnagios-plugins-1.4.13.tar.gzcdnagios-plugins-1.4.13./configure--with-nagios-user=nagios--with-nagios-group=nagios--enable-perl-modulesmakemakeinstallls/usr/local/nagios/libexec/|wc-l#编译如遇到make:***[all]Error2则configure加--with-mysql=/usr/local/mysql解决3.2,安装nrpe软件:tarzxfnrpe-2.12.tar.gzcdnrpe-2.12./configuremakeallmakeinstall-pluginmakeinstall-daemonmakeinstall-daemon-config3.3安装其他相关的插件【iostat】#tarzxfParams-Validate-0.91.tar.gzcdParams-Validate-0.91perlMakefile.PLmakemakeinstallcd..#tarzxfClass-Accessor-0.31.tar.gzcdClass-Accessor-0.31perlMakefile.PLmakemakeinstallcd..#tarzxfConfig-Tiny-2.12.tar.gzcdConfig-Tiny-2.12perlMakefile.PLmakemakeinstallcd..#tarzxfMath-Calc-Units-1.07.tar.gzcdMath-Calc-Units-1.07perlMakefile.PLmakemakeinstallcd..#tarzxfRegexp-Common-2010010201.tar.gzcdRegexp-Common-2010010201perlMakefile.PLmakemakeinstallcd..#tarzxfNagios-Plugin-0.34.tar.gzcdNagios-Plugin-0.34perlMakefile.PLmakemakeinstallcd..#yuminstallsysstat-y#这个命令式安装系统性能分析工具,监控系统性能时程序或脚步会调用这些工具。3.4配置开发的几个基本脚本插件cp/server/soft/nagios/check_memory.pl/usr/local/nagios/libexec/cp/server/soft/nagios/check_iostat/usr/local/nagios/libexecchmod755/usr/local/nagios/libexec/check_memory.plchmod755/usr/local/nagios/libexec/check_iostatdos2unix/usr/local/nagios/libexec/check_memory.pldos2unix/usr/local/nagios/libexec/check_iostat3.5配置nrpecd/usr/local/nagios/etcvinrpe.cfg+79加入可以监控本机的nagiosserver端IP,如下:allowed_hosts=17#注:如果机器大于500台做集群或分布式监控时,可以使用多个nagiosserver-,ip要用逗号隔开。#可用一条命令执行。↓#perl-pi-e's/allowed_hosts=/allowed_hosts=45/g'/usr/local/nagios/etc/nrpe.cfggrepallowed_host/usr/local/nagios/etc/nrpe.cfg更改nrpe配置文件信息。cd/usr/local/nagios/etcvinrpe.cfg(shift+g切换到结尾)#注释掉或者干脆删除199-203行,同时在下

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论