欢迎来到天天文库
浏览记录
ID:60748177
大小:21.45 KB
页数:9页
时间:2020-12-13
《Nagios监控mysql的安装配置及报警.docx》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、一:Nagios的安装1.安装编译所需的软件包;[root@nagios~]#yum–yinstallhttpdphp-*gd-*mysql-devel[root@nagios~]#setenforce0#关闭selinux[root@nagios~]#sed 's/=enforcing/=permissive/' /etc/sysconfig/selinux2.创建运行nagios服务的用户;[root@nagios~]#useraddnagios#创建运行nagios服务的用户[root@nagios~]#usermod–Gnagi
2、osapache#使apache用户对nagios目录具有写权限,不然web页面操作失败3.Nagios软件安装;[root@nagios~]#tarzxfnagios-cn-3.2.3.tar.gz#释放nagios源码包[root@nagios~]#cdnagios-cn-3.2.3Ps:若在RHEL6X32位系统中安装nagios-cn-3.2.3.tar.bz2要先执行makeclean操作,然后再执行./configure和makeall等操作,否则执行makeall时会报错![root@nagiosnagios-cn-3.2
3、.3]#./configure--enable-embedded-perl#编译nagios[root@nagiosnagios-cn-3.2.3]#makeall[root@nagiosnagios-cn-3.2.3]#makeinstall#安装主程序,CGI和HTML文件[root@nagiosnagios-cn-3.2.3]#makeinstall-init#在/etc/rc.d/init.d安装启动脚本[root@nagiosnagios-cn-3.2.3]#makeinstall-commandmode#配置目录权限[roo
4、t@nagiosnagios-cn-3.2.3]#makeinstall-config#安装示例配置文件[root@nagiosnagios-cn-3.2.3]#makeinstall-webconf#安装nagios的web接口,会在/etc/httpd/conf.d目录中创建nagios.conf文件4.安装Nagios-plugins插件;[root@nagios~]#tarzxfnagios-plugins-1.4.15.tar.gz[root@nagios~]#cdnagios-plugins-1.4.15[root@nagi
5、osnagios-plugins-1.4.15]#./configure–with-nagios-user=nagios--with-nagios-group=nagios–enable-extra-opts--enable-libtap--enable-perl-modules[root@nagiosnagios-plugins-1.4.15]#make&&makeinstall(Ps:会在”/usr/local/nagios/libexec”目录下多出一些文件,这里存放nagios所有插件)5.修改nagios的主配置文件nag
6、ios.cfg;[root@nagios~]#vim/usr/local/nagios/etc/nagios.cfg新建cfg_file=/usr/local/nagios/etc/objects/hosts.cfg#存放主机与主机组定义cfg_file=/usr/local/nagios/etc/objects/services.cfg#存放服务与服务组定义修改#cfg_file=/usr/local/nagios/etc/objects/localhost.cfg#加”#”注释,在36行6.创建hosts.cfg文件;[root@n
7、agios~]#vim/usr/local/nagios/etc/objects/hosts.cfgdefinehost{uselinux-server#定义使用的模版host_namenagios#被监控主机名称aliasnagios#别名address127.0.0.1#被监控主机的IP地址icon_imageweb.gifstatusmap_imageweb.gd22d_coords100,3003d_coords100,300,100check_commandcheck-host-alive#监控命令,来自commands.cf
8、g文件max_check_attempts5#检查失败后重试的次数check_period24x7#查看的时间段,来自timeperiods.cfg定义contact_groupsadmins#联系人组,在
此文档下载收益归作者所有