diff --git a/.env.example b/.env.example index f10db34..856af6c 100644 --- a/.env.example +++ b/.env.example @@ -18,3 +18,33 @@ DEFAULT_HOST_SECRET=8201e33f60093f2ce49f1abe6be8***** URL_LIST=[{"name":"localhost","url":"http://localhost","priority":4},{"name":"github.com","url":"https://github.com","priority":4}] ZBX_CONFIG={"authentication_type":0,"ok_period":"1d"} ZBX_ADMIN_USERS=[{"name":"user","password":"password"},{"name":"user1","password":"password"}] +GF_SECURITY_ADMIN_PASSWORD=grafana +GF_AUTH_LDAP_ENABLED=false +GF_AUTH_LDAP_ALLOW_SIGN_UP=true +#####Grafana`s LDAP Config Environments##### +#[[servers]] +LDAP_GF_HOST=172.17.0.1 +LDAP_GF_PORT=389 +LDAP_GF_USE_SSL=false +LDAP_GF_START_TLS=false +LDAP_GF_SKIP_VERIFY=false +LDAP_GF_BIND_DN=cn=admin,dc=example,dc=org +LDAP_GF_BIND_PASSWORD=admin +LDAP_GF_SEARCH_FILTER=(cn=%s) +LDAP_GF_SEARCH_BASE_DNS=dc=example,dc=org +#[servers.attributes] +LDAP_GF_NAME=giveName +LDAP_GF_SURNAME=sn +LDAP_GF_USERNAME=cn +LDAP_GF_MEMBER_OF=memberOf +LDAP_GF_EMAIL=email +#[[servers.group_mappings]] +LDAP_GF_GROUP_DN_ADMIN=cn=admins,dc=example,dc=org +LDAP_GF_ORG_ROLE_ADMIN=Admin +#[[servers.group_mappings]] +LDAP_GF_GROUP_DN_EDITOR=cn=users,dc=example,dc=org +LDAP_GF_ORG_ROLE_EDITOR=Editor +#[[servers.group_mappings]] +LDAP_GF_GROUP_DN_VIEWER=* +LDAP_GF_ORG_ROLE_VIEWER=Viewer + diff --git a/Dockerfile.grafana b/Dockerfile.grafana new file mode 100644 index 0000000..6a7b5a7 --- /dev/null +++ b/Dockerfile.grafana @@ -0,0 +1,13 @@ +ARG GRAFANA_VERSION=6.2.2 + +FROM grafana/grafana:${GRAFANA_VERSION} + +USER root + +ENV GF_INSTALL_PLUGINS=alexanderzobnin-zabbix-app + +COPY ./scripts/run.sh / + +RUN chmod +x /run.sh + +ENTRYPOINT [ "/run.sh" ] diff --git a/Vagrantfile b/Vagrantfile index 5bd6824..82b8e79 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -5,6 +5,7 @@ Vagrant.configure("2") do |config| config.vm.box = "ubuntu/xenial64" config.vm.network "private_network", ip: "192.168.33.102" config.vm.network "forwarded_port", guest: 80, host: 8080 + config.vm.network "forwarded_port", guest: 3000, host: 3000 config.vm.provider "virtualbox" do |vb| vb.memory = "2048" end @@ -33,7 +34,7 @@ Vagrant.configure("2") do |config| iotop \ htop \ mc - # + echo "Getting docker-compose from official repository..." if [ ! -e "/usr/local/bin/docker-compose" ]; then curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose diff --git a/configuration/dashboard.yaml.tmpl b/configuration/dashboard.yaml.tmpl new file mode 100644 index 0000000..bf6a4aa --- /dev/null +++ b/configuration/dashboard.yaml.tmpl @@ -0,0 +1,10 @@ +apiVersion: 1 + +providers: + - name: Zabbix + folder: + folderUid: + type: file + updateIntervalSeconds: 60 + options: + path: /var/lib/grafana/dashboards diff --git a/configuration/datasource.yaml.tmpl b/configuration/datasource.yaml.tmpl new file mode 100644 index 0000000..2a76184 --- /dev/null +++ b/configuration/datasource.yaml.tmpl @@ -0,0 +1,18 @@ +apiVersion: 1 + +datasources: +- name: Zabbix + type: alexanderzobnin-zabbix-datasource + access: proxy + url: {0}/api_jsonrpc.php + isDefault: true + jsonData: + username: admin + password: {1} + trends: true + trendsFrom: 7d + trendsRange: 4d + cacheTTL: 1h + alerting: true + version: 1 + editable: false diff --git a/configuration/grafana.ini b/configuration/grafana.ini new file mode 100644 index 0000000..f6b476f --- /dev/null +++ b/configuration/grafana.ini @@ -0,0 +1,529 @@ +##################### Grafana Configuration ExamplerR ##################### +# +# Everything has defaults so you only need to uncomment things you want to +# change + +# possible values : production, development +;app_mode = production + +# instance name, defaults to HOSTNAME environment variable value or hostname if HOSTNAME var is empty +;instance_name = ${HOSTNAME} + +#################################### Paths #################################### +[paths] +# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used) +;data = /var/lib/grafana + +# Temporary files in `data` directory older than given duration will be removed +;temp_data_lifetime = 24h + +# Directory where grafana can store logs +;logs = /var/log/grafana + +# Directory where grafana will automatically scan and look for plugins +;plugins = /var/lib/grafana/plugins + +# folder that contains provisioning config files that grafana will apply on startup and while running. +;provisioning = conf/provisioning + +#################################### Server #################################### +[server] +# Protocol (http, https, socket) +;protocol = http + +# The ip address to bind to, empty will bind to all interfaces +;http_addr = + +# The http port to use +;http_port = 3000 + +# The public facing domain name used to access grafana from a browser +;domain = localhost + +# Redirect to correct domain if host header does not match domain +# Prevents DNS rebinding attacks +;enforce_domain = false + +# The full public facing url you use in browser, used for redirects and emails +# If you use reverse proxy and sub path specify full url (with sub path) +root_url = %(protocol)s://%(domain)s/grafana/ + +# Log web requests +;router_logging = false + +# the path relative working path +;static_root_path = public + +# enable gzip +;enable_gzip = false + +# https certs & key file +;cert_file = +;cert_key = + +# Unix socket path +;socket = + +#################################### Database #################################### +[database] +# You can configure the database connection by specifying type, host, name, user and password +# as separate properties or as on string using the url properties. + +# Either "mysql", "postgres" or "sqlite3", it's your choice +;type = sqlite3 +;host = 127.0.0.1:3306 +;name = grafana +;user = root +# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;""" +;password = + +# Use either URL or the previous fields to configure the database +# Example: mysql://user:secret@host:port/database +;url = + +# For "postgres" only, either "disable", "require" or "verify-full" +;ssl_mode = disable + +# For "sqlite3" only, path relative to data_path setting +;path = grafana.db + +# Max idle conn setting default is 2 +;max_idle_conn = 2 + +# Max conn setting default is 0 (mean not set) +;max_open_conn = + +# Connection Max Lifetime default is 14400 (means 14400 seconds or 4 hours) +;conn_max_lifetime = 14400 + +# Set to true to log the sql calls and execution times. +log_queries = + +# For "sqlite3" only. cache mode setting used for connecting to the database. (private, shared) +;cache_mode = private + +#################################### Cache server ############################# +[remote_cache] +# Either "redis", "memcached" or "database" default is "database" +;type = database + +# cache connectionstring options +# database: will use Grafana primary database. +# redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=grafana` +# memcache: 127.0.0.1:11211 +;connstr = + +#################################### Data proxy ########################### +[dataproxy] + +# This enables data proxy logging, default is false +;logging = false + +# How long the data proxy should wait before timing out default is 30 (seconds) +;timeout = 30 + +# If enabled and user is not anonymous, data proxy will add X-Grafana-User header with username into the request, default is false. +;send_user_header = false + +#################################### Analytics #################################### +[analytics] +# Server reporting, sends usage counters to stats.grafana.org every 24 hours. +# No ip addresses are being tracked, only simple counters to track +# running instances, dashboard and error counts. It is very helpful to us. +# Change this option to false to disable reporting. +;reporting_enabled = true + +# Set to false to disable all checks to https://grafana.net +# for new vesions (grafana itself and plugins), check is used +# in some UI views to notify that grafana or plugin update exists +# This option does not cause any auto updates, nor send any information +# only a GET request to http://grafana.com to get latest versions +;check_for_updates = true + +# Google Analytics universal tracking code, only enabled if you specify an id here +;google_analytics_ua_id = + +# Google Tag Manager ID, only enabled if you specify an id here +;google_tag_manager_id = + +#################################### Security #################################### +[security] +# default admin user, created on startup +;admin_user = admin + +# default admin password, can be changed before first start of grafana, or in profile settings +;admin_password = admin + +# used for signing +;secret_key = SW2YcwTIb9zpOOhoPsMm + +# disable gravatar profile images +;disable_gravatar = false + +# data source proxy whitelist (ip_or_domain:port separated by spaces) +;data_source_proxy_whitelist = + +# disable protection against brute force login attempts +;disable_brute_force_login_protection = false + +# set to true if you host Grafana behind HTTPS. default is false. +;cookie_secure = false + +# set cookie SameSite attribute. defaults to `lax`. can be set to "lax", "strict" and "none" +;cookie_samesite = lax + +# set to true if you want to allow browsers to render Grafana in a ,