Skip to content

Commit

Permalink
Some corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
artlov committed Jan 10, 2019
1 parent 6c64d62 commit af50437
Show file tree
Hide file tree
Showing 6 changed files with 256 additions and 30 deletions.
40 changes: 18 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM ubuntu:18.04
MAINTAINER Arthur Kono <[email protected]>

LABEL maintainer="[email protected]"

ENV DEBIAN_FRONTEND noninteractive
ENV LANG C.UTF-8
Expand All @@ -10,16 +11,8 @@ ENV INFLUXDB_VERSION 1.7.2
ENV GRAFANA_VERSION 5.3.2
ENV CHRONOGRAF_VERSION 1.7.5

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

ENV GF_DATABASE_TYPE=sqlite3

#ENV MYSQL_GRAFANA_USER grafana
#ENV MYSQL_GRAFANA_PW grafana

# Fix bad proxy issue
COPY system/99fixbadproxy /etc/apt/apt.conf.d/99fixbadproxy

Expand All @@ -28,8 +21,6 @@ RUN rm /var/lib/apt/lists/* -vf

# Base dependencies

# apt-get -y --force-yes install \

RUN apt-get -y update && \
apt-get -y dist-upgrade && \
apt-get -y install \
Expand Down Expand Up @@ -68,42 +59,47 @@ RUN mkdir -p /var/log/supervisor && \
COPY ssh/id_rsa .ssh/id_rsa
COPY bash/profile .profile

# Configure MySql
#COPY scripts/setup_mysql.sh /tmp/setup_mysql.sh

#RUN /tmp/setup_mysql.sh

# Install InfluxDB
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
dpkg -i influxdb_${INFLUXDB_VERSION}_amd64.deb && rm influxdb_${INFLUXDB_VERSION}_amd64.deb

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

# Install Telegraf
RUN 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
dpkg -i telegraf_${TELEGRAF_VERSION}_amd64.deb && rm telegraf_${TELEGRAF_VERSION}_amd64.deb

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

# Install chronograf
RUN wget https://dl.influxdata.com/chronograf/releases/chronograf_${CHRONOGRAF_VERSION}_amd64.deb && \
dpkg -i chronograf_${CHRONOGRAF_VERSION}_amd64.deb
dpkg -i chronograf_${CHRONOGRAF_VERSION}_amd64.deb && rm chronograf_${CHRONOGRAF_VERSION}_amd64.deb

# Install Grafana
RUN 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
dpkg -i grafana_${GRAFANA_VERSION}_amd64.deb && rm grafana_${GRAFANA_VERSION}_amd64.deb

# Configure Grafana with provisioning
ADD grafana/provisioning /etc/grafana/provisioning
ADD grafana/dashboards /var/lib/grafana/dashboards
COPY grafana/grafana.ini /etc/grafana/grafana.ini

VOLUME /var/lib/influxdb
VOLUME /var/lib/grafana
# Update mibs
#RUN /usr/bin/download-mibs

# Synology SNMP
COPY synology/synology.conf /etc/telegraf/telegraf.d
COPY synology/Synology_MIB_File.tar.gz /tmp
RUN tar -xvzf /tmp/Synology_MIB_File.tar.gz -C /usr/share/snmp/mibs
RUN chown root:root /usr/share/snmp/mibs
RUN chmod 755 /usr/share/snmp/mibs

EXPOSE 22/tcp 3003/tcp 3004/tcp 8086/tcp 8125/udp
VOLUME /var/lib/influxdb /var/lib/grafana /var/lib/backups

# Cleanup
RUN apt-get clean && \
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ The main point of difference with this image is:

* Persistence is supported via mounting volumes to a Docker container
* Grafana will store its data in SQLite files instead of a MySQL table on the container, so MySQL is not installed
* Added SNMP
* Added snmp packages and Synology NAS MIBS

## Versions

* Docker Image: 2.2.0
* Ubuntu: 18.04
* InfluxDB: 1.7.2
* Telegraf (StatsD): 1.9.2-1
Expand Down
22 changes: 20 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
version: '3'

services:
webapp:
build: artlov/docker-statsd-influxdb-grafana .
app:
# build: artlov/docker-telegraf-influxdb-grafana .
image: "artlov/docker-telegraf-influxdb-grafana"
ports:
- "3003:3003"
- "3004:8888"
- "8086:8086"
- "22022:22"
- "8125:8125/udp"
volumes:
- /volume1/docker/influxdb:/var/lib/influxdb
- /volume1/docker/grafana:/var/lib/grafana
- /volume1/docker/backups:/var/backups



#test:
# override:
# - docker run -d -p 3003:3003 -p 3004:8888 -p 8086:8086 -p 22022:22 -p 8125:8125/udp artlov/docker-statsd-influxdb-grafana; sleep 15
# - curl --retry 10 --retry-delay 5 -v http://localhost:3003
# - curl --retry 10 --retry-delay 5 -v http://localhost:3004
# - curl --retry 10 --retry-delay 5 -v http://localhost:8086


# docker-compose up
# docker-compose stop
# docker-compose down
8 changes: 4 additions & 4 deletions supervisord/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ priority = 1
command = /usr/sbin/sshd -D

[program:influxdb]
priority = 3
priority = 2
command = bash -c "/etc/init.d/influxdb start && sleep 5"

[program:telegraf]
priority = 4
priority = 3
command = bash -c "sleep 30 && /etc/init.d/telegraf start"

[program:grafana]
priority = 5
priority = 4
command = /etc/init.d/grafana-server start

[program:chronograf]
priority = 6
priority = 5
command = /usr/bin/chronograf -r
Binary file added synology/Synology_MIB_File.tar.gz
Binary file not shown.
213 changes: 213 additions & 0 deletions synology/synology.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
##
## Synology
##
[[inputs.snmp]]
# List of agents to poll
# agents = [ "192.168.1.134:161" ] # required - enter the IP address of your Synology device
agents = [ "172.17.0.1" ] # required - enter the IP address of your Synology device

# Polling interval
interval = "60s"

# Timeout for each SNMP query.
timeout = "10s"

# Number of retries to attempt within timeout.
retries = 3

# SNMP version, UAP only supports v1
version = 2

# SNMP community string.
community = "public"

# The GETBULK max-repetitions parameter
max_repetitions = 30

# Measurement name
name = "snmp.SYNO"

# System name (hostname)
[[inputs.snmp.field]]
is_tag = true
name = "sysName"
oid = "RFC1213-MIB::sysName.0"
# System vendor OID
[[inputs.snmp.field]]
name = "sysObjectID"
oid = "RFC1213-MIB::sysObjectID.0"
# System description
[[inputs.snmp.field]]
name = "sysDescr"
oid = "RFC1213-MIB::sysDescr.0"
# System contact
[[inputs.snmp.field]]
name = "sysContact"
oid = "RFC1213-MIB::sysContact.0"
# System location
[[inputs.snmp.field]]
name = "sysLocation"
oid = "RFC1213-MIB::sysLocation.0"
# System uptime
[[inputs.snmp.field]]
name = "sysUpTime"
oid = "RFC1213-MIB::sysUpTime.0"
# Inet interface
[[inputs.snmp.table]]
oid = "IF-MIB::ifTable"
[[inputs.snmp.table.field]]
is_tag = true
oid = "IF-MIB::ifDescr"
#Syno disk
[[inputs.snmp.table]]
oid = "SYNOLOGY-DISK-MIB::diskTable"
[[inputs.snmp.table.field]]
is_tag = true
oid = "SYNOLOGY-DISK-MIB::diskID"
#Syno raid
[[inputs.snmp.table]]
oid = "SYNOLOGY-RAID-MIB::raidTable"
[[inputs.snmp.table.field]]
is_tag = true
oid = "SYNOLOGY-RAID-MIB::raidName"
#Syno load
[[inputs.snmp.table]]
oid = "UCD-SNMP-MIB::laTable"
[[inputs.snmp.table.field]]
is_tag = true
oid = "UCD-SNMP-MIB::laNames"
# System memTotalSwap
[[inputs.snmp.field]]
name = "memTotalSwap"
oid = "UCD-SNMP-MIB::memTotalSwap.0"
# System memAvailSwap
[[inputs.snmp.field]]
name = "memAvailSwap"
oid = "UCD-SNMP-MIB::memAvailSwap.0"
# System memTotalReal
[[inputs.snmp.field]]
name = "memTotalReal"
oid = "UCD-SNMP-MIB::memTotalReal.0"
# System memAvailReal
[[inputs.snmp.field]]
name = "memAvailReal"
oid = "UCD-SNMP-MIB::memAvailReal.0"
# System memTotalFree
[[inputs.snmp.field]]
name = "memTotalFree"
oid = "UCD-SNMP-MIB::memTotalFree.0"
# System Status
[[inputs.snmp.field]]
name = "systemStatus"
oid = "SYNOLOGY-SYSTEM-MIB::systemStatus.0"
# System temperature
[[inputs.snmp.field]]
name = "temperature"
oid = "SYNOLOGY-SYSTEM-MIB::temperature.0"
# System powerStatus
[[inputs.snmp.field]]
name = "powerStatus"
oid = "SYNOLOGY-SYSTEM-MIB::powerStatus.0"
# System systemFanStatus
[[inputs.snmp.field]]
name = "systemFanStatus"
oid = "SYNOLOGY-SYSTEM-MIB::systemFanStatus.0"
# System cpuFanStatus
[[inputs.snmp.field]]
name = "cpuFanStatus"
oid = "SYNOLOGY-SYSTEM-MIB::cpuFanStatus.0"
# System modelName
[[inputs.snmp.field]]
name = "modelName"
oid = "SYNOLOGY-SYSTEM-MIB::modelName.0"
# System serialNumber
[[inputs.snmp.field]]
name = "serialNumber"
oid = "SYNOLOGY-SYSTEM-MIB::serialNumber.0"
# System version
[[inputs.snmp.field]]
name = "version"
oid = "SYNOLOGY-SYSTEM-MIB::version.0"
# System upgradeAvailable
[[inputs.snmp.field]]
name = "upgradeAvailable"
oid = "SYNOLOGY-SYSTEM-MIB::upgradeAvailable.0"
# System volume
[[inputs.snmp.table]]
oid = "HOST-RESOURCES-MIB::hrStorageTable"
[[inputs.snmp.table.field]]
is_tag = true
oid = "HOST-RESOURCES-MIB::hrStorageDescr"
# System ssCpuUser
[[inputs.snmp.field]]
name = "ssCpuUser"
oid = ".1.3.6.1.4.1.2021.11.9.0"
# System ssCpuSystem
[[inputs.snmp.field]]
name = "ssCpuSystem"
oid = ".1.3.6.1.4.1.2021.11.10.0"
# System ssCpuIdle
[[inputs.snmp.field]]
name = "ssCpuIdle"
oid = ".1.3.6.1.4.1.2021.11.11.0"
# Service users CIFS
[[inputs.snmp.table.field]]
name = "usersCIFS"
oid = "SYNOLOGY-SERVICES-MIB::serviceUsers"
oid_index_suffix = "1"
# Service users AFP
[[inputs.snmp.table.field]]
name = "usersAFP"
oid = "SYNOLOGY-SERVICES-MIB::serviceUsers"
oid_index_suffix = "2"
# Service users NFS
[[inputs.snmp.table.field]]
name = "usersNFS"
oid = "SYNOLOGY-SERVICES-MIB::serviceUsers"
oid_index_suffix = "3"
# Service users FTP
[[inputs.snmp.table.field]]
name = "usersFTP"
oid = "SYNOLOGY-SERVICES-MIB::serviceUsers"
oid_index_suffix = "4"
# Service users SFTP
[[inputs.snmp.table.field]]
name = "usersSFTP"
oid = "SYNOLOGY-SERVICES-MIB::serviceUsers"
oid_index_suffix = "5"
# Service users HTTP
[[inputs.snmp.table.field]]
name = "usersHTTP"
oid = "SYNOLOGY-SERVICES-MIB::serviceUsers"
oid_index_suffix = "6"
# Service users TELNET
[[inputs.snmp.table.field]]
name = "usersTELNET"
oid = "SYNOLOGY-SERVICES-MIB::serviceUsers"
oid_index_suffix = "7"
# Service users SSH
[[inputs.snmp.table.field]]
name = "usersSSH"
oid = "SYNOLOGY-SERVICES-MIB::serviceUsers"
oid_index_suffix = "8"
# Service users OTHER
[[inputs.snmp.table.field]]
name = "usersOTHER"
oid = "SYNOLOGY-SERVICES-MIB::serviceUsers"
oid_index_suffix = "9"
# UPS Status
[[inputs.snmp.table.field]]
name = "upsStatus"
oid = "SYNOLOGY-UPS-MIB::upsInfoStatus"
# UPS Load
[[inputs.snmp.table.field]]
name = "upsLoad"
oid = "SYNOLOGY-UPS-MIB::upsInfoLoadValue"
# UPS Battery Charge
[[inputs.snmp.table.field]]
name = "upsCharge"
oid = "SYNOLOGY-UPS-MIB::upsBatteryChargeValue"
# UPS Battery Charge Warning
[[inputs.snmp.table.field]]
name = "upsWarning"
oid = "SYNOLOGY-UPS-MIB::upsBatteryChargeWarning"

0 comments on commit af50437

Please sign in to comment.