Initial commit

This commit is contained in:
Silvio
2018-04-04 12:46:05 +02:00
commit 64f28d8374
7 changed files with 786 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
<!--
If you are reporting a new issue, make sure that we do not have any duplicates
already open. You can ensure this by searching the issue list for this
repository. If there is a duplicate, please close your issue and add a comment
to the existing issue instead.
If you suspect your issue is a bug, please edit your issue description to
include the BUG REPORT INFORMATION shown below. If you fail to provide this
information within 7 days, we cannot debug your issue and we'll close it. We
will, however, reopen it if you later provide the information.
-------------------------------
BUG REPORT INFORMATION
-------------------------------
Use the commands below to provide key information from your environment:
You do NOT have to include this information if this is a FEATURE REQUEST
-->
**Description**
<!-- Briefly describe the problem you are having in a few paragraphs. -->
**Steps to reproduce the issue:**
1. [First Step]
2. [Second Step]
3. [and so on...]
**Describe the results you received:**
<!-- What actually happens -->
**Describe the results you expected:**
<!-- What you expect to happen -->
**Additional information you deem important (e.g. issue happens only occasionally):**
<!-- Any additional information, configuration or data that might be necessary to reproduce the issue. -->
**Version**
- Output of `docker version`:
```
(paste your output here)
```
- Output of `docker info`:
```
(paste your output here)
```
- Output of `docker-compose version` (if applicable):
```
(paste your output here)
```
**Additional environment details (AWS, VirtualBox, Docker for MAC, physical, etc.):**

View File

@@ -0,0 +1,32 @@
<!--
Before you open the request please review the following guidelines and tips to help it be more easily integrated:
- Describe the scope of your change - i.e. what the change does.
- Describe any known limitations with your change.
- Please run any tests or examples that can exercise your modified code.
Thank you for contributing! We will try to test and integrate the change as soon as we can, but be aware we have many GitHub repositories to manage and can't immediately respond to every request. There is no need to bump or check in on a pull request (it will clutter the discussion of the request).
Also don't be worried if the request is closed or not integrated sometimes the priorities of Bitnami might not match the priorities of the pull request. Don't fret, the open source community thrives on forks and GitHub makes it easy to keep your changes in a forked repo.
-->
**Description of the change**
<!-- Describe the scope of your change - i.e. what the change does. -->
**Benefits**
<!-- What benefits will be realized by the code change? -->
**Possible drawbacks**
<!-- Describe any known limitations with your change -->
**Applicable issues**
<!-- Enter any applicable Issues here (You can reference an issue using #) -->
**Additional information**
<!-- If there's anything else that's important and relevant to your pull
request, mention that information here.-->

View File

@@ -0,0 +1,30 @@
FROM bitnami/minideb:jessie as development
ARG FLUENTD_EXPORTER_VERSION=0.1.0
ARG GO_VERSION=1.9.4
RUN install_packages wget ca-certificates git make tar wget
RUN wget -nc https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go$GO_VERSION.linux-amd64.tar.gz
ENV GOPATH=/
ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH
RUN mkdir -p /src/ && \
cd /src/ && \
git clone -b ${FLUENTD_EXPORTER_VERSION} --depth 1 https://github.com/V3ckt0r/fluentd_exporter.git && \
cd fluentd_exporter && \
go build fluentd_exporter.go
FROM bitnami/minideb:jessie
LABEL maintainer "Bitnami <containers@bitnami.com>"
COPY --from=development /src/fluentd_exporter/fluentd_exporter /opt/bitnami/fluentd_exporter/bin/fluentd_exporter
COPY --from=development /src/fluentd_exporter/LICENSE /opt/bitnami/fluentd_exporter/LICENSE
ENV PATH="/opt/bitnami/fluentd_exporter/bin:$PATH"
EXPOSE 9309
WORKDIR /opt/bitnami/fluentd_exporter
USER 1001
ENTRYPOINT [ "/opt/bitnami/fluentd_exporter/bin/fluentd_exporter" ]

View File

@@ -0,0 +1,411 @@
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "Prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "4.2.0"
},
{
"type": "panel",
"id": "graph",
"name": "Graph",
"version": ""
},
{
"type": "datasource",
"id": "prometheus",
"name": "Prometheus",
"version": "1.0.0"
},
{
"type": "panel",
"id": "singlestat",
"name": "Singlestat",
"version": ""
}
],
"annotations": {
"list": []
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"hideControls": false,
"id": null,
"links": [],
"refresh": false,
"rows": [
{
"collapse": false,
"height": "250px",
"panels": [
{
"aliasColors": {},
"bars": false,
"datasource": "${DS_PROMETHEUS}",
"fill": 1,
"id": 1,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "fluentd_buffer_queue_length",
"intervalFactor": 2,
"metric": "fluentd_buffer_queue_length",
"refId": "A",
"step": 2
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "buffer queue length",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Dashboard Row",
"titleSize": "h6"
},
{
"collapse": false,
"height": 250,
"panels": [
{
"aliasColors": {},
"bars": false,
"datasource": "${DS_PROMETHEUS}",
"fill": 1,
"id": 3,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "fluentd_buffer_total_queued_size",
"intervalFactor": 2,
"metric": "fluentd_buffer_total_queued_size",
"refId": "A",
"step": 2
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "buffer total queued size",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Dashboard Row",
"titleSize": "h6"
},
{
"collapse": false,
"height": 299,
"panels": [
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": true,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(45, 170, 3, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"datasource": "${DS_PROMETHEUS}",
"format": "none",
"gauge": {
"maxValue": 1,
"minValue": 0,
"show": true,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 4,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 6,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"targets": [
{
"expr": "fluentd_up",
"intervalFactor": 2,
"refId": "A",
"step": 40
}
],
"thresholds": "0,1",
"title": "Fluentd Up",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"aliasColors": {},
"bars": false,
"datasource": "${DS_PROMETHEUS}",
"fill": 1,
"id": 5,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"span": 6,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "fluentd_retry_count{pluginCategory=\"output\",pluginId=\"apache_log\"}",
"intervalFactor": 2,
"metric": "fluentd_retry_count",
"refId": "A",
"step": 4
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "retry count (apache)",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Dashboard Row",
"titleSize": "h6"
}
],
"schemaVersion": 14,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "2017-10-20T13:00:11.189Z",
"to": "2017-10-20T13:38:24.045Z"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"timezone": "browser",
"title": "fluentd dashboard example",
"version": 17
}

View File

@@ -0,0 +1,13 @@
Copyright (c) 2018 Bitnami
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,179 @@
[![CircleCI](https://circleci.com/gh/bitnami/bitnami-docker-fluentd_exporter/tree/master.svg?style=shield)](https://circleci.com/gh/bitnami/bitnami-docker-fluentd_exporter/tree/master)
# What is Fluentd_exporter?
Simple server that scrapes fluentd metrics endpoint and exports them as Prometheus metrics.
[https://github.com/V3ckt0r/fluentd_exporter](https://github.com/V3ckt0r/fluentd_exporter)
# TL;DR;
```bash
$ docker run --name fluentd_exporter bitnami/fluentd_exporter:latest
```
# Why use Bitnami Images?
* Bitnami closely tracks upstream source changes and promptly publishes new versions of this image using our automated systems.
* With Bitnami images the latest bug fixes and features are available as soon as possible.
* Bitnami containers, virtual machines and cloud images use the same components and configuration approach - making it easy to switch between formats based on your project needs.
* Bitnami images are built on CircleCI and automatically pushed to the Docker Hub.
* All our images are based on [minideb](https://github.com/bitnami/minideb) a minimalist Debian based container image which gives you a small base container image and the familiarity of a leading linux distribution.
# Get this image
The recommended way to get the Bitnami Fluentd_exporter Docker Image is to pull the prebuilt image from the [Docker Hub Registry](https://hub.docker.com/r/bitnami/fluentd_exporter).
```bash
$ docker pull bitnami/fluentd_exporter:latest
```
To use a specific version, you can pull a versioned tag. You can view the [list of available versions](https://hub.docker.com/r/bitnami/fluentd_exporter/tags/) in the Docker Hub Registry.
```bash
$ docker pull bitnami/fluentd_exporter:[TAG]
```
If you wish, you can also build the image yourself.
```bash
$ docker build -t bitnami/fluentd_exporter:latest https://github.com/bitnami/bitnami-docker-fluentd_exporter.git
```
# Connecting to other containers
Using [Docker container networking](https://docs.docker.com/engine/userguide/networking/), a different server running inside a container can easily be accessed by your application containers and vice-versa.
Containers attached to the same network can communicate with each other using the container name as the hostname.
## Using the Command Line
### Step 1: Create a network
```bash
$ docker network create fluentd_exporter-network --driver bridge
```
### Step 2: Launch the Fluentd_exporter container within your network
Use the `--network <NETWORK>` argument to the `docker run` command to attach the container to the `fluentd_exporter-network` network.
```bash
$ docker run --name fluentd_exporter-node1 --network fluentd_exporter-network bitnami/fluentd_exporter:latest
```
### Step 3: Run another containers
We can launch another containers using the same flag (`--network NETWORK`) in the `docker run` command. If you also set a name to your container, you will be able to use it as hostname in your network.
# Configuration
Fluentd exporter uses the fluentd monitoring agent api. [Fluentd official documentation](https://docs.fluentd.org/v1.0/articles/monitoring) details adding this source to the fluentd configuration file:
```yaml
<source>
@type monitor_agent
bind 0.0.0.0
port 24220
</source>
```
The metrics can then be accessed at: curl http://host:24220/api/plugins.json
## Flags/Arguments
```
-telemetry.endpoint string
Path under which to expose metric. (default "/metrics")
-insecure
Ignore server certificate if using https, Default: false.
-log.format value
Set the log target and format. Example: "logger:syslog?appname=bob&local=7" or "logger:stdout?json=true" (default "logger:stderr")
-log.level value
Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal] (default "info")
-scrape_uri string
URI to fluentd metrics (default "http://localhost:24220/api/plugins.json")
-telemetry.address string
Address on which to expose metrics. (default ":9309")
-version
Print version information.
```
# Logging
The Bitnami fluentd_exporter Docker image sends the container logs to the `stdout`. To view the logs:
```bash
$ docker logs fluentd_exporter
```
You can configure the containers [logging driver](https://docs.docker.com/engine/admin/logging/overview/) using the `--log-driver` option if you wish to consume the container logs differently. In the default configuration docker uses the `json-file` driver.
# Maintenance
## Upgrade this image
Bitnami provides up-to-date versions of fluentd_exporter, including security patches, soon after they are made upstream. We recommend that you follow these steps to upgrade your container.
### Step 1: Get the updated image
```bash
$ docker pull bitnami/fluentd_exporter:latest
```
### Step 2: Stop and backup the currently running container
Stop the currently running container using the command
```bash
$ docker stop fluentd_exporter
```
Next, take a snapshot of the persistent volume `/path/to/fluentd_exporter-persistence` using:
```bash
$ rsync -a /path/to/fluentd_exporter-persistence /path/to/fluentd_exporter-persistence.bkp.$(date +%Y%m%d-%H.%M.%S)
```
You can use this snapshot to restore the database state should the upgrade fail.
### Step 3: Remove the currently running container
```bash
$ docker rm -v fluentd_exporter
```
### Step 4: Run the new image
Re-create your container from the new image, [restoring your backup](#restoring-a-backup) if necessary.
```bash
$ docker run --name fluentd_exporter bitnami/fluentd_exporter:latest
```
# Contributing
We'd love for you to contribute to this container. You can request new features by creating an [issue](https://github.com/bitnami/bitnami-docker-fluentd_exporter/issues), or submit a [pull request](https://github.com/bitnami/bitnami-docker-fluentd_exporter/pulls) with your contribution.
# Issues
If you encountered a problem running this container, you can file an [issue](https://github.com/bitnami/bitnami-docker-fluentd_exporter/issues). For us to provide better support, be sure to include the following information in your issue:
- Host OS and version
- Docker version (`docker version`)
- Output of `docker info`
- Version of this container
- The command you used to run the container, and any relevant output you saw (masking any sensitive information)
# License
Copyright 2018 Bitnami
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,61 @@
version: 2
jobs:
build:
working_directory: /workdir
docker:
- image: docker:17.06.0-ce-git
environment:
RELEASE_SERIES_LIST: "0"
LATEST_STABLE: "0"
IMAGE_NAME: fluentd_exporter
DOCKER_PROJECT: bitnami
steps:
- checkout
- setup_remote_docker:
version: 17.06.0-ce
- run:
name: Upgrade system packages (workaround - https://github.com/docker-library/docker/issues/72)
command: |
apk upgrade --no-cache
- run:
name: Install dependencies
command: |
apk add --no-cache curl bash coreutils
- run:
name: Docker info
command: |
docker version
docker info
- restore_cache:
keys:
- cache-{{ .Branch }}
paths:
- /cache/layers.tar
- run:
name: Build docker image
command: |
curl -sL https://raw.githubusercontent.com/bitnami/test-infra/master/circle/docker-image-test.sh | bash -
- save_cache:
key: cache-{{ .Branch }}-{{ epoch }}
paths:
- /cache/layers.tar
- deploy:
name: Publish docker image
command: |
if [ -n "${CIRCLE_TAG}" ]; then
curl -sL https://raw.githubusercontent.com/bitnami/test-infra/master/circle/docker-release-image.sh | bash -
elif [ "${CIRCLE_BRANCH}" == "master" ]; then
curl -sL https://raw.githubusercontent.com/bitnami/test-infra/master/circle/docker-development-image.sh | bash -
fi
workflows:
version: 2
build-and-deploy:
jobs:
- build:
filters:
branches:
only: /.*/
tags:
only: /^[0-9].*-r[0-9]+$/