Skip to content

Commit

Permalink
20181009
Browse files Browse the repository at this point in the history
  • Loading branch information
lblanc committed Oct 9, 2018
0 parents commit b697a83
Show file tree
Hide file tree
Showing 17 changed files with 9,586 additions and 0 deletions.
118 changes: 118 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
FROM debian:9
MAINTAINER Luc Blanc <[email protected]>

ENV DEBIAN_FRONTEND noninteractive
ENV LANG en_US.UTF-8

# Database Defaults
ENV INFLUXDB_GRAFANA_DB datasource
ENV INFLUXDB_GRAFANA_USER datasource
ENV INFLUXDB_GRAFANA_PW datasource

ENV MYSQL_GRAFANA_USER grafana
ENV MYSQL_GRAFANA_PW grafana

# Default versions
ENV TELEGRAF_VERSION 1.7.4-1
ENV INFLUXDB_VERSION 1.6.2
ENV GRAFANA_VERSION 5.2.4
ENV CHRONOGRAF_VERSION 1.6.2
ENV GO_VERSION 1.10

# Go
ENV GOPATH=/root/work
ENV PATH=$PATH:/usr/local/go/bin:$GOPATH/bin


# Copy files for DataCore
COPY datacore/* /etc/datacore/


# Base dependencies
RUN mkdir /data-docker && mkdir /data-docker/mysql && mkdir /data-docker/influxdb && \
ln -s /data-docker/mysql /var/lib/mysql && ln -s /data-docker/influxdb /var/lib/influxdb && \
rm /var/lib/apt/lists/* -vf && \
apt-get -y update && \
apt-get -y dist-upgrade && \
apt-get -y --force-yes install \
apt-utils \
ca-certificates \
curl \
git \
htop \
libfontconfig \
mysql-client \
mysql-server \
nano \
gnupg2 \
net-tools \
openssh-server \
vim \
supervisor \
python-configparser \
python-concurrent.futures \
python-requests \
cron \
wget && \
curl -sL https://deb.nodesource.com/setup_9.x | bash - && \
apt-get install -y nodejs



# Configure Supervisord, SSH, base env, cron and MySql
COPY supervisord/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

WORKDIR /root

RUN mkdir -p /var/log/supervisor && \
mkdir -p /var/run/sshd && \
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \
echo 'root:root' | chpasswd && \
cat /etc/datacore/datacore-cron >> /etc/crontab && \
cat /etc/datacore/vsphere-cron >> /etc/crontab && \
/etc/datacore/setup_mysql.sh && \
chmod +x /etc/datacore/config.sh


# Install Go / Install & configure vSphere-influxdb-go
RUN wget https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz && \
tar xvf go${GO_VERSION}.linux-amd64.tar.gz && rm go${GO_VERSION}.linux-amd64.tar.gz && \
chown -R root:root ./go && \
mv go /usr/local && \
export GOPATH=/root/work && \
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin && \
go get github.com/vmware/govmomi && \
go get github.com/influxdata/influxdb/client/v2 && \
go get github.com/oxalide/vsphere-influxdb-go


# Install InfluxDB / Telegraf / chronograf / Grafana
RUN wget https://dl.influxdata.com/influxdb/releases/influxdb_${INFLUXDB_VERSION}_amd64.deb && \
dpkg -i influxdb_${INFLUXDB_VERSION}_amd64.deb && rm influxdb_${INFLUXDB_VERSION}_amd64.deb && \
wget https://dl.influxdata.com/telegraf/releases/telegraf_${TELEGRAF_VERSION}_amd64.deb && \
dpkg -i telegraf_${TELEGRAF_VERSION}_amd64.deb && rm telegraf_${TELEGRAF_VERSION}_amd64.deb && \
wget https://dl.influxdata.com/chronograf/releases/chronograf_${CHRONOGRAF_VERSION}_amd64.deb && \
dpkg -i chronograf_${CHRONOGRAF_VERSION}_amd64.deb && rm chronograf_${CHRONOGRAF_VERSION}_amd64.deb && \
wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_${GRAFANA_VERSION}_amd64.deb && \
dpkg -i grafana_${GRAFANA_VERSION}_amd64.deb && rm grafana_${GRAFANA_VERSION}_amd64.deb


# Configure InfluxDB
COPY influxdb/init.sh /etc/init.d/influxdb

# Configure Telegraf
COPY telegraf/telegraf.conf /etc/telegraf/telegraf.conf
COPY telegraf/init.sh /etc/init.d/telegraf

# Configure Grafana
COPY grafana/grafana.ini /etc/grafana/grafana.ini

# Cleanup
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

VOLUME [ "/data" ]

ENTRYPOINT [ "/etc/datacore/config.sh" ]

CMD [ "/usr/bin/supervisord" ]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 lblanc

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
127 changes: 127 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
## Docker Image with Telegraf, InfluxDB and Grafana with dashboard & REST script included for [DataCore SANsymphony](http://www.datacore.com)


[![](https://dockerbuildbadges.quelltext.eu/status.svg?organization=lblanc&repository=docker-influxdb-grafana-datacore)](https://hub.docker.com/r/lblanc/docker-influxdb-grafana-datacore/builds/)

[![License](http://img.shields.io/:license-mit-blue.svg)](http://octopress.mit-license.org)


Goal is to have grafana, influxdb and python script running to grab DataCore SANsymphony REST API performances


# Quick Start

To start the container the first time launch this by replacing -e variables:
* DCSSVR -> DataCore Server (IP or hostname)
* DCSREST -> DataCore Rest API Server(IP or hostname)
* DCSUNAME -> DataCore User name
* DCSPWORD -> DataCore user password

```sh
docker run --ulimit nofile=66000:66000 \
-d \
--name grafana-datacore \
-p 3000:3000 \
-p 8888:8888 \
-p 8086:8086 \
-p 22022:22 \
-p 8125:8125/udp \
-e "DCSSVR=X.X.X.X" \
-e "DCSREST=X.X.X.X" \
-e "DCSUNAME=administrator" \
-e "DCSPWORD=password" \
lblanc/docker-influxdb-grafana-datacore:latest
```

If you want to monitor also vSphere you can add this variables:
* VSPHERE_USER -> vSphere user
* VSPHERE_PASS -> vSphere password
* VSPHERE_VCENTER -> vSphere vCenter (IP or hostname)
* VSPHERE_DOM -> vSphere domain

```sh
docker run --ulimit nofile=66000:66000 \
-d \
--name grafana-datacore \
-p 3000:3000 \
-p 8888:8888 \
-p 8086:8086 \
-p 22022:22 \
-p 8125:8125/udp \
-e "DCSSVR=X.X.X.X" \
-e "DCSREST=X.X.X.X" \
-e "DCSUNAME=administrator" \
-e "DCSPWORD=password" \
-e "[email protected]" \
-e "VSPHERE_PASS=password" \
-e "VSPHERE_VCENTER=X.X.X.X" \
-e "VSPHERE_DOM=local" \
lblanc/docker-influxdb-grafana-datacore:latest
```

To stop the container launch:
```sh
docker stop grafana-datacore
```


To start the container again launch:
```sh
docker start grafana-datacore
```

# Persistent data

You can optionaly add volume option to store Grafana configuration and influxdb files
Example:
```sh
docker run --ulimit nofile=66000:66000 \
-d \
--name grafana-datacore \
-p 3000:3000 \
-p 8888:8888 \
-p 8086:8086 \
-p 22022:22 \
-p 8125:8125/udp \
-v my-volume:/data \
-e "DCSSVR=X.X.X.X" \
-e "DCSREST=X.X.X.X" \
-e "DCSUNAME=administrator" \
-e "DCSPWORD=password" \
-e "[email protected]" \
-e "VSPHERE_PASS=password" \
-e "VSPHERE_VCENTER=X.X.X.X" \
-e "VSPHERE_DOM=local" \
lblanc/docker-influxdb-grafana-datacore:latest
```


# Mapped Ports

```
Host Container Service
3000 3000 grafana
8888 8888 chronograf
8086 8086 influxdb
8125 8125 statsd
22022 22 sshd
```


# SSH

```sh
ssh root@localhost -p 22022
```
Password: root


# Grafana

Open <http://localhost:3000>

```
Username: grafana
Password: grafana
```
Loading

0 comments on commit b697a83

Please sign in to comment.