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

ubuntu13 apt

[复制链接]

尚未签到

发表于 2019-1-14 14:10:45 | 显示全部楼层 |阅读模式
  参考文章:http://nagios-cn.sourceforge.net/nagios-cn/beginning.html#quickstart-ubuntu

  --快速安装nagios

  查看 nagios3的版本号
  apt-cache showpkg nagios3
  安装nagios
  apt-get install  nagios3
  会提示安装sendmail,然后提示你输入nagios的密码
  安装好后
  http://ip/nagios3/
  账户nagiosadmin
  密码安装时候输入的
  #配置文件位置
  /etc/nagios3
  ################常用命令#################
  php网页位置
/usr/share/nagios3/htdocs
图标位置
/usr/share/nagios/htdocs/images/logos/logos
配置文件位置
/etc/nagios3/

创建一个nagiosadmin的用户用于Nagios的WEB接口登录。记下你所设置的登录口令,一会儿你会用到它。

htpasswd -c /etc/nagios3/htpasswd.users nagiosadmin

重启Apache服务以使设置生效。

/etc/init.d/apache2 reload

验证Nagios的样例配置文件

/usr/sbin/nagios3 -v /etc/nagios3/nagios.cfg

如果没有报错,可以启动Nagios服务

/etc/init.d/nagios3 restart

#######################################

##                                  Nagios配置                                    ##

#######################################

#目录在/etc/nagios3/

#/etc/nagios3/conf.d

首先要修改的就是模版文件否则就会有问题

/etc/nagios3/conf.d 目录中

generic-host_nagios2.cfg        是主机模版

generic-service_nagios2.cfg    服务模版

hostgroups_nagios2.cfg         主机分组文件

timeperiods_nagios2.cfg         执行计划的时间

contacts_nagios2.cfg             联络方法

#--------------------------------------------------------------------------

#参考手册: http://nagios-cn.sourceforge.net/nagios-cn/beginning.html#quickstart-ubuntu

#然后我们加入自己的配置文件到里面 例如  switch.cfg 交换机的

#1.首先修改主机模版文件generic-host_nagios2.cfg  

#2.修改 服务模版generic-service_nagios2.cfg   
#3.修改switch.cfg文件

加入

#1. Define a template for switches that we can reuse(交换机的模版文件)
define host{
    name            generic-switch    ; The name of this host template
    use            generic-host    ; Inherit default values from the generic-host template
    check_period        24x7        ; By default, switches are monitored round the clock
    check_interval        5        ; Switches are checked every 5 minutes
    retry_interval        1        ; Schedule host check retries at 1 minute intervals
    max_check_attempts    10        ; Check each switch 10 times (max)
    check_command        check-host-alive    ; Default command to check if routers are "alive"
    notification_period    24x7        ; Send notifications at any time
    notification_interval    30        ; Resend notifications every 30 minutes
    notification_options    d,r        ; Only send notifications for specific host states
    contact_groups        admins        ; Notifications get sent to the admins by default
    register        0        ; DONT REGISTER THIS - ITS JUST A TEMPLATE
    }
#2.在 Create a service to PING to switch

define service{
    use            generic-service    ; Inherit values from a template
    hostgroup_name    switches ; The name of the hostgroup the service is associated with
    service_description    PING        ; The service description
    check_command        check_ping!200.0,20%!600.0,60%    ; The command used to monitor the service
    normal_check_interval    5        ; Check the service every 5 minutes under normal conditions
    retry_check_interval    1        ; Re-check the service every minute until its final/hard state is determined
    }

#在 3. switch.cfg 交换机的配置加入交换机



define host{
    use        generic-switch        ; Inherit default values from a template(使用模版并且使用默认值)
    host_name    4F-cisco-3560G        ; The name we're giving to this switch  (交换机名称)
  # parents        4f-FortiGate200B  ;定义上级节点        
    alias        cisco 3560G Switch    ; A longer name associated with the switch  (全名,别名)
    address        192.168.1.254        ; IP address of the switch   (IP 地址)
    icon_image       switch40.jpg  ;图标
    statusmap_image  cat2900.gd2   ;地图显示图标     
    hostgroups    switches        ; Host groups this switch is associated with  (主机加入的编组)
    }








#高级的大家自己玩,就是带大家入门,下一期入门一下cacti安装

#------------------------------windows主机监控

#1.

  define host{
    use        windows-server    ; Inherit default values from a template
    host_name    erp; The name we're giving to this host
    alias        HERP; A longer name associated with the host
    parents        4F-cisco-3560G  ;定义上级节点 影响显示地图
    address        192.168.1.8; IP address of the host
    icon_image       windows_server.jpg
    statusmap_image  win40.gd2   
    }
  #2.加入检测服务

  define service{
    use            generic-service
    hostgroup_name        erp
    service_description    NSClient++ Version
    check_command        check_nt!CLIENTVERSION
    }



# Create a service for monitoring the uptime of the server
# Change the host_name to match the name of the host you defined above
#检查开机时间
define service{
    use            generic-service
    hostgroup_name        erp
    service_description    Uptime
    check_command        check_nt!UPTIME
    }

# Create a service for monitoring CPU load
# Change the host_name to match the name of the host you defined above
#检查cpu平均5分钟负载,超过90%报警
define service{
    use            generic-service
    hostgroup_name        erp
    service_description    CPU Load
    check_command        check_nt!CPULOAD!-l 5,80,90
    }
# Create a service for monitoring memory usage
# Change the host_name to match the name of the host you defined above
#检查内存使用
define service{
    use            generic-service
    hostgroup_name       erp
    service_description    Memory Usage
    check_command        check_nt!MEMUSE!-w 80 -c 90
    }
# Create a service for monitoring C:\ disk usage
# Change the host_name to match the name of the host you defined above
#检查磁盘空间
define service{
    use            generic-service
    hostgroup_name        erp
    service_description    C:\ Drive Space
    check_command        check_nt!USEDDISKSPACE!-l c -w 80 -c 90
    }
define service{
    use            generic-service
    host_name        mail
    service_description    D:\ Drive Space
    check_command        check_nt!USEDDISKSPACE!-l d -w 80 -c 90
    }

# Create a service for monitoring the MSSQLSERVER service
# Change the host_name to match the name of the host you defined above
#检查一个服务 (数据库服务    )
define service{
    use            generic-service
    host_name        erp
    service_description    MSSQLSERVER
    check_command        check_nt!SERVICESTATE!-d SHOWALL -l MSSQLSERVER
    }  





运维网声明 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-663254-1-1.html 上篇帖子: CentOS 6.4安装Nagios 3.5.0 下篇帖子: ganglia整合nagios脚本
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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