zoukankan      html  css  js  c++  java
  • collectd 单机器监控配置

      

    一、简述

      collectd可以手机服务器的日常信息,便于随时监控服务器性能

    二、collectd的下载与安装

       这里用yum进行安装

    #安装epel
    yum install epel-release
    #安装collectd
    yum install -y collectd
    #安装rrdtool插件及依赖包
    yum install collectd-rrdtool rrdtool rrdtool-devel

       更改collectd配置文件:vim /etc/collectd.conf  (find / -name collectd.conf 查找文件位置)

                FQDNLookup true
           Hostname "VM_0_13_centos" #直接使用ifconfig命令查看(安装collectd的地址) BaseDir "/var/lib/collectd" PIDFile "/var/run/collectd.pid" PluginDir "/usr/lib64/collectd" TypesDB "/usr/share/collectd/types.db" LoadPlugin syslog LoadPlugin rrdtool LoadPlugin disk LoadPlugin interface LoadPlugin load LoadPlugin memory LoadPlugin network LoadPlugin processes LoadPlugin users
           <Plugin interface>
              Interface "eth0" #用ifconfig查看Interface对应名称
              IgnoreSelected false
           </Plugin>
    <Plugin network> Server "127.0.0.1" "25826" #这里填写的是influxDB安装的服务器ip
           </Plugin>

           <Plugin rrdtool>
                DataDir "/usr/var/lib/collectd/rrd" #如果你是使用下载安装前面应该会多出一个${prefix},未尝试是否有影响
           </Plugin>
           <Plugin cpu>

                        ReportByCpu true

                        ReportByState true

                        ValuesPercentage true   此处启用cpu的使用率,5.7.*以上才有,低版本的不支持百分百

                </Plugin>

          <Plugin load>
                ReportRelative true
          </Plugin>

          #日志部分 可选

          #打开日志,并配置日志级别和路径等属性

          LoadPlugin logfile
          <Plugin logfile>
                LogLevel info
                File "/var/log/collectd.log"
          </Plugin>

          #重启collectd,在/var/log/collectd.log中可看到日志

    启动collectd

    #启动
    systemctl start collectd.service
    #配置开机自启
    systemctl enable collectd.service
    #重启
    systemctl restart collectd.service
     

    确认配置是否成功

    [root@instance-arkj4je3 ~]# cd /var/lib/collectd
    [root@instance-arkj4je3 collectd]# ls
    rrd

     如果/var/lib/collectd目录下生成rrd文件,说明有数据了

     

     

     

  • 相关阅读:
    使用dbghelp生成dump文件以及事后调试分析
    Explain of Interaction Operators in UML?
    注册字体
    并发处理的5中模式
    Introduction to Parallel Computing
    Mac 下 PostgreSQL 的安装与使用
    struts配置请求后缀,将.action改为.do、.doaction_2015.01.04
    通过struts.xml搭建、为属性注入值_2015.01.04
    JSP 中 forward 和 redirect 的区别_2014.12.31
    Struts2的Action名称搜索顺序:2014.12.30
  • 原文地址:https://www.cnblogs.com/bluesky-yuan/p/14832641.html
Copyright © 2011-2022 走看看