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

nagios 图形化界面之三 (nagiosgraph)

[复制链接]

尚未签到

发表于 2019-1-14 12:08:02 | 显示全部楼层 |阅读模式
      如今,监控系统是琳琅满目,有NagiosCactiZabbixCentreonMunin等,也有系统集成如FAN等。个人在经过不同监控的安装测试后,还是比较倾向于Nagios的监控,简单命令;而且结合nagios和pnp4nagios等插件可以实现图表的功能。
       NagiosNagiosgraph 使用的是RRDtool工具来实现画图的。
  

  1:安装依赖
               (1) .  rrdtool  安装rrdtool-1.4.5.tar.gz
               (2) .  GD的perl模块
                          
            GD模块依赖于gd-devel等开发包。
  

  2:  解压安装nagiosgraph-1.4.4.tar.gz
              tar  zxvf nagiosgraph-1.4.4.tar.gz
              cd   nagiosgraph-1.4.4
          以下都是在nagiosgraph-1.4.4目录下完成的,安装前检测安装环境
  
  [root@localhostnagiosgraph-1.4.4]# perl install.pl--check-prereq
  checking required PERL modules
  Carp...1.20
  CGI... ***FAIL***
  Data::Dumper...2.130_02
  File::Basename...2.82
  File::Find...1.19
  MIME::Base64...3.13
  POSIX...1.24
  RRDs...1.4004
  Time::HiRes...1.972101
  checking optional PERL modules
  GD...***FAIL***
  checking nagios installation
  found nagios at /usr/local/nagios/bin/nagios
  checking web server installation
  found apache at /usr/sbin/httpd
  

  *** one or more problems were detected!
  以上是我的结果,错误是perlcgi模块没有安装
  使用yum 安装,如下
  yum install perl-CGI
  重新检验
  perl install.pl --check-prereq
结果就正确了  

  安装
  perl install.pl//安装命令
  出现的结果如下,注意后面最好不要一路回车,自己多注意一下都是什么要求
  
  checking required PERL modules
  Carp...1.20
  CGI...3.52
  Data::Dumper...2.130_02
  File::Basename...2.82
  File::Find...1.19
  MIME::Base64...3.13
  POSIX...1.24
  RRDs...1.4004
  Time::HiRes...1.972101
  checking optional PERL modules
  GD...2.44
  checking nagios installation
  found nagios at /usr/local/nagios/bin/nagios
  checking web server installation
  found apache at /usr/sbin/httpd
  Destination directory (prefix)?[/usr/local/nagiosgraph] /usr/local/nagios/nagiosgraph//此处是nagiosgraph的目录,这个可以自己选择一下
  Location of configuration files (etc-dir)?[/usr/local/nagios/nagiosgraph/etc]
  Location of executables?[/usr/local/nagios/nagiosgraph/bin]
  Location of CGI scripts?[/usr/local/nagios/nagiosgraph/cgi]
  Location of documentation (doc-dir)?[/usr/local/nagios/nagiosgraph/doc]
  Location of examples?[/usr/local/nagios/nagiosgraph/examples]
  Location of CSS and JavaScript files?[/usr/local/nagios/nagiosgraph/share]
  Location of utilities?[/usr/local/nagios/nagiosgraph/util]
  Location of state files (var-dir)?[/usr/local/nagios/nagiosgraph/var]
  Location of RRD files?[/usr/local/nagios/nagiosgraph/var/rrd]
  Location of log files (log-dir)?[/usr/local/nagios/nagiosgraph/var]
  Path of log file?[/usr/local/nagios/nagiosgraph/var/nagiosgraph.log]
  Path of CGI log file?[/usr/local/nagios/nagiosgraph/var/nagiosgraph-cgi.log]
  URL of CGI scripts? [/nagiosgraph/cgi-bin]
  URL of CSS file?[/nagiosgraph/nagiosgraph.css]
  URL of JavaScript file?[/nagiosgraph/nagiosgraph.js]
  Path of Nagios performance data file?[/tmp/perfdata.log]
  URL of Nagios CGI scripts?[/nagios/cgi-bin]
  username or userid of Nagios user? [nagios]//此处注意你选择的用户
  username or userid of web server user? [apache]nagios////此处注意你选择的用户
  

  Modify the Nagios configuration? [n]
  Modify the Apache configuration? [n]
  configuration:
  ng_layoutstandalone
  ng_prefix/usr/local/nagios/nagiosgraph
  ng_etc_dir/usr/local/nagios/nagiosgraph/etc
  ng_bin_dir/usr/local/nagios/nagiosgraph/bin
  ng_cgi_dir/usr/local/nagios/nagiosgraph/cgi
  ng_doc_dir/usr/local/nagios/nagiosgraph/doc
  ng_examples_dir/usr/local/nagios/nagiosgraph/examples
  ng_www_dir/usr/local/nagios/nagiosgraph/share
  ng_util_dir/usr/local/nagios/nagiosgraph/util
  ng_var_dir/usr/local/nagios/nagiosgraph/var
  ng_rrd_dir/usr/local/nagios/nagiosgraph/var/rrd
  ng_log_dir/usr/local/nagios/nagiosgraph/var
  ng_log_file/usr/local/nagios/nagiosgraph/var/nagiosgraph.log
  ng_cgilog_file/usr/local/nagios/nagiosgraph/var/nagiosgraph-cgi.log
  ng_url/nagiosgraph
  ng_cgi_url/nagiosgraph/cgi-bin
  ng_css_url/nagiosgraph/nagiosgraph.css
  ng_js_url/nagiosgraph/nagiosgraph.js
  nagios_cgi_url/nagios/cgi-bin
  nagios_perfdata_file /tmp/perfdata.log
  nagios_usernagios
  www_usernagios
  modify_nagios_config n
  nagios_config_file
  nagios_commands_file
  modify_apache_config n
  apache_config_dir
  apache_config_file
  Continue with this configuration? [y]
  mkdir /usr/local/nagios/nagiosgraph
  mkdir /usr/local/nagios/nagiosgraph/etc
  copy etc/nagiosgraph.conf to/usr/local/nagios/nagiosgraph/etc/nagiosgraph.conf
  copy etc/access.conf to/usr/local/nagios/nagiosgraph/etc/access.conf
  copy etc/nagiosgraph_fr.conf to/usr/local/nagios/nagiosgraph/etc/nagiosgraph_fr.conf
  copy etc/servdb.conf to/usr/local/nagios/nagiosgraph/etc/servdb.conf
  copy etc/nagiosgraph_es.conf to/usr/local/nagios/nagiosgraph/etc/nagiosgraph_es.conf
  copy etc/hostdb.conf to/usr/local/nagios/nagiosgraph/etc/hostdb.conf
  copy etc/groupdb.conf to/usr/local/nagios/nagiosgraph/etc/groupdb.conf
  copy etc/nagiosgraph_de.conf to/usr/local/nagios/nagiosgraph/etc/nagiosgraph_de.conf
  copy etc/datasetdb.conf to/usr/local/nagios/nagiosgraph/etc/datasetdb.conf
  copy etc/labels.conf to/usr/local/nagios/nagiosgraph/etc/labels.conf
  copy etc/rrdopts.conf to/usr/local/nagios/nagiosgraph/etc/rrdopts.conf
  copy etc/map to/usr/local/nagios/nagiosgraph/etc/map
  copy etc/ngshared.pm to/usr/local/nagios/nagiosgraph/etc
  replace text in/usr/local/nagios/nagiosgraph/etc/nagiosgraph.conf
  move/usr/local/nagios/nagiosgraph/etc/nagiosgraph.conf-bak to/usr/local/nagios/nagiosgraph/etc/nagiosgraph.conf
  replace text in/usr/local/nagios/nagiosgraph/etc/nagiosgraph.conf
  move/usr/local/nagios/nagiosgraph/etc/nagiosgraph.conf-bak to /usr/local/nagios/nagiosgraph/etc/nagiosgraph.conf
  write stub to/usr/local/nagios/nagiosgraph/etc/nagiosgraph-nagios.cfg
  write stub to/usr/local/nagios/nagiosgraph/etc/nagiosgraph-commands.cfg
  write stub to/usr/local/nagios/nagiosgraph/etc/nagiosgraph-apache.conf
  mkdir /usr/local/nagios/nagiosgraph/cgi
  copy cgi/showhost.cgi to/usr/local/nagios/nagiosgraph/cgi
  replace text in/usr/local/nagios/nagiosgraph/cgi/showhost.cgi
  move/usr/local/nagios/nagiosgraph/cgi/showhost.cgi-bak to/usr/local/nagios/nagiosgraph/cgi/showhost.cgi
  chmod 755 on/usr/local/nagios/nagiosgraph/cgi/showhost.cgi
  copy cgi/showgroup.cgi to/usr/local/nagios/nagiosgraph/cgi
  replace text in/usr/local/nagios/nagiosgraph/cgi/showgroup.cgi
  move/usr/local/nagios/nagiosgraph/cgi/showgroup.cgi-bak to /usr/local/nagios/nagiosgraph/cgi/showgroup.cgi
  chmod 755 on/usr/local/nagios/nagiosgraph/cgi/showgroup.cgi
  copy cgi/testcolor.cgi to/usr/local/nagios/nagiosgraph/cgi
  replace text in/usr/local/nagios/nagiosgraph/cgi/testcolor.cgi
  move /usr/local/nagios/nagiosgraph/cgi/testcolor.cgi-bakto /usr/local/nagios/nagiosgraph/cgi/testcolor.cgi
  chmod 755 on/usr/local/nagios/nagiosgraph/cgi/testcolor.cgi
  copy cgi/showconfig.cgi to/usr/local/nagios/nagiosgraph/cgi
  replace text in/usr/local/nagios/nagiosgraph/cgi/showconfig.cgi
  move/usr/local/nagios/nagiosgraph/cgi/showconfig.cgi-bak to/usr/local/nagios/nagiosgraph/cgi/showconfig.cgi
  chmod 755 on/usr/local/nagios/nagiosgraph/cgi/showconfig.cgi
  copy cgi/show.cgi to/usr/local/nagios/nagiosgraph/cgi
  replace text in/usr/local/nagios/nagiosgraph/cgi/show.cgi
  move/usr/local/nagios/nagiosgraph/cgi/show.cgi-bak to/usr/local/nagios/nagiosgraph/cgi/show.cgi
  chmod 755 on/usr/local/nagios/nagiosgraph/cgi/show.cgi
  copy cgi/showgraph.cgi to/usr/local/nagios/nagiosgraph/cgi
  replace text in/usr/local/nagios/nagiosgraph/cgi/showgraph.cgi
  move/usr/local/nagios/nagiosgraph/cgi/showgraph.cgi-bak to/usr/local/nagios/nagiosgraph/cgi/showgraph.cgi
  chmod 755 on/usr/local/nagios/nagiosgraph/cgi/showgraph.cgi
  copy cgi/showservice.cgi to/usr/local/nagios/nagiosgraph/cgi
  replace text in/usr/local/nagios/nagiosgraph/cgi/showservice.cgi
  move/usr/local/nagios/nagiosgraph/cgi/showservice.cgi-bak to/usr/local/nagios/nagiosgraph/cgi/showservice.cgi
  chmod 755 on /usr/local/nagios/nagiosgraph/cgi/showservice.cgi
  mkdir /usr/local/nagios/nagiosgraph/bin
  copy lib/insert.pl to/usr/local/nagios/nagiosgraph/bin
  replace text in/usr/local/nagios/nagiosgraph/bin/insert.pl
  move/usr/local/nagios/nagiosgraph/bin/insert.pl-bak to/usr/local/nagios/nagiosgraph/bin/insert.pl
  chmod 755 on/usr/local/nagios/nagiosgraph/bin/insert.pl
  mkdir /usr/local/nagios/nagiosgraph/share
  copy share/nagiosgraph.css to/usr/local/nagios/nagiosgraph/share/nagiosgraph.css
  copy share/nagiosgraph.js to/usr/local/nagios/nagiosgraph/share
  mkdir /usr/local/nagios/nagiosgraph/doc
  copy AUTHORS to/usr/local/nagios/nagiosgraph/doc
  copy CHANGELOG to/usr/local/nagios/nagiosgraph/doc
  copy INSTALL to/usr/local/nagios/nagiosgraph/doc
  copy README to /usr/local/nagios/nagiosgraph/doc
  copy TODO to/usr/local/nagios/nagiosgraph/doc
  mkdir/usr/local/nagios/nagiosgraph/examples
  copy examples/map_1_3 to/usr/local/nagios/nagiosgraph/examples
  copy examples/nagiosgraph.1.css to/usr/local/nagios/nagiosgraph/examples
  copy examples/nagiosgraph.2.css to/usr/local/nagios/nagiosgraph/examples
  copy examples/nagiosgraph-logrotate to/usr/local/nagios/nagiosgraph/examples
  copy examples/nagiosgraph-commands.cfg to/usr/local/nagios/nagiosgraph/examples
  copy examples/map_1_4_4 to/usr/local/nagios/nagiosgraph/examples
  copy examples/map_examples to/usr/local/nagios/nagiosgraph/examples
  copy examples/map_mwall to/usr/local/nagios/nagiosgraph/examples
  copy examples/map_1_4_3 to/usr/local/nagios/nagiosgraph/examples
  copy examples/map_minimal to/usr/local/nagios/nagiosgraph/examples
  copy examples/nagiosgraph-nagios.cfg to/usr/local/nagios/nagiosgraph/examples
  copy examples/nagiosgraph-apache.conf to/usr/local/nagios/nagiosgraph/examples
  copy share/graph.gif to /usr/local/nagios/nagiosgraph/examples
  copy share/nagiosgraph.ssi to/usr/local/nagios/nagiosgraph/examples
  mkdir /usr/local/nagios/nagiosgraph/util
  copy utils/testentry.pl to/usr/local/nagios/nagiosgraph/util
  copy utils/upgrade.pl to/usr/local/nagios/nagiosgraph/util
  chmod 755 on/usr/local/nagios/nagiosgraph/util/testentry.pl
  chmod 755 on/usr/local/nagios/nagiosgraph/util/upgrade.pl
  mkdir /usr/local/nagios/nagiosgraph/var/rrd
  chmod 755 on/usr/local/nagios/nagiosgraph/var/rrd
  chown nagios,- on /usr/local/nagios/nagiosgraph/var/rrd
  touching/usr/local/nagios/nagiosgraph/var/nagiosgraph.log
  chmod 644 on/usr/local/nagios/nagiosgraph/var/nagiosgraph.log
  chown nagios,- on/usr/local/nagios/nagiosgraph/var/nagiosgraph.log
  touching /usr/local/nagios/nagiosgraph/var/nagiosgraph-cgi.log
  chmod 644 on/usr/local/nagios/nagiosgraph/var/nagiosgraph-cgi.log
  chown nagios,- on/usr/local/nagios/nagiosgraph/var/nagiosgraph-cgi.log
  

  

  To complete theinstallation, do the following:
  

  * In the nagios configuration file (e.g.nagios.cfg),
  add these lines:
  

  # process nagiosperformance data using nagiosgraph
  process_performance_data=1
  service_perfdata_file=/tmp/perfdata.log
  service_perfdata_file_template=$LASTSERVICECHECK$||$HOSTNAME$||$SERVICEDESC$||$SERVICEOUTPUT$||$SERVICEPERFDATA$
  service_perfdata_file_mode=a
  service_perfdata_file_processing_interval=30
  service_perfdata_file_processing_command=process-service-perfdata-for-nagiosgraph
  * In the nagios commands file (e.g.command.cfg),
  add these lines:
  

  # command to processnagios performance data for nagiosgraph
  define command {
  command_nameprocess-service-perfdata-for-nagiosgraph
  command_line/usr/local/nagios/nagiosgraph/bin/insert.pl
  }
  * In the apache configuration file (e.g.httpd.conf),
  add this line:
  

  include/usr/local/nagios/nagiosgraph/etc/nagiosgraph-apache.conf
  * Restart nagios to start data collection:
  

  /etc/init.d/nagiosrestart
  * Restart apache to enable display of graphs:
  

  /etc/init.d/apacherestart
  

  * To enable graph links and mouseovers, seeREADME sections:
  Displaying Per-Service and Per-HostGraph Icons and Links
  Displaying Graphs in Nagios Mouseovers
  注意最后出现的这几行,这是对于以后nagiosgraph的配置信息
     (1):在nagios的配置文件(nagios.cfg)中加入以下几行
  

  
  # process nagiosperformance data using nagiosgraph
  process_performance_data=1
  service_perfdata_file=/tmp/perfdata.log
  service_perfdata_file_template=$LASTSERVICECHECK$||$HOSTNAME$||$SERVICEDESC$||$SERVICEOUTPUT$||$SERVICEPERFDATA$
  service_perfdata_file_mode=a
  service_perfdata_file_processing_interval=30
  service_perfdata_file_processing_command=process-service-perfdata-for-nagiosgraph
  
  

    (2):在nagios命令文件(command.cfg)中加入以下几行
  

  
  # command to processnagios performance data for nagiosgraph
  define command {
  command_nameprocess-service-perfdata-for-nagiosgraph
  command_line/usr/local/nagios/nagiosgraph/bin/insert.pl
  }
  
  

     (3):在apache配置文件httpd.conf中加入
  include/usr/local/nagios/nagiosgraph/etc/nagiosgraph-apache.conf
  注意include第一个字母大写
  

     (4):重启nagiohttpd后登录nagiosgraph
  http://localhost/nagiosgraph/cgi-bin/show.cgi
  出现以下结果

  可以先选择host然后点击update graphs 然后,在左上角再点击data for host……中的主机名称就可以了
    (5)把nagiosgraph路径加到nagios系统内
  
/usr/local/nagios/share/side.php加入如下内容Nagiosgraph">Graphs">Graphs by Host">Graphs by Service">Graphs by Group  
  

  

  其实就是nagiosweb 界面的reports栏加入了trends如下

  

  





运维网声明 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-663177-1-1.html 上篇帖子: nagios 图形化界面之一 (pnp) 下篇帖子: Centos 6.3编译安装nagios
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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