FreeBSD 10.1 にインストールされている collectd (5.4.2) プラグインを適切に構成しようとしています。以下に含まれる私の構成に基づいて、警告レベル以上で報告するすべての施設に対してこのファイルを書き込む rsyslog によって管理される /var/log/messages ファイルに警告イベントが表示されることを期待しています。
しきい値の警告が表示されません。「stress -c」などのツールを使用して、アイドル状態の「jiffies」を強制的に下げました。
rrdtool lastupdate を使用して表示することに基づいて、情報を正常に収集しているように見えます
- /var/db/collectd/rrd/localhost/cpu-average/cpu-idle.rrd
- /var/db/collectd/rrd/localhost/tail-messages/counter-os.rrd
これは、plugin、type、および instance キーワードに関して、tail、aggregate、Chain、またはしきい値の構成宣言で、私が完全に正しく理解していないものであると思われます。
さまざまな施設からの問題を探している末尾では、GaugeInc がより適切な DSType になると思いますが、現在の collectd リビジョンではサポートされていません。
セットアップの問題と思われるものについての洞察に感謝します。
猫 /usr/local/etc/collectd.conf
Hostname "localhost"
FQDNLookup true
BaseDir "/var/db/collectd"
PIDFile "/var/run/collectd.pid"
TypesDB "/usr/local/share/collectd/types.db"
#ReadThreads 5
#WriteThreads 5
#https://collectd.org/wiki/index.php/Main_Page
#https://collectd.org/wiki/index.php/Naming_schema
#A value is identified by a unique name, which we usually call The "identifier" consists of five parts, two of which are optional:
#host
#plugin
#plugin instance (optional)
#type
#type instance (optional)
# e.g. host "/" plugin ["-" plugin instance] "/" type ["-" type instance]
# localhost/cpu-0/cpu-idle
LoadPlugin syslog
<plugin syslog>
LogLevel warning
NotifyLevel "OKAY"
</plugin>
LoadPlugin cpu
LoadPlugin aggregation
<LoadPlugin df >
Interval 300
</LoadPlugin>
LoadPlugin interface
LoadPlugin load
LoadPlugin memory
LoadPlugin match_regex
LoadPlugin rrdtool
LoadPlugin threshold
<LoadPlugin tail >
Interval 60
</LoadPlugin>
<plugin "df">
FSType zfs
MountPoint "/"
#ReportInodes false
ValuesPercentage true
</plugin>
<plugin rrdtool>
DataDir "/var/db/collectd/rrd"
CacheTimeout 120
CacheFlush 900
</plugin>
<plugin aggregation>
<Aggregation>
Plugin "cpu"
Type "cpu"
SetPlugin "cpu"
SetPluginInstance "%{aggregation}"
GroupBy "Host"
GroupBy "TypeInstance"
CalculateAverage true
</Aggregation>
</plugin>
<Chain "PostCache">
<Rule> # send cpu values for aggregation
<Match regex>
Plugin "^cpu$"
PluginInstance "[0-9]+$"
</Match>
<Target write>
Plugin "aggregation"
</Target>
Target stop
</Rule>
<Target write> # Write everything else via rrdtool.
Plugin "rrdtool"
</Target>
</Chain>
<plugin "tail">
<File "/var/log/messages">
Instance "messages"
<Match>
# localhost/tail-messages/counter-ace
Regex "local1.(err|warn|alert|crit)"
DSType "CounterInc"
Type "counter"
Instance "ace"
</Match>
<Match>
Regex "local0.(err|warn|alert|crit)"
ExcludeRegex "smdr:"
DSType "CounterInc"
Type "counter"
Instance "postgres"
</Match>
<Match>
Regex "local4.(err|warn|alert|crit)"
DSType "CounterInc"
Type "counter"
Instance "mec"
</Match>
<Match>
Regex "local5.(err|warn|alert|crit)"
DSType "CounterInc"
Type "counter"
Instance "web"
</Match>
<Match>
Regex "(local6|local7).(err|warn|alert|crit)"
DSType "CounterInc"
Type "counter"
Instance "apache"
</Match>
<Match>
Regex "^.*$"
ExcludeRegex " local[0-7] "
DSType "CounterInc"
Type "counter"
Instance "os"
</Match>
</File>
</plugin>
#https://collectd.org/documentation/manpages/collectd-threshold.5.shtml
<Plugin "threshold">
<Plugin "interface">
Instance "eth0"
<Type "if_octets">
FailureMax 10000000
DataSource "rx"
</Type>
</Plugin>
<plugin "df">
<type "df">
Instance "/zroot/ROOT/default"
WarningMax 75
</type>
</plugin>
<Host "Hostname">
<plugin "aggregation">
<type "cpu-average">
Instance "idle"
WarningMin 17000
FailureMin 15000
Hits 1
</type>
</plugin>
<Plugin "memory">
<Type "memory">
Instance "free"
WarningMin 10000000
</Type>
</Plugin>
<plugin "load">
<type "load">
DataSource "midterm"
FailureMax 4
Hits 3
Hysteresis 3
</type>
</plugin>
<Plugin "tail">
Instance "messages"
<type "counter">
Instance "os"
WarningMax .001
</type>
<type"counter">
Instance "ace"
WarningMax .001
</type>
</Plugin>
</Host>
</Plugin>