收集Theshold插件而不是警告rsyslog

时间:2015-08-06 15:26:56

标签: collectd

我正在尝试正确配置FreeBSD 10.1中安装的collectd(5.4.2)插件。我希望根据下面的配置来实现 请参阅由rsyslog管理的/ var / log / messages文件中的警告事件 它为在警告级别及以上级别报告的任何设施写入此文件。

我没有收到任何阈值警告。我使用过像#34; 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

我怀疑这是关于插件,类型和实例关键字的尾部,聚合,链或阈值的配置声明我不太正确。

我正在寻找各种设施的问题 认为GaugeInc将是更合适的DSType,但事实并非如此 我当前的收集版本支持。

欣赏有关设置问题的任何见解。

cat /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>

1 个答案:

答案 0 :(得分:0)

阈值最常见的错误是过滤限制过多。尝试删除func startApp(){ let difference = self.currentBackgroundDate.timeIntervalSinceDate(NSDate()) self.handler(difference) //update difference self.start() //start timer } Host等部分,直到您看到通知为止。此外,您可以使用Instance插件来unixsock假值,而不是尝试刻录您的系统。