AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[collectd](server)

Martin Hope
NikolaS
Asked: 2020-09-20 08:43:19 +0800 CST

启动collectd.service时如何解决“活动:激活(自动重启)”?

  • 0

我在通过命令安装的 Fedora 31 64 位操作系统中启动collectd.serivce时遇到问题。sudo dnf install collectd当我输入时,sudo systemctl status collectd.service我得到以下输出:

    ● collectd.service - statistics collection daemon
       Loaded: loaded (/etc/systemd/system/collectd.service; enabled; vendor preset: disabled)
       Active: activating (auto-restart) since Sat 2020-09-19 18:18:47 CEST; 3s ago
         Docs: man:collectd(1)
      Process: 3796 ExecStart=/usr/sbin/collectd (code=exited, status=0/SUCCESS)
     Main PID: 3796 (code=exited, status=0/SUCCESS)
          CPU: 7ms

顺便说一句,我不得不手动创建collectd.service位于/etc/systemd/system/目录中的文件。真正奇怪的是我在上述输出中不断收到激活(自动重启) 状态=0/成功。我还按相应的顺序执行了以下命令:

  1. sudo systemctl daemon-reload
  2. sudo systemctl stop collectd.service
  3. sudo systemctl start collectd.service

...但没有任何改变,我已经尝试重新启动计算机并执行所有提到的 1)-3) 步骤,但没有任何帮助。顺便说一句,这是我的collectd.service:

[Unit]
Description=statistics collection daemon
Documentation=man:collectd(1)
After=local-fs.target network.target
Requires=local-fs.target network.target

[Service]
ExecStart=/usr/sbin/collectd
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog

[Install]
WantedBy=multi-user.target

这是我的/etc/collectd.conf文件的样子:

#
# Config file for collectd(1).
# Please read collectd.conf(5) for a list of options.
# http://collectd.org/
#

##############################################################################
# Global                                                                     #
#----------------------------------------------------------------------------#
# Global settings for the daemon.                                            #
##############################################################################

#Hostname    "localhost"
FQDNLookup   true
#BaseDir     "/var/lib/collectd"
#PIDFile     "/var/run/collectd.pid"
PluginDir   "/usr/lib64/collectd"
TypesDB     "/usr/share/collectd/types.db"

LoadPlugin cpu

<Plugin cpu>
  ReportByCpu false
  ReportByState false
#  Interval 1
  ValuesPercentage true
#  ReportNumCpu false
#  ReportGuestState false
#  SubtractGuestState true
</Plugin>

<Plugin memory>
        ValuesAbsolute false
        ValuesPercentage true
</Plugin>

Include "/etc/collectd.d"
LoadPlugin syslog
LoadPlugin logfile
#LoadPlugin log_logstash

<Plugin logfile>
        LogLevel info
        File "/var/log/error_syslog"
        Timestamp true
#       PrintSeverity false
</Plugin>

#<Plugin log_logstash>
#       LogLevel info
#       File "/var/log/collectd.json.log"
#</Plugin>

<Plugin syslog>
        LogLevel info
</Plugin>
Include "/etc/collectd.d"

更新1:

这是我得到的日志文件(在文件中设置)的输出:/var/log/error_syslogcollectd.conf

[2020-09-20 11:04:25] plugin_dispatch_values: No write callback has been registered. Please load at least one output plugin, if you want the collected data to be stored.
[2020-09-20 11:04:25] Filter subsystem: Built-in target `write': Dispatching value to all write plugins failed with status 2 (ENOENT). Most likely this means you didn't load any write plugins.
[2020-09-20 11:04:25] Available write targets:: [none]
[2020-09-20 11:04:25] Available write targets:: [none]
[2020-09-20 11:04:25] Available write targets:: [none]
[2020-09-20 11:04:25] Available write targets:: [none]
[2020-09-20 11:04:25] Available write targets:: [none]
[2020-09-20 11:04:25] Available write targets:: [none]
[2020-09-20 11:04:25] collectd: Stopping 5 write threads.
[2020-09-20 11:04:35] plugin_load: plugin "cpu" successfully loaded.
[2020-09-20 11:04:35] plugin_load: plugin "memory" successfully loaded.
[2020-09-20 11:04:35] Initialization complete, entering read-loop.
[2020-09-20 11:04:35] Exiting normally.
[2020-09-20 11:04:35] plugin_dispatch_values: No write callback has been registered. Please load at least one output plugin, if you want the collected data to be stored.
[2020-09-20 11:04:35] collectd: Stopping 5 read threads.
[2020-09-20 11:04:35] Filter subsystem: Built-in target `write': Dispatching value to all write plugins failed with status 2 (ENOENT). Most likely this means you didn't load any write plugins.
[2020-09-20 11:04:35] Available write targets:: [none]
[2020-09-20 11:04:35] Available write targets:: [none]
[2020-09-20 11:04:35] Available write targets:: [none]
[2020-09-20 11:04:35] Available write targets:: [none]
[2020-09-20 11:04:35] Available write targets:: [none]
[2020-09-20 11:04:35] Available write targets:: [none]
[2020-09-20 11:04:35] collectd: Stopping 5 write threads.

非常感谢任何建议/指出我如何解决这个问题的正确方向。

bash fedora systemd collectd
  • 1 个回答
  • 8545 Views
Martin Hope
Krzysztofa Krzysztof
Asked: 2017-08-08 05:47:37 +0800 CST

Docker:Collectd 不在实例之间进行通信

  • 3

我在 docker 容器中启动了一个服务器实例,与 Facette 前端连接,看起来很酷,facette 读取 rrd 数据。

当我想从其他计算机接收数据时,问题就开始了。我在本地尝试了从 docker 到本地机器的暴露端口。

version: '2.1'
services:
collectd:
    build: ./containers/collectd
    ports:
        - 28596:28596
        - 8125:8125
    volumes:
        - ./var/rrd/:/var/lib/collectd/rrd

frontend:
    build: ./containers/facette
    ports:
        - 12003:12003
    volumes:
        - ./var/rrd:/var/lib/collectd/rrd
        - ./var/facette:/var/lib/facette/

服务器的 Dockerfile:

FROM alpine:latest
ENV ARCH=x86

RUN apk --update add perl-dev python3-dev wget alpine-sdk linux-headers rsyslog rrdtool rrdtool-dev rrdtool-utils

# Get and untar sources files
RUN wget https://collectd.org/files/collectd-5.7.1.tar.bz2
RUN tar jxvf collectd-5.7.1.tar.bz2 && rm collectd-5.7.1.tar.bz2

# Compile and purge source files
RUN cd collectd-5.7.1 && ./configure --with-rrdtool && make all install
RUN cd .. && rm -rf collectd-5.7.1

# Optionnal post installation tasks
RUN ln -s /opt/collectd/sbin/collectd /usr/sbin/collectd
RUN ln -s /opt/collectd/sbin/collectdmon /usr/sbin/collectdmon

RUN rm -rf /var/cache/apk/*
RUN apk del alpine-sdk linux-headers perl-dev python3-dev

#RUN apk add --update collectd rrdtool rsyslog collectd-dns collectd-curl collectd-sensors collectd-ping collectd-utils collectd-nginx collectd-iptables collectd-bind collectd-write_http collectd-rrdtool collectd-network collectd-disk collectd-libs
ADD ./etc/* /etc/ 
ADD ./entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]

服务器的collectd.conf

Hostname "bakunin-tower"
FQDNLookup true
LoadPlugin syslog

<plugin syslog>
    LogLevel info
    File "/var/log/collectd.log"
    Timestamp true
</plugin>

LoadPlugin cpu
LoadPlugin disk
LoadPlugin interface
LoadPlugin load
LoadPlugin memory
LoadPlugin network
LoadPlugin nfs
LoadPlugin rrdtool
LoadPlugin swap

<plugin network>
  Listen "0.0.0.0" "28596"
</plugin>

<plugin rrdtool>
  DataDir "/var/lib/collectd/rrd"
</plugin>

#Include "/etc/collectd.d/*.conf"

客户的 collectd.conf

Hostname "kropotkin"
FQDNLookup true
LoadPlugin syslog

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

<plugin syslog>
    LogLevel info
</plugin>

LoadPlugin cpu
LoadPlugin disk
LoadPlugin interface
LoadPlugin load
LoadPlugin memory
LoadPlugin network

<Plugin network>
  Server "127.0.0.1" "28596"
</Plugin>

在服务器上,我在 rrd 目录中只看到“bakunin-tower”,但我希望 kropotkin 也会出现。怎么了?我的头要爆炸了。

谢谢。

collectd
  • 1 个回答
  • 401 Views
Martin Hope
Matheus Portela
Asked: 2017-01-25 09:31:57 +0800 CST

JMX 报告错误的测量值并为 Apache Kafka 收集

  • 2

我正在使用 JMX 从 Apache Kafka 收集指标并通过 collectd 发送到可视化和监控服务 Librato。问题是某些指标似乎报告错误。例如,在没有任何人使用 Kafka 集群的情况下,一些节点报告每分钟有大量传入消息(如 15,000 条),而其他节点报告为 0,正如预期的那样。

这是 collectd 中的一项指标配置:

<MBean "kafka-all-messages">
  ObjectName "kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec"
  InstancePrefix "all"
  <Value>
    InstancePrefix "kafka-messages-in"
    Type "counter"
    Table false
    Attribute "MeanRate"
  </Value>
</MBean>

这是 Librato 中的图表:

Librato 中的每秒消息数可视化

有谁知道出了什么问题?是我收集的配置,例如Type或类似的东西吗?

monitoring jmx collectd kafka
  • 1 个回答
  • 353 Views
Martin Hope
Putnik
Asked: 2016-12-06 13:24:44 +0800 CST

收集和执行:`<newline>' 附近的第 1329 行:语法错误,意外 EOL

  • 1

尝试将 exec 插件与 collectd 一起使用:

/etc/collectd.conf:

...
LoadPlugin exec
...
<Plugin exec>
        Exec "nobody:nobody" "/etc/collectd.d/redis_simple.sh"
</Plugin>

我已经简化/etc/collectd.d/redis_simple.sh为:

#!/bin/bash

while sleep 10
do
        echo "PUTVAL nfs/redis-6379/memcached_items-db0 interval=10 N:3043"
done

错误:

# /etc/init.d/collectd restart
Stopping collectd:                                         [  OK  ]
Starting collectd: Parse error in file `/etc/collectd.d/redis.sh', line 1308 near `<newline>': syntax error, unexpected EOL
yyparse returned error #1
configfile: Cannot read file `/etc/collectd.d/redis.sh'.
Parse error in file `/etc/collectd.d/redis_simple.sh', line 1329 near `<newline>': syntax error, unexpected EOL
yyparse returned error #1
configfile: Cannot read file `/etc/collectd.d/redis_simple.sh'.
=                                                          [  OK  ]

                                                      [  OK  ]

两个文件的末尾肯定有新行。没有 Windows EOL。日志中没有任何内容。/etc/collectd.d/redis_simple.sh 中没有第 1329 行。

任何帮助,将不胜感激。

collectd
  • 1 个回答
  • 537 Views
Martin Hope
that1guy15
Asked: 2016-11-10 12:38:10 +0800 CST

Collectd SNMP 插件无法找到 MIB

  • 1

使用 Collectd 通过 snmp 插件轮询 Cisco 设备。我将所需的 Cisco mib(CISCO-MEMORY-POOL-MIB 和 CISCO-PROCESS-MIB)加载到 net-snmp 中,并且 snmpwalk 可以很好地看到它们。

但是当我尝试将它们添加到 collectd 时,我在重新启动 collectd 服务时收到以下错误:

Cannot find module (CISCO-MEMORY-POOL-MIB): At line 0 in (none)
Cannot find module (CISCO-PROCESS-MIB): At line 0 in (none)

日志文件显示:

[2016-11-09 14:13:56] Exiting normally.
[2016-11-09 14:13:56] collectd: Stopping 5 read threads.
[2016-11-09 14:13:56] snmp plugin: read_objid (CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolName) failed.
[2016-11-09 14:13:56] snmp plugin: read_objid (CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolName) failed.
[2016-11-09 14:13:56] snmp plugin: snmp_parse_oid (CISCO-PROCESS-MIB::cpmCPUTotal5secRev) failed.
[2016-11-09 14:13:56] snmp plugin: No such data configured: `memory_free'
[2016-11-09 14:13:56] snmp plugin: No such data configured: `memory_used'
[2016-11-09 14:13:56] snmp plugin: No such data configured: `cisco_cpu'
[2016-11-09 14:13:56] snmp plugin: No such data configured: `memory_free'
[2016-11-09 14:13:56] snmp plugin: No such data configured: `memory_used'
[2016-11-09 14:13:56] snmp plugin: No such data configured: `cisco_cpu'
[2016-11-09 14:13:56] snmp plugin: No such data configured: `memory_free'
[2016-11-09 14:13:56] snmp plugin: No such data configured: `memory_used'
[2016-11-09 14:13:56] snmp plugin: No such data configured: `cisco_cpu'
[2016-11-09 14:13:56] Initialization complete, entering read-loop.

这是我的 collectd.conf 的 snmp 部分

<Plugin snmp>
  <Data "SysInfo">
      Type "counter"
      Table false
      Instance "sysName"
      Values  "SNMPv2-MIB::sysName"
  </Data>
  <Data "uptime">
     Type "uptime"
     Table false
     Instance "Uptime"
     scale 0.01
    Values  "DISMAN-EVENT-MIB::sysUpTimeInstance"
  </Data>
  <Data "if_octets">
      Type "if_octets"
      Table true
      Instance "IF-MIB::ifAlias"
      Values "IF-MIB::ifHCInOctets" "IF-MIB::ifHCOutOctets"
  </Data>
  <Data "if_errors">
    Type "if_errors"
    Table true
    Instance "IF-MIB::ifAlias"
    Values "IF-MIB::ifInErrors" "IF-MIB::ifOutErrors"
  </Data>
 <Data "memory_free">
    Type "memory_free"
    Table true
    Instance "CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolName"
    Values  "CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolFree"
  </Data>
  <Data "memory_used">
    Type "memory_used"
    Table true
    Instance "CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolName"
    Values "CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolUsed"
  </Data>
  <Data "cisco_cpu">
      Type "cisco_cpu"
      Table true
      Values "CISCO-PROCESS-MIB::cpmCPUTotal5secRev" "CISCO-PROCESS-MIB::cpmCPUTotal1minRev" "CISCO-PROCESS-MIB::cpmCPUTotal5minRev"
  </Data>    

我在这里想念什么?我也尝试过使用 OID 地址而不是名称,但我也一无所获。

snmp collectd net-snmp
  • 1 个回答
  • 2188 Views
Martin Hope
kumar
Asked: 2016-08-29 08:02:22 +0800 CST

安装 collectd 后存储指标的默认位置是什么?

  • 0

我在 CentOS 7.2 中安装了 Collectd,我点击了链接。 http://www.tecmint.com/install-collectd-and-collectd-web-to-monitor-server-resources-in-linux/2/

从我阅读的内容开始收集后,默认指标之一是 CPU。我无法找到收集此信息的位置。

谢谢

centos7 collectd
  • 1 个回答
  • 1402 Views
Martin Hope
Klaus
Asked: 2016-08-16 22:31:05 +0800 CST

收集日志文件的权限被拒绝

  • 0

我已经收集了运行,并以 root 身份启动它:

service collectd start

但是,我看不到日志。我运行时得到以下信息:服务收集状态:

logfile plugin: fopen (/var/log/collectd/collectd.log) failed: Permission denied
logfile plugin: fopen (/var/log/collectd/collectd.log) failed: Permission denied
logfile plugin: fopen (/var/log/collectd/collectd.log) failed: Permission denied
logfile plugin: fopen (/var/log/collectd/collectd.log) failed: Permission denied
logfile plugin: fopen (/var/log/collectd/collectd.log) failed: Permission denied

文件系统的权限如下:

[root@avocado]# ls -la /var/log/collectd/
total 8
drwxrwxrwx.  2 root root 4096 Aug 16 06:07 .
drwxr-xr-x. 20 root root 4096 Aug 16 06:00 ..
-rwxrwxrwx.  1 root root    0 Aug 16 06:07 collectd.log

我在尝试解决此问题时手动创建了 /var/log/collectd 文件夹和 /var/log/collectd/collectd.log 文件。

collectd配置如下:

#LoadPlugin syslog
LoadPlugin "logfile"
#LoadPlugin log_logstash

<Plugin "logfile">
    LogLevel "info"
    File "/var/log/collectd/collectd.log"
    Timestamp true
    PrintSeverity false
</Plugin>

我错过了什么?我怎样才能收集到停止抱怨权限并正确记录?

logging collectd
  • 3 个回答
  • 3611 Views
Martin Hope
Arseni Mourzenko
Asked: 2016-07-28 12:59:00 +0800 CST

我应该如何配置中央 collectd 服务器?

  • 0

我想要一个中央 collectd 服务器,它从其他服务器收集统计信息,将其存储到 RRD 文件并将其转发到 logstash。

/etc/collectd/collectd.conf以下是中央服务器上的相关部分:

<Plugin network>
    <Listen "0.0.0.0" "25826">
    </Listen>
</Plugin>

<Plugin network>
    <Server "192.168.1.24" "25827">
    </Server>
</Plugin>

<Plugin rrdtool>
    DataDir "/var/lib/collectd/rrd"
    CacheTimeout 120
    CacheFlush 900
</Plugin>

服务器成功接收来自其他服务器的指标并将它们存储在 RRD 文件中。ls /var/lib/collectd/rrd表明这部分运作良好。

但是,只有服务器的数据会发送到 logstash。通过网络从其他机器传输到该服务器的数据不会重新发送到 Logstash。事实上,根据collectd 邮件列表:

[T]通过网络插件发送的值被标记,以避免多次可能的循环重传。

有没有办法表明我确实希望重新传输这些值?

如果没有,我应该怎么做?我应该从每台机器直接将数据发送到logstash吗?

collectd
  • 1 个回答
  • 482 Views
Martin Hope
killachaos
Asked: 2016-07-20 15:31:56 +0800 CST

在 Collectd 或 Graphite/Grafana 中聚合磁盘

  • 1

我有多个节点,每个节点都有多个相同大小的磁盘。我想要任何一个

  • collectd 报告单个已用/空闲指标,该指标是这些多个磁盘的聚合
  • 构造一个 grafana 查询,将多个磁盘组合成一个 %-free 指标
grafana graphite collectd
  • 1 个回答
  • 638 Views
Martin Hope
rtmie
Asked: 2016-07-20 03:17:51 +0800 CST

使用 collectd 和 kapacitor - 不触发警报

  • 0

我试图让kapacitor根据influxdb中收集的数据触发警报。我的滴答文件基于使用 kapacitor 与 influxdb 和 collectd的答案。

stream
// Select just the cpu measurement from our example database.
|from()
    .measurement('cpu_value')
    .where(lambda: "type" == 'percent' AND "type_instance" == 'idle')
|alert()
    .crit(lambda: "value" <  98)
    // Whenever we get an alert write it to a file.
    .log('/tmp/alerts.log')

我已经根据 kapacitor 文档定义了警报:

kapacitor define cpu_alert -type stream -tick cpu_alert.tick -dbrp collectd.default

适当的数据正在从 collectd 发送到 influxdb 并可通过查询获得:

select value from /cpu_value/ where type='percent' and type_instance = 'idle' order by time desc limit 10;

在此处输入图像描述

但是运行:

kapacitor record stream -task cpu_alert -duration 20s &

不记录任何数据:

$ kapacitor list recordings
ID                                      Type    Status    Size      Date                   
48e5c04a-68c2-44a3-ba80-f2c12d952994    stream  running   0 B       19    Jul 16 11:57 IST  

我怀疑我在注册任务时可能没有正确引用数据库,但看不到哪里出错了。

collectd kapacitor
  • 1 个回答
  • 613 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve