fluentd_buffer_update_every=5
fluentd_buffer_priority=12000
fluentd_buffer_value1=0
fluentd_buffer_last=0
fluentd_buffer_count=0

fluentd_buffer_get() {
  fluentd_buffer_value1=$(find /var/log/td-agent/buffer -type f | wc -l)
  return 0
}

fluentd_buffer_check() {
  return 0
}

fluentd_buffer_create() {
  cat <<EOF
CHART fluentd_buffer.files '' "Files in buffer" "files" fluentd fluentd.countfiles line $((fluentd_buffer_priority + 1)) $fluentd_buffer_update_every
DIMENSION countfiles '' absolute 1 1
EOF
  return 0
}

fluentd_buffer_update() {
  fluentd_buffer_get || return 1

  cat <<VALUESEOF
BEGIN fluentd_buffer.files $1
SET countfiles = $fluentd_buffer_value1
END
VALUESEOF

  return 0
}
