我在通过命令安装的 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/成功。我还按相应的顺序执行了以下命令:
sudo systemctl daemon-reload
sudo systemctl stop collectd.service
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_syslog
collectd.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.
非常感谢任何建议/指出我如何解决这个问题的正确方向。