fluent-plugin-prometheus
fluent-plugin-prometheus copied to clipboard
High cpu usage with prometheus_monitor enabled
I have 2 nodes fluentd-aggregator cluster on AWS ECS. It's CPU is around 2% before I enable prometheus monitor. But whenever I enable prometheus monitor it becomes 40%
Dockerfile
FROM fluent/fluentd:v1.2.3-onbuild
RUN apk add --update --virtual .build-deps \
sudo build-base ruby-dev \
# cutomize following instruction as you wish
&& sudo gem install fluent-plugin-s3 \
&& sudo gem install fluent-plugin-flowcounter \
&& sudo gem install fluent-plugin-prometheus \
&& sudo gem sources --clear-all \
&& apk del .build-deps \
&& rm -rf /var/cache/apk/* \
/home/fluent/.gem/ruby/2.3.0/cache/*.gem
COPY gems/fluent-plugin-dd-0.1.8.gem /home/fluent/
RUN gem install /home/fluent/fluent-plugin-dd-0.1.8.gem
COPY system.conf /fluentd/etc/
COPY sources.conf /fluentd/etc/
Configuration
fluentd.conf
@include system.conf
@include sources.conf
system.conf
<system>
workers 4
</system>
source.conf
<source>
@type forward
port 24224
</source>
<source>
@type debug_agent
bind 127.0.0.1
port 24230
</source>
<source>
@type monitor_agent
bind 0.0.0.0
port 24220
</source>
<match fluent.**>
@type stdout
</match>
# expose metrics in prometheus format
<source>
@type prometheus
bind 0.0.0.0
port 24231
metrics_path /metrics
</source>
<source>
@type prometheus_output_monitor
interval 10
<labels>
hostname ${hostname}
worker ${worker_id}
</labels>
</source>