永发信息网

如何设置Nagios邮件报警

答案:1  悬赏:30  手机版
解决时间 2021-01-11 20:38
  • 提问者网友:别再叽里呱啦
  • 2021-01-11 06:41
如何设置Nagios邮件报警
最佳答案
  • 五星知识达人网友:一叶十三刺
  • 2021-01-11 07:10
一:环境准备
由于要搭建的nagios主机是一个裸机,所以搭建nagios监控系统前需要搭建一个简单的LAMP平台,
这里我就直接用yum安装了
yum -y install http* mysql* php-*
对于英语不好的我,每做完一步我就喜欢用echo $? 验证一下 看看返回值是不是0 如果是0说明操作正确,否则错误,这种方法对我很实用,谁让英语差呢!
[root@localhost ~]# service httpd start
启动 httpd: [确定]
[root@localhost ~]# chkconfig httpd on
[root@localhost ~]# vim /etc/httpd/conf/httpd.conf
231 User apache
232 Group apache
391 DirectoryIndex index.php index.html index.html.var
992 #setting for nagios
993 ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
994
995 AuthType Basic
996 Options ExecCGI
997 AllowOverride None
998 Order allow,deny
999 Allow from all
1000 AuthName "nagios access"
1001 AuthUserFile /usr/local/nagios/etc/htpasswd
1002 Require valid-user
1003
1004 Alias /nagios "/usr/local/nagios/share"
1005
1006 AuthType Basic
1007 Options ExecCGI
1008 AllowOverride None
1009 Order allow,deny
1010 Allow from all
1011 AuthName "nagios access"
1012 AuthUserFile /usr/local/nagios/etc/htpasswd
1013 Require valid-user
1014
创建apache目录的验证文件,mkdir -p /usr/local/nagios/etc/htpasswd
添加用户
[root@localhost ~]# htpasswd -c /usr/local/nagios/etc/htpasswd cainiao
二:nagios安装
(1)创建nagios程序用户、组
[root@localhost ~]# useradd -s /sbin/nologin nagios
[root@localhost ~]# mkdir /usr/local/nagios/
[root@localhost ~]# chown -R nagios:nagios /usr/local/nagios/
( 2) 安装和编译nagios
搭建nagios所需要的软件已经放在/nagios
[root@localhost nagios]# tar zxf nagios-3.2.0.tar.gz
[root@localhost nagios]# cd nagios-3.2.0
[root@localhost nagios-3.2.0]# ./configure --prefix=/usr/local/nagios/
[root@localhost nagios-3.2.0]# make all ; make install ; make install-init ; make install-commandmode ; make install-config
[root@localhost nagios-3.2.0]# chkconfig --add nagios
[root@localhost nagios-3.2.0]# chkconfig nagios on
(3)安装nagios插件
[root@localhost nagios]# tar zxf nagios-plugins-1.4.14.tar.gz
[root@localhost nagios]# cd nagios-plugins-1.4.14
[root@localhost nagios-plugins-1.4.14]# ./configure --prefix=/usr/local/nagios/ ; make ; make insta
(4)安装Nagios的汉化包
[root@localhost nagios]# tar jxf nagios-cn-3.2.0.tar.bz2
[root@localhost nagios]# cd nagios-cn-3.2.0
[root@localhost nagios-cn-3.2.0]# ./configure ; make all ; make install
接下来通过浏览器验证nagios是否安装成功
http:.//nagios的ip/nagios 这里就假如nagios的服务器的ip是:192.168.1.1
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯