设为首页 收藏本站
查看: 898|回复: 0

Ubuntu配置nagios

[复制链接]
YunVN网友  发表于 2019-1-16 11:45:11 |阅读模式
  环境:Ubuntu11.04  VirtualBOX4.0.6r71344 Ubuntu10.10 Server   
要求:对网络内的二台DHCP服务器监测
  第一步:安装nagios3、apache2   
$sudo apt-get install apache2   
$sudo apt-get install nagios3          //nagios Version 3.2.1。
  第二步:安装过程中设置nagios3   
1、管理员警报邮箱设置(这次我直接选择 No configruation)   
No configuration:      
Should be chosen to leave the current configuration unchanged.      
Internet site:  
Mail is sent and received directly using SMTP.  
Internet with smarthost:      
Mail is received directly using SMTP or by running a utility such as fetchmail. Outgoing mail is sent using a smarthost.      
Satellite system:      
All mail is sent to another machine, called a 'smarthost', for delivery.      
Local only:      
  The only delivered mail is the mail for local users. There is no network.      
General type of mail configuration:      
No configuration      
Internet Site      
Internet with smarthost      
Satellite system      
Local only      
                                                                        

  2、nagios的web管理页用户认证要用的密码设置(上一步没有设置报警邮箱,所以直接到这一步)   
Please provide the password to be created with the "nagiosadmin" user.     
This is the username and password you will use to log in to your nagios installation after configuration is complete.  If you do not provide a password, you will have to configure access to nagios yourself.      
Nagios web administration password:  
输入后会要求再次确认密码,确认后回车   
在这里最好就创建了nagiosadmin的密码,要不然还要在后面创建,不过也不麻烦用下面的命令就可以了:   
htpasswd -C  /etc/nagios3/htpasswd.users nagiosadmin   
以后再添加用户就不用“-C”了   
例如:htpasswd /etc/nagios3/htpasswd.users test     
系统提示:   
New password:                         //输入新密码   
Re-type new password:          //确认密码  
Adding password for user test   
其实在这时在浏览器里输入http://localhost/nagios3/就可以看到nagios的管理页面了,当然里面还没有什么东西
  第三步:配置监测设备   
1、创建被监测设备的配置文件     
$sudo vim /etc/nagios3/conf.d/host.cfg     
#add dhcp server     
define host{      
        use                            generic-host      
        host_name               dhcp1      
        alias                           dhcp1      
        address                    192.168.0.1      
        }      
2、在主机定义模板里加入要监测的设备     
$sudo vim /etc/nagios3/conf.d/hostgroups_nagios2.cfg      
(紫色部分为后加的,绿色字为原有的)   
#check dhcp server runing     
define hostgroup{   
       hostgroup_name        dhcp-server   
       alias                               dhcp1     
       members                      dhcp1     
       }     
# A list of your web servers     
define hostgroup {      
        hostgroup_name  http-servers      
                alias           HTTP servers      
                members         localhost,dhcp1      
        }

  # A list of your ssh-accessible servers     
define hostgroup {      
        hostgroup_name  ssh-servers      
                alias           SSH servers      
                members         localhost,dhcp1      
        }

  3、定义要监测的主机的服务     
$sudo vim /etc/nagios3/conf.d/services_nagios2.cfg     
(因为在这两台DHCP上装有webmin,就对这个做个监测吧,紫色部分为后加的,绿色字为原有的)   
# check that web services are running     
define service {      
        hostgroup_name                  http-servers      
        service_description             HTTP      
        check_command                   check_http      
        use                             generic-service      
        notification_interval           0 ; set > 0 if you want to be renotified      
}

  # check that ssh services are running     
define service {      
        hostgroup_name                  ssh-servers      
        service_description             SSH      
        check_command                   check_ssh      
        use                             generic-service      
        notification_interval           0 ; set > 0 if you want to be renotified      
}      
# check that webmin services are running     
define service {      
        hostgroup_name               dhcp-server      
        service_description           webmin      
        check_command                check_tcp!10000!      
        use                                        generic-service      
        notification_interval           0 ; set > 0 if you want to be renotified      
}      
第四步:测试     
$sudo nagios3 –v /etc/nagios3/nagios.cfg     
系统提示:     
Total Warnings: 0      
Total Errors:   0      
这时再进入nagios的管理页面就可以看到相应的管理服务项目。到此对服务器的监控配置就完成了,下面就做对交换机的监控配置
  重启nagios   
$sudo /etc/init.d/nagios3 restart
  本来还要对交换机做个监测,但一直配置有问题,现在对交换机的ping是没有问题,但snmp和mrtg的出图一直有问题,先做个记录,下一步再做更新




运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-663966-1-1.html 上篇帖子: nagios 报错 下篇帖子: nagios3.2 安装笔记
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表