2016-03-07 87 views
0

collectd是否正確支持write_graphite插件的多個實例? Collectd手冊頁似乎一個例子來表明這一點:https://collectd.org/documentation/manpages/collectd.conf.5.shtml#built_in_targets收集多個write_graphite實例

我想配置chains具體而言,PostCacheChain,並通過在collectd write_graphite插件的多個實例發送指標。原因是,不同的度量標準需要不同的前綴。

我無法將兩個實例都發送到石墨,只有一個或其他作品。

使用,netstat我可以看到兩個插座從我的collectd主機建立到石墨主機。運行tcpdump顯示兩個連接的SYN-ACK,但只有一個實例發送數據。應該通過第二個實例發送的度量標準不會顯示在tcpdump或石墨上。

write_graphite看起來像這樣的配置:

LoadPlugin "write_graphite" 
<Plugin "write_graphite"> 
    <Node "def_prefix"> 
    Host "metrics.example.com" 
    Port "2003" 
    Prefix "collectd." 
    LogSendErrors true 
    Protocol "TCP" 
    StoreRates true 
    AlwaysAppendDS true 
    SeparateInstances true 
    </Node> 
    <Node "statsd_prefix"> 
    Host "metrics.example.com" 
    Port "2003" 
    Prefix "statsd." 
    LogSendErrors true 
    Protocol "TCP" 
    StoreRates true 
    AlwaysAppendDS true 
    SeparateInstances true 
    </Node> 
</Plugin> 

而對於PostCacheChain

LoadPlugin match_regex 
PostCacheChain "PostCache" 
<Chain "PostCache"> 
    <Rule "statsd_prefix"> # metrics from statsd plugin use diff prefix 
    <Match "regex"> 
     Plugin "^statsd$" 
    </Match> 
    <Target "write"> 
     Plugin "write_graphite/statsd_prefix" 
    </Target> 
    <Target "return"> 
    </Target> 
    </Rule> 
    <Target "write"> 
    Plugin "write_graphite/def_prefix" 
    </Target> 
</Chain> 

感謝您的幫助。

+0

您是否嘗試過使用自定義postcachechain規則? –

+0

@RyanCox沒有自定義PostCache規則,它只會使用write_graphite插件的默認實例(或第一個實例)。 –

+0

好的,我的問題是,服務器並不是真正的石墨,它在監聽模式下是'nc'。否則多個石墨實例工作正常。 –

回答

1

我遇到的問題是設置問題。爲了快速測試,我讓nc在監聽模式下運行,而不是實際的石墨服務器。這導致只有一個石墨插件實例完全連接和傳輸數據。

在我的情況下如此糟糕的測試場景。