阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Nagios插件Nagiosgraph安装部署

161次阅读
没有评论

共计 4102 个字符,预计需要花费 11 分钟才能阅读完成。

Nagios 是比较常用的一款开源监控软件,Nagios 灵活轻便使得在使用时可以根据自己的实际情况灵活运用,但是 Nagios 有一个缺点是对绘图做的不够完善,所以在对监控数据用来做分析时 Nagios 就有短板了。不过因为 Nagios 的灵活所以 Nagios 可以借助其他的方式实现图形报表的展示,今天在此就简要的说一说官方的 Nagiosgraph 插件,Nagiosgraph 插件是用过 Perl 来实现的,所以在使用用 Nagiosgraph 插件时就要确保系统中安装了 Perl 以及配置好相应的 cpan 源,这样才能进行安装,至于 cpan 的源配置以前有提及过,这里就不做说明,需要可以参看:http://www.linuxidc.com/Linux/2017-02/140236.htm。Nagiosgraph 插件的官方下载地址:https://sourceforge.net/projects/nagiosgraph/files/,建议下载最新稳定版,安装部署前需要先检查系统中是否有安装插件所需的依赖包:

[root@localhost nagiosgraph-1.5.2]# perl install.pl –check-prereq# 像这样就是所有的插件都有安装了
checking required PERL modules
  Carp…1.11
  CGI…3.51
  Data::Dumper…2.124
  Digest::MD5…2.39
  File::Basename…2.77
  File::Find…1.14
  MIME::Base64…3.08
  POSIX…1.17
  RRDs…1.3008
  Time::HiRes…1.9721
checking optional PERL modules
  GD…2.44
  Nagios::Config…36
checking nagios installation
  found nagios exectuable at /usr/local/nagios/bin/nagios
  found nagios init script at /etc/init.d/nagios
checking web server installation
  found apache executable at /usr/sbin/httpd
  found apache init script at /etc/init.d/httpd

如果找到那一没有安装就安装下,建议在配置好 yum 源或者是 apt 源后进行安装如 GD 绘图安装:
[root@localhost nagiosgraph-1.5.2]# yum -y install perl-GD

这里一般都会缺少安装 Perl 下的 Nagios::Config 模块,在配置好 cpan 源后使用 cpan 安装
[root@localhost nagiosgraph-1.5.2]# cpan Nagios::Config# 注意有的时候还会缺少 Digest::MD5 模块等同理依次安装即可

在解决所有的依赖关系后就可以开始安装配置,在安装时会有提示默认选项直接按回车就进行下一步

[root@localhost nagiosgraph-1.5.2]# perl install.pl

在安装好后需要注意,最后会有提示需要在 Nagios 中做一些配置更改配置及操作方法,如:
# process nagios performance 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
# 修改 Nagios 的配置文件,在 nagios.cfg 添加
 
/bin/systemctl restart  httpd.service 
 
 
  * In the nagios commands file (command.cfg),
    add these lines:
 
# command to process nagios performance data for nagiosgraph
define command {
  command_name process-service-perfdata-for-nagiosgraph
  command_line /usr/local/nagiosgraph/bin/insert.pl
}
# 添加修改 command.cfg 配置文件
 
  * In the apache configuration file (httpd.conf),
    add this line:
 
Include /usr/local/nagiosgraph/etc/nagiosgraph-apache.conf
# 在 Nagios 的用的 httpd 配置文件中添加 nagiosgraph 的包含
  * Check the nagios configuration:
 
/usr/local/nagios/bin/nagios -v /path/to/nagios.cfg
 
  * Restart nagios to start data collection:
 
/etc/init.d/nagios restart
 
  * Restart apache to enable display of graphs:
 
/etc/init.d/httpd restart
# 最后在多项检查重启后完成配置
  * To enable graph links and mouseovers, see README sections:
      Displaying Per-Service and Per-Host Graph Icons and Links
      Displaying Graphs in Nagios Mouseovers

同 Nagios 一样打开页面配置检查页面:http://IP/nagiosgraph/cgi-bin/showconfig.cgi

Nagios 插件 Nagiosgraph 安装部署

确认没有问题后再到 Nagios 的 share 文件夹下修改 Nagios 的 php 页面文件 side.php 添加 Nagiosgraph 的链接制作伪静态页:

<?php $nagiosgraph_path = ‘/nagiosgraph/cgi-bin’;?>
<li><a >Nagios 图表 </a></li>
 
<ul>
 
<li><a href=”https://www.linuxidc.com/Linux/2017-08/<?php echo $nagiosgraph_path;?>/show.cgi” target=”<?php echo $link_target;?>”> 图表 </a></li>
<li><a href=”https://www.linuxidc.com/Linux/2017-08/<?php echo $nagiosgraph_path;?>/showhost.cgi” target=”<?php echo $link_target;?>”> 主机图表 </a></li>
<li><a href=”https://www.linuxidc.com/Linux/2017-08/<?php echo $nagiosgraph_path;?>/showservice.cgi” target=”<?php echo $link_target;?>”> 服务图表 </a></li>
<li><a href=”https://www.linuxidc.com/Linux/2017-08/<?php echo $nagiosgraph_path;?>/showgroup.cgi” target=”<?php echo $link_target;?>”> 主机组图表 </a></li>
 
</ul>
</li>

最后在 Nagios 的页面下就有 Nagiosgraph 的图表链接

Nagios 插件 Nagiosgraph 安装部署

Nagios 插件 Nagiosgraph 安装部署

根据要选定的主机和服务生成图表,总之 Nagiosgraph 的配置是依赖于 Perl 配置起来还是比较简单的,但是生成的图表并不是非常的完美,不过也能满足日常的一些简单的分析,但是如果需要更好可以借助替他软件或插件实现,Nagios 的图表展示。

CentOS 7 下安装配置 Nagios 监控图文详解  http://www.linuxidc.com/Linux/2017-05/143886.htm

Nagios 邮件报警配置简述  http://www.linuxidc.com/Linux/2017-02/140834.htm

Nagios 本机及其他主机监控安装部署详解  http://www.linuxidc.com/Linux/2017-03/141600.htm

Nagios 系统监控基本安装配置过程详解  http://www.linuxidc.com/Linux/2017-01/139758.htm

Linux 下 Nagios+PNP4Nagios 的安装与配置  http://www.linuxidc.com/Linux/2016-09/135534.htm

CentOS7 安装 Nagios 并配置出图详解  http://www.linuxidc.com/Linux/2015-12/125777.htm

Linux 下 Nagios 安装配置详解  http://www.linuxidc.com/Linux/2017-05/144032.htm

Nagios 的详细介绍 :请点这里
Nagios 的下载地址 :请点这里

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2017-08/146258.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计4102字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中