Nagios监控-10.服务器端pnp安装图形监控曲线软件

画图软件安装
  • yum安装pnp软件需要的基础包

    yum install cairo pango zlib zlib-devel freetype freetype-devel gd gd-devel -y
    
  • 安装rrdtools的依赖
    yum安装

    yum install libart_lgpl libart_lgpl-devel -y
    

    编译安装

    cd ~/tools/
    wget http://ftp.gnome.org/pub/gnome/sources/libart_lgpl/2.3/libart_lgpl-2.3.17.tar.gz
    tar zxvf libart_lgpl-2.3.17.tar.gz 
    cd libart_lgpl-2.3.17
    ./configure 
    make
    make install
    /bin/cp -r /usr/local/include/libart-2.0/ /usr/include/
    
  • 安装rrdtools轮询的数据库,专门画图

    cd ~/tools/
    wget https://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.14.tar.gz
    tar zxvf rrdtool-1.2.14.tar.gz 
    cd rrdtool-1.2.14
    ./configure --prefix=/usr/local/rrdtool  --disable-python  --disable-tcl
    make
    make install
    ls -l /usr/local/rrdtool/bin
    

    在这里插入图片描述

  • 安装PNP
    pnp收集数据告诉rrdtools画图,PHP负责展示

    tar zxvf pnp-0.4.14.tar.gz 
    cd pnp-0.4.14
    ./configure --with-rrdtool=/usr/local/rrdtool/bin/rrdtool --with-perfdata-dir=/usr/local/nagios/share/perfdata/
    make all
    make install
    make install-config
    make install-init
    ll /usr/local/nagios/libexec/ |grep process
    

    在这里插入图片描述
    –with-rrdtool=/usr/local/rrdtool/bin/rrdtool 出图的命令
    –with-perfdata-dir=/usr/local/nagios/share/perfdata/ 出图所用的数据路径

    问题:configure报错
    checking for linker flags for loadable modules… -shared
    checking for Perl Module Time::HiRes… no
    configure: error: Perl Module Time::HiRes not available
    解决:
    yum install perl-Time-HiRes -y

nagios出图相关基本配置
  • 编辑nagios.cfg

     cp /usr/local/nagios/etc/nagios.cfg /usr/local/nagios/etc/nagios.cfg.ori   
     vim /usr/local/nagios/etc/nagios.cfg +835
    
    process_performance_data=1
    host_perfdata_command=process-host-perfdata
    service_perfdata_command=process-service-perfdata
    

    在这里插入图片描述

  • 编辑commands.cfg

     cp /usr/local/nagios/etc/objects/commands.cfg /usr/local/nagios/etc/objects/commands.cfg.ori
     vim /usr/local/nagios/etc/objects/commands.cfg +227
    

    删除原有的process-host-perfdata和process-service-perfdata命令定义

    # ‘process-host-perfdata’ command definition
    define command{
    command_name process-host-perfdata
    command_line /usr/bin/printf “%b” “$LASTHOSTCHECKKaTeX parse error: Undefined control sequence: \t at position 1: \̲t̲HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n” >> /usr/local/nagios/var/host-perfdata.out
    }
    # ‘process-service-perfdata’ command definition
    define command{
    command_name process-service-perfdata
    command_line /usr/bin/printf “%b” “$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n” >> /usr/local/nagios/var/service-perfdata.out
    }

    加入下面的命令定义

    # 'process-host-perfdata' command definition
    define command{
        command_name    process-host-perfdata
        command_line    $USER1$/process_perfdata.pl
        }
        
    # 'process-service-perfdata' command definition
    define command{
        command_name    process-service-perfdata
        command_line    $USER1$/process_perfdata.pl
        }
    
  • 检查语法与重启

    /etc/init.d/nagios checkconfig 
    /etc/init.d/nagios reload
    

    在这里插入图片描述

  • 查看是否配置完成

    http://192.168.47.156/nagios/pnp/index.php
    

    在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值