Commit d8c01a07 authored by lixin's avatar lixin

zabbix server 5.2.1

parent 19894b6b
This diff is collapsed.
# zabbix-server
# zabbix-server 5.2.1
#!/bin/bash
set +e
if [ ! -f "Dockerfile" ]; then
echo "Dockerfile is missing!"
exit 1
fi
os=${PWD##*/}
version=$1
version=${version:-"latest"}
type=$2
type=${type:-"build"}
cd ../
app_component=${PWD##*/}
cd $os/
if [ "$app_component" == "zabbix-appliance" ]; then
app_component="appliance"
fi
if [[ ! $version =~ ^[0-9]*\.[0-9]*\.[0-9]*$ ]] && [ "$version" != "latest" ]; then
echo "Incorrect syntax of the version"
exit 1
fi
if [ "$version" != "latest" ]; then
VCS_REF=`git ls-remote https://git.zabbix.com/scm/zbx/zabbix.git refs/tags/$version | cut -c1-10`
else
MAJOR_VERSION=`cat Dockerfile | grep "ARG MAJOR_VERSION" | head -n1 | cut -f2 -d"="`
MINOR_VERSION=`cat Dockerfile | grep "ARG ZBX_VERSION" | head -n1 | cut -f2 -d"."`
VCS_REF=$MAJOR_VERSION.$MINOR_VERSION
fi
docker build -t zabbix-$app_component:$os-$version --build-arg VCS_REF="$VCS_REF" --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` -f Dockerfile .
if [ "$type" != "build" ]; then
links=""
env_vars=""
if [[ $app_component =~ .*mysql.* ]]; then
links="$links --link mysql-server:mysql"
env_vars="$env_vars -e MYSQL_DATABASE=\"zabbix\" -e MYSQL_USER=\"zabbix\" -e MYSQL_PASSWORD=\"zabbix\" -e MYSQL_RANDOM_ROOT_PASSWORD=true"
docker rm -f mysql-server
docker run --name mysql-server -t $env_vars -d mysql:5.7
fi
if [ "$links" != "" ]; then
sleep 5
fi
docker rm -f zabbix-$app_component
docker run --name zabbix-$app_component -t -d $links $env_vars zabbix-$app_component:$os-$version
fi
\ No newline at end of file
#!/bin/bash
docker rmi $(docker images -f dangling=true -q)
#!/usr/bin/env bash
set -eu
declare -a -r versions=( 3.0.28 4.0.11 4.2.5 )
self="${BASH_SOURCE##*/}"
# get the most recent commit which modified any of "$@"
fileCommit() {
git log -1 --format='format:%H' HEAD -- "$@"
}
# prints "$2$1$3$1...$N"
join() {
local sep="$1"; shift
local out; printf -v out "${sep//%/%%}%s" "$@"
echo "${out#$sep}"
}
cat <<-EOH
# this file is generated via https://github.com/zabbix/zabbix-docker/blob/$(fileCommit "$self")/$self
Maintainers: Alexey Pustovalov <alexey.pustovalov@zabbix.com> (@dotneft)
GitRepo: https://github.com/zabbix/zabbix-docker.git
EOH
for version in "${versions[@]}"; do
major_version=${version%.*}
commit=`git rev-list -n 1 "$version"`
for component in agent java-gateway proxy-{mysql,sqlite3} server-{mysql,pgsql} web-{apache,nginx}-{mysql,pgsql}; do
for variant in alpine; do
dir="${component}/${variant}"
[ -f "$dir/Dockerfile" ] || continue
variantArches=( amd64 )
echo
cat <<-EOE
Tags: $version-$component, $major_version-$component
Architectures: $(join ', ' "${variantArches[@]}")
GitCommit: $commit
GitFetch: refs/heads/$major_version
Directory: $dir
EOE
done
done
done
#!/bin/bash
PRG="$0"
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done
PRGDIR=`dirname "$PRG"`
cd "$PRGDIR"/../
docker-compose ps
#!/bin/bash
PRG="$0"
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done
PRGDIR=`dirname "$PRG"`
cd "$PRGDIR"/../etc/standalone
docker-compose up -d
#!/bin/bash
PRG="$0"
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done
PRGDIR=`dirname "$PRG"`
cd "$PRGDIR"/../etc/standalone
docker-compose down -v
#!/bin/bash
PRG="$0"
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done
PRGDIR=`dirname "$PRG"`
cd "$PRGDIR"/../etc/standalone
docker-compose pull
This diff is collapsed.
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# The MySQL Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
secure-file-priv= NULL
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
# Custom config should go here
!includedir /etc/mysql/conf.d/
LogType=console
Server=192.168.10.161
#ServerActive=zabbix-server
Include=/etc/zabbix/zabbix_agentd.d/
#Hostname为agent所在机器的ip地址或主机名
Hostname=192.168.10.161
LoadModulePath=/var/lib/zabbix/modules/
\ No newline at end of file
#template_db_mysql.conf created by Zabbix for "Template DB MySQL" and Zabbix 4.2
#For OS Linux: You need create .my.cnf in zabbix-agent home directory (/var/lib/zabbix by default)
#For OS Windows: You need add PATH to mysql and mysqladmin and create my.cnf in %WINDIR%\my.cnf,C:\my.cnf,BASEDIR\my.cnf https://dev.mysql.com/doc/refman/5.7/en/option-files.html
#The file must have three strings:
#[client]
#user=zabbix
#password=zabbix
#
UserParameter=mysql.ping[*], mysqladmin -h"$1" -P"$2" ping
UserParameter=mysql.get_status_variables[*], mysql -h"$1" -P"$2" -sNX -e "show global status"
UserParameter=mysql.version[*], mysqladmin -s -h"$1" -P"$2" version
UserParameter=mysql.db.discovery[*], mysql -h"$1" -P"$2" -sN -e "show databases"
UserParameter=mysql.dbsize[*], mysql -h"$1" -P"$2" -sN -e "SELECT SUM(DATA_LENGTH + INDEX_LENGTH) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='$3'"
UserParameter=mysql.replication.discovery[*], mysql -h"$1" -P"$2" -sNX -e "show slave status"
UserParameter=mysql.slave_status[*], mysql -h"$1" -P"$2" -sNX -e "show slave status"
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment