mirror of
https://github.com/tiredofit/docker-db-backup.git
synced 2025-12-21 21:33:28 +01:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca31eb840d | ||
|
|
6bec188633 | ||
|
|
43562077b0 | ||
|
|
c39bdeebae | ||
|
|
36b5909483 | ||
|
|
6033b1b0a9 | ||
|
|
88218915e1 | ||
|
|
065887f789 | ||
|
|
5aba713b73 | ||
|
|
9a6039d71d | ||
|
|
c5f1618231 | ||
|
|
7dd9fa890f | ||
|
|
b62554ceff |
41
CHANGELOG.md
41
CHANGELOG.md
@@ -1,3 +1,44 @@
|
||||
## 2.11.1 2022-01-20 <jacksgt@github>
|
||||
|
||||
### Changed
|
||||
- Modernized S3 variables and sanity checks
|
||||
- Change exit code to 0 when executing a manual backup
|
||||
|
||||
|
||||
## 2.11.0 2022-01-20 <dave at tiredofit dot ca>
|
||||
|
||||
### Added
|
||||
- Add capability to select `TEMP_LOCATION` for initial backup and compression before backup completes to avoid filling system memory
|
||||
|
||||
### Changed
|
||||
- Cleanup for MariaDB/MySQL DB ready routines that half worked in 2.10.3
|
||||
- Code cleanup
|
||||
|
||||
|
||||
## 2.10.3 2022-01-07 <dave at tiredofit dot ca>
|
||||
|
||||
### Changed
|
||||
- Change the way MariaD/MySQL connectivity check is performed to allow for better compatibility without requiring the DB_USER to have PROCESS privileges
|
||||
|
||||
|
||||
## 2.10.2 2021-12-28 <dave at tiredofit dot ca>
|
||||
|
||||
### Changed
|
||||
- Remove logrotate configuration for redis which shouldn't exist in the first place
|
||||
|
||||
|
||||
## 2.10.1 2021-12-22 <milenkara@github>
|
||||
|
||||
### Added
|
||||
- Allow for choosing region when backing up to S3
|
||||
|
||||
## 2.10.0 2021-12-22 <dave at tiredofit dot ca>
|
||||
|
||||
### Changed
|
||||
- Revert back to Postgresql 14 from packages as its now in the repositories
|
||||
- Fix for Zabbix Monitoring
|
||||
|
||||
|
||||
## 2.9.7 2021-12-15 <dave at tiredofit dot ca>
|
||||
|
||||
### Changed
|
||||
|
||||
103
Dockerfile
103
Dockerfile
@@ -5,104 +5,8 @@ ENV MSSQL_VERSION=17.8.1.1-1 \
|
||||
CONTAINER_ENABLE_MESSAGING=FALSE \
|
||||
CONTAINER_ENABLE_MONITORING=TRUE
|
||||
|
||||
ENV LANG=en_US.utf8 \
|
||||
PG_MAJOR=14 \
|
||||
PG_VERSION=14.0 \
|
||||
PGDATA=/var/lib/postgresql/data
|
||||
|
||||
### Create User Accounts
|
||||
RUN set -ex && \
|
||||
addgroup -g 70 postgres && \
|
||||
adduser -S -D -H -h /var/lib/postgresql -s /bin/sh -G postgres -u 70 postgres && \
|
||||
mkdir -p /var/lib/postgresql && \
|
||||
chown -R postgres:postgres /var/lib/postgresql && \
|
||||
\
|
||||
### Install Dependencies
|
||||
apk update && \
|
||||
apk upgrade && \
|
||||
apk add \
|
||||
openssl \
|
||||
&& \
|
||||
\
|
||||
apk add --no-cache --virtual .postgres-build-deps \
|
||||
bison \
|
||||
build-base \
|
||||
coreutils \
|
||||
dpkg-dev \
|
||||
dpkg \
|
||||
flex \
|
||||
gcc \
|
||||
icu-dev \
|
||||
libc-dev \
|
||||
libedit-dev \
|
||||
libxml2-dev \
|
||||
libxslt-dev \
|
||||
linux-headers \
|
||||
make \
|
||||
openssl-dev \
|
||||
perl-utils \
|
||||
perl-ipc-run \
|
||||
util-linux-dev \
|
||||
zlib-dev \
|
||||
&& \
|
||||
\
|
||||
### Build Postgresql
|
||||
mkdir -p /usr/src/postgresql && \
|
||||
curl -sSL "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2" | tar xvfj - --strip 1 -C /usr/src/postgresql && \
|
||||
cd /usr/src/postgresql && \
|
||||
# update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian)
|
||||
# see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f
|
||||
awk '$1 == "#define" && $2 == "DEFAULT_PGSOCKET_DIR" && $3 == "\"/tmp\"" { $3 = "\"/var/run/postgresql\""; print; next } { print }' src/include/pg_config_manual.h > src/include/pg_config_manual.h.new && \
|
||||
grep '/var/run/postgresql' src/include/pg_config_manual.h.new && \
|
||||
mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h && \
|
||||
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" && \
|
||||
# explicitly update autoconf config.guess and config.sub so they support more arches/libcs
|
||||
wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb' && \
|
||||
wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb' && \
|
||||
./configure \
|
||||
--build="$gnuArch" \
|
||||
--enable-integer-datetimes \
|
||||
--enable-thread-safety \
|
||||
--enable-tap-tests \
|
||||
--disable-rpath \
|
||||
--with-uuid=e2fs \
|
||||
--with-gnu-ld \
|
||||
--with-pgport=5432 \
|
||||
--with-system-tzdata=/usr/share/zoneinfo \
|
||||
--prefix=/usr/local \
|
||||
--with-includes=/usr/local/include \
|
||||
--with-libraries=/usr/local/lib \
|
||||
--with-openssl \
|
||||
--with-libxml \
|
||||
--with-libxslt \
|
||||
--with-icu \
|
||||
&& \
|
||||
\
|
||||
make -j "$(nproc)" world && \
|
||||
make install-world && \
|
||||
make -C contrib install && \
|
||||
runDeps="$( \
|
||||
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
|
||||
| tr ',' '\n' \
|
||||
| sort -u \
|
||||
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
|
||||
)" && \
|
||||
apk add -t .postgres-additional-deps \
|
||||
$runDeps \
|
||||
&& \
|
||||
\
|
||||
### Cleanup
|
||||
apk del .postgres-build-deps && \
|
||||
cd / && \
|
||||
rm -rf \
|
||||
/usr/src/postgresql \
|
||||
/usr/local/share/doc \
|
||||
/usr/local/share/man && \
|
||||
find /usr/local -name '*.a' -delete && \
|
||||
rm -rf /var/cache/apk/* && \
|
||||
\
|
||||
### Dependencies
|
||||
set -ex && \
|
||||
RUN set -ex && \
|
||||
apk update && \
|
||||
apk upgrade && \
|
||||
apk add -t .db-backup-build-deps \
|
||||
@@ -123,8 +27,8 @@ RUN set -ex && \
|
||||
mongodb-tools \
|
||||
libressl \
|
||||
pigz \
|
||||
#postgresql \ # To reactivate when it appears in official repos with Alpine 3.15
|
||||
#postgresql-client \ # To reactivate when it appears in official repos with Alpine 3.15
|
||||
postgresql \
|
||||
postgresql-client \
|
||||
redis \
|
||||
sqlite \
|
||||
xz \
|
||||
@@ -157,6 +61,7 @@ RUN set -ex && \
|
||||
### Cleanup
|
||||
apk del .db-backup-build-deps && \
|
||||
rm -rf /usr/src/* && \
|
||||
rm -rf /etc/logrotate.d/redis && \
|
||||
rm -rf /root/.cache /tmp/* /var/cache/apk/*
|
||||
|
||||
### S6 Setup
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2021 Dave Conroy
|
||||
Copyright (c) 2022 Dave Conroy
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
58
README.md
58
README.md
@@ -109,31 +109,36 @@ Be sure to view the following repositories to understand all the customizable op
|
||||
| [OS Base](https://github.com/tiredofit/docker-alpine/) | Customized Image based on Alpine Linux |
|
||||
|
||||
|
||||
| Parameter | Description |
|
||||
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `BACKUP_LOCATION` | Backup to `FILESYSTEM` or `S3` compatible services like S3, Minio, Wasabi - Default `FILESYSTEM` |
|
||||
| `COMPRESSION` | Use either Gzip `GZ`, Bzip2 `BZ`, XZip `XZ`, ZSTD `ZSTD` or none `NONE` - Default `GZ` |
|
||||
| `COMPRESSION_LEVEL` | Numberical value of what level of compression to use, most allow `1` to `9` except for `ZSTD` which allows for `1` to `19` - Default `3` |
|
||||
| `DB_AUTH` | (Mongo Only - Optional) Authentication Database |
|
||||
| `DB_TYPE` | Type of DB Server to backup `couch` `influx` `mysql` `pgsql` `mongo` `redis` `sqlite3` |
|
||||
| `DB_HOST` | Server Hostname e.g. `mariadb`. For `sqlite3`, full path to DB file e.g. `/backup/db.sqlite3` |
|
||||
| `DB_NAME` | Schema Name e.g. `database` |
|
||||
| `DB_USER` | username for the database - use `root` to backup all MySQL of them. |
|
||||
| `DB_PASS` | (optional if DB doesn't require it) password for the database |
|
||||
| `DB_PORT` | (optional) Set port to connect to DB_HOST. Defaults are provided |
|
||||
| `DB_DUMP_FREQ` | How often to do a dump, in minutes. Defaults to 1440 minutes, or once per day. |
|
||||
| `DB_DUMP_BEGIN` | What time to do the first dump. Defaults to immediate. Must be in one of two formats |
|
||||
| | Absolute HHMM, e.g. `2330` or `0415` |
|
||||
| | Relative +MM, i.e. how many minutes after starting the container, e.g. `+0` (immediate), `+10` (in 10 minutes), or `+90` in an hour and a half |
|
||||
| `DB_CLEANUP_TIME` | Value in minutes to delete old backups (only fired when dump freqency fires). 1440 would delete anything above 1 day old. You don't need to set this variable if you want to hold onto everything. |
|
||||
| `DEBUG_MODE` | If set to `true`, print copious shell script messages to the container log. Otherwise only basic messages are printed. |
|
||||
| `EXTRA_OPTS` | If you need to pass extra arguments to the backup command, add them here e.g. "--extra-command" |
|
||||
| `MD5` | Generate MD5 Sum in Directory, `TRUE` or `FALSE` - Default `TRUE` |
|
||||
| `PARALLEL_COMPRESSION` | Use multiple cores when compressing backups `TRUE` or `FALSE` - Default `TRUE` |
|
||||
| `POST_SCRIPT` | Fill this variable in with a command to execute post the script backing up | |
|
||||
| `SPLIT_DB` | If using root as username and multiple DBs on system, set to TRUE to create Seperate DB Backups instead of all in one. - Default `FALSE` |
|
||||
| Parameter | Description | Default |
|
||||
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- |
|
||||
| `BACKUP_LOCATION` | Backup to `FILESYSTEM` or `S3` compatible services like S3, Minio, Wasabi | `FILESYSTEM` |
|
||||
| `COMPRESSION` | Use either Gzip `GZ`, Bzip2 `BZ`, XZip `XZ`, ZSTD `ZSTD` or none `NONE` | `GZ` |
|
||||
| `COMPRESSION_LEVEL` | Numberical value of what level of compression to use, most allow `1` to `9` except for `ZSTD` which allows for `1` to `19` - | `3` |
|
||||
| `DB_AUTH` | (Mongo Only - Optional) Authentication Database | |
|
||||
| `DB_TYPE` | Type of DB Server to backup `couch` `influx` `mysql` `pgsql` `mongo` `redis` `sqlite3` | |
|
||||
| `DB_HOST` | Server Hostname e.g. `mariadb`. For `sqlite3`, full path to DB file e.g. `/backup/db.sqlite3` | |
|
||||
| `DB_NAME` | Schema Name e.g. `database` | |
|
||||
| `DB_USER` | username for the database - use `root` to backup all MySQL of them. | |
|
||||
| `DB_PASS` | (optional if DB doesn't require it) password for the database | |
|
||||
| `DB_PORT` | (optional) Set port to connect to DB_HOST. Defaults are provided | varies |
|
||||
| `DB_DUMP_FREQ` | How often to do a dump, in minutes. Defaults to 1440 minutes, or once per day. | `1440` |
|
||||
| `DB_DUMP_BEGIN` | What time to do the first dump. Defaults to immediate. Must be in one of two formats | |
|
||||
| | Absolute HHMM, e.g. `2330` or `0415` | |
|
||||
| | Relative +MM, i.e. how many minutes after starting the container, e.g. `+0` (immediate), `+10` (in 10 minutes), or `+90` in an hour and a half | |
|
||||
| `DB_CLEANUP_TIME` | Value in minutes to delete old backups (only fired when dump freqency fires). 1440 would delete anything above 1 day old. You don't need to set this variable if you want to hold onto everything. | `FALSE` |
|
||||
| `DEBUG_MODE` | If set to `true`, print copious shell script messages to the container log. Otherwise only basic messages are printed. | |
|
||||
| `EXTRA_OPTS` | If you need to pass extra arguments to the backup command, add them here e.g. `--extra-command` | |
|
||||
| `MYSQL_MAX_ALLOWED_PACKET` | Max allowed packet if backing up MySQL / MariaDB | `512M` |
|
||||
| `MD5` | Generate MD5 Sum in Directory, `TRUE` or `FALSE` | `TRUE` |
|
||||
| `PARALLEL_COMPRESSION` | Use multiple cores when compressing backups `TRUE` or `FALSE` | `TRUE` |
|
||||
| `POST_SCRIPT` | Fill this variable in with a command to execute post the script backing up | |
|
||||
| `SPLIT_DB` | If using root as username and multiple DBs on system, set to TRUE to create Seperate DB Backups instead of all in one. | `FALSE` |
|
||||
| `TEMP_LOCATION` | Perform Backups and Compression in this temporary directory | `/tmp/backups/` |
|
||||
|
||||
- When using compression with MongoDB, only `GZ` compression is possible.
|
||||
- You may need to wrap your `DB_DUMP_BEGIN` value in quotes for it to properly parse. There have been reports of backups that start with a `0` get converted into a different format which will not allow the timer to start at the correct time.
|
||||
|
||||
|
||||
When using compression with MongoDB, only `GZ` compression is possible.
|
||||
|
||||
#### Backing Up to S3 Compatible Services
|
||||
|
||||
@@ -141,12 +146,13 @@ If `BACKUP_LOCATION` = `S3` then the following options are used.
|
||||
|
||||
| Parameter | Description |
|
||||
| --------------- | --------------------------------------------------------------------------------------- |
|
||||
| `S3_BUCKET` | S3 Bucket name e.g. 'mybucket' |
|
||||
| `S3_HOST` | Hostname of S3 Server e.g "s3.amazonaws.com" - You can also include a port if necessary |
|
||||
| `S3_BUCKET` | S3 Bucket name e.g. `mybucket` |
|
||||
| `S3_ENDPOINT` | URL of S3-compatible endpoint, e.g. `http://minio:8080` |
|
||||
| `S3_KEY_ID` | S3 Key ID |
|
||||
| `S3_KEY_SECRET` | S3 Key Secret |
|
||||
| `S3_PATH` | S3 Pathname to save to e.g. '`backup`' |
|
||||
| `S3_PROTOCOL` | Use either `http` or `https` to access service - Default `https` |
|
||||
| `S3_REGION` | Define region in which bucket is defined. Example: `ap-northeast-2` |
|
||||
|
||||
|
||||
## Maintenance
|
||||
|
||||
@@ -39,7 +39,8 @@ case "$dbtype" in
|
||||
dbtype=mysql
|
||||
dbport=${DB_PORT:-3306}
|
||||
[[ ( -n "${DB_PASS}" ) || ( -n "${DB_PASS_FILE}" ) ]] && file_env 'DB_PASS'
|
||||
;;
|
||||
MYSQL_MAX_ALLOWED_PACKET=${MYSQL_MAX_ALLOWED_PACKET:-"512M"}
|
||||
;;
|
||||
"mssql" | "MSSQL" | "microsoftsql" | "MICROSOFTSQL")
|
||||
apkArch="$(apk --print-arch)"; \
|
||||
case "$apkArch" in
|
||||
@@ -66,29 +67,29 @@ esac
|
||||
|
||||
### Set Defaults
|
||||
BACKUP_LOCATION=${BACKUP_LOCATION:-"FILESYSTEM"}
|
||||
COMPRESSION=${COMPRESSION:-GZ}
|
||||
COMPRESSION=${COMPRESSION:-"GZ"}
|
||||
COMPRESSION_LEVEL=${COMPRESSION_LEVEL:-"3"}
|
||||
DB_DUMP_BEGIN=${DB_DUMP_BEGIN:-+0}
|
||||
DB_DUMP_FREQ=${DB_DUMP_FREQ:-1440}
|
||||
DB_DUMP_TARGET=${DB_DUMP_TARGET:-/backup}
|
||||
DB_DUMP_TARGET=${DB_DUMP_TARGET:-"/backup"}
|
||||
dbhost=${DB_HOST}
|
||||
dbname=${DB_NAME}
|
||||
dbpass=${DB_PASS}
|
||||
dbuser=${DB_USER}
|
||||
MD5=${MD5:-TRUE}
|
||||
PARALLEL_COMPRESSION=${PARALLEL_COMPRESSION:-TRUE}
|
||||
PARALLEL_COMPRESSION=${PARALLEL_COMPRESSION:-"TRUE"}
|
||||
SIZE_VALUE=${SIZE_VALUE:-"bytes"}
|
||||
SPLIT_DB=${SPLIT_DB:-FALSE}
|
||||
tmpdir=/tmp/backups
|
||||
SPLIT_DB=${SPLIT_DB:-"FALSE"}
|
||||
TEMP_LOCATION=${TEMP_LOCATION:-"/tmp/backups"}
|
||||
|
||||
if [ "$BACKUP_TYPE" = "S3" ] || [ "$BACKUP_TYPE" = "s3" ] || [ "$BACKUP_TYPE" = "MINIO" ] || [ "$BACKUP_TYPE" = "minio" ] ; then
|
||||
if [ "$BACKUP_LOCATION" = "S3" ] || [ "$BACKUP_LOCATION" = "s3" ] || [ "$BACKUP_LOCATION" = "MINIO" ] || [ "$BACKUP_LOCATION" = "minio" ] ; then
|
||||
S3_PROTOCOL=${S3_PROTOCOL:-"https"}
|
||||
sanity_var S3_HOST "S3 Host"
|
||||
sanity_var S3_ENDPOINT "S3 Endpoint URL"
|
||||
sanity_var S3_BUCKET "S3 Bucket"
|
||||
sanity_var S3_KEY_ID "S3 Key ID"
|
||||
sanity_var S3_KEY_SECRET "S3 Key Secret"
|
||||
sanity_var S3_URI_STYLE "S3 URI Style (Virtualhost or Path)"
|
||||
sanity_var S3_PATH "S3 Path"
|
||||
sanity_var S3_REGION "S3 Region"
|
||||
file_env 'S3_KEY_ID'
|
||||
file_env 'S3_KEY_SECRET'
|
||||
fi
|
||||
@@ -99,7 +100,7 @@ if [ "$1" = "NOW" ]; then
|
||||
fi
|
||||
|
||||
### Set Compression Options
|
||||
if var_true "$PARALLEL_COMPRESSION" ; then
|
||||
if var_true "${PARALLEL_COMPRESSION}" ; then
|
||||
bzip="pbzip2 -${COMPRESSION_LEVEL}"
|
||||
gzip="pigz -${COMPRESSION_LEVEL}"
|
||||
xzip="pixz -${COMPRESSION_LEVEL}"
|
||||
@@ -134,7 +135,7 @@ esac
|
||||
backup_couch() {
|
||||
target=couch_${dbname}_${dbhost}_${now}.txt
|
||||
compression
|
||||
curl -X GET http://${dbhost}:${dbport}/${dbname}/_all_docs?include_docs=true ${dumpoutput} | $dumpoutput > ${tmpdir}/${target}
|
||||
curl -X GET http://${dbhost}:${dbport}/${dbname}/_all_docs?include_docs=true ${dumpoutput} | $dumpoutput > ${TEMP_LOCATION}/${target}
|
||||
exit_code=$?
|
||||
generate_md5
|
||||
move_backup
|
||||
@@ -147,9 +148,9 @@ backup_influx() {
|
||||
print_notice "Compressing InfluxDB backup with gzip"
|
||||
influx_compression="-portable"
|
||||
fi
|
||||
for DB in $DB_NAME; do
|
||||
for DB in ${DB_NAME}; do
|
||||
target=influx_${DB}_${dbhost}_${now}
|
||||
influxd backup ${influx_compression} -database $DB -host ${dbhost}:${dbport} ${tmpdir}/${target}
|
||||
influxd backup ${influx_compression} -database $DB -host ${dbhost}:${dbport} ${TEMP_LOCATION}/${target}
|
||||
exit_code=$?
|
||||
generate_md5
|
||||
move_backup
|
||||
@@ -164,28 +165,28 @@ backup_mongo() {
|
||||
target=${dbtype}_${dbname}_${dbhost}_${now}.archivegz
|
||||
mongo_compression="--gzip"
|
||||
fi
|
||||
mongodump --archive=${tmpdir}/${target} ${mongo_compression} --host ${dbhost} --port ${dbport} ${MONGO_USER_STR}${MONGO_PASS_STR}${MONGO_AUTH_STR}${MONGO_DB_STR} ${EXTRA_OPTS}
|
||||
mongodump --archive=${TEMP_LOCATION}/${target} ${mongo_compression} --host ${dbhost} --port ${dbport} ${MONGO_USER_STR}${MONGO_PASS_STR}${MONGO_AUTH_STR}${MONGO_DB_STR} ${EXTRA_OPTS}
|
||||
exit_code=$?
|
||||
cd ${tmpdir}
|
||||
cd ${TEMP_LOCATION}
|
||||
generate_md5
|
||||
move_backup
|
||||
}
|
||||
|
||||
backup_mssql() {
|
||||
target=mssql_${dbname}_${dbhost}_${now}.bak
|
||||
/opt/mssql-tools/bin/sqlcmd -E -C -S ${dbhost}\,${dbport} -U ${dbuser} -P ${dbpass} –Q "BACKUP DATABASE \[${dbname}\] TO DISK = N'${tmpdir}/${target}' WITH NOFORMAT, NOINIT, NAME = '${dbname}-full', SKIP, NOREWIND, NOUNLOAD, STATS = 10"
|
||||
/opt/mssql-tools/bin/sqlcmd -E -C -S ${dbhost}\,${dbport} -U ${dbuser} -P ${dbpass} –Q "BACKUP DATABASE \[${dbname}\] TO DISK = N'${TEMP_LOCATION}/${target}' WITH NOFORMAT, NOINIT, NAME = '${dbname}-full', SKIP, NOREWIND, NOUNLOAD, STATS = 10"
|
||||
}
|
||||
|
||||
backup_mysql() {
|
||||
if var_true "$SPLIT_DB" ; then
|
||||
DATABASES=$(mysql -h ${dbhost} -P $dbport -u$dbuser --batch -e "SHOW DATABASES;" | grep -v Database|grep -v schema)
|
||||
if var_true "${SPLIT_DB}" ; then
|
||||
DATABASES=$(mysql -h ${dbhost} -P $dbport -u$dbuser --batch -e "SHOW DATABASES;" | grep -v Database | grep -v schema)
|
||||
|
||||
for db in $DATABASES; do
|
||||
if [[ "$db" != "information_schema" ]] && [[ "$db" != _* ]] ; then
|
||||
print_notice "Dumping MariaDB database: $db"
|
||||
target=mysql_${db}_${dbhost}_${now}.sql
|
||||
compression
|
||||
mysqldump --max-allowed-packet=512M -h $dbhost -P $dbport -u$dbuser ${EXTRA_OPTS} --databases $db | $dumpoutput > ${tmpdir}/${target}
|
||||
mysqldump --max-allowed-packet=${MYSQL_MAX_ALLOWED_PACKET} -h $dbhost -P $dbport -u$dbuser ${EXTRA_OPTS} --databases $db | $dumpoutput > ${TEMP_LOCATION}/${target}
|
||||
exit_code=$?
|
||||
generate_md5
|
||||
move_backup
|
||||
@@ -193,7 +194,7 @@ backup_mysql() {
|
||||
done
|
||||
else
|
||||
compression
|
||||
mysqldump --max-allowed-packet=512M -A -h $dbhost -P $dbport -u$dbuser ${EXTRA_OPTS} | $dumpoutput > ${tmpdir}/${target}
|
||||
mysqldump --max-allowed-packet=${MYSQL_MAX_ALLOWED_PACKET} -A -h $dbhost -P $dbport -u$dbuser ${EXTRA_OPTS} | $dumpoutput > ${TEMP_LOCATION}/${target}
|
||||
exit_code=$?
|
||||
generate_md5
|
||||
move_backup
|
||||
@@ -201,7 +202,7 @@ backup_mysql() {
|
||||
}
|
||||
|
||||
backup_pgsql() {
|
||||
if var_true $SPLIT_DB ; then
|
||||
if var_true "${SPLIT_DB}" ; then
|
||||
export PGPASSWORD=${dbpass}
|
||||
authdb=${DB_USER}
|
||||
[ -n "${DB_NAME}" ] && authdb=${DB_NAME}
|
||||
@@ -210,7 +211,7 @@ backup_pgsql() {
|
||||
print_info "Dumping database: $db"
|
||||
target=pgsql_${db}_${dbhost}_${now}.sql
|
||||
compression
|
||||
pg_dump -h ${dbhost} -p ${dbport} -U ${dbuser} $db ${EXTRA_OPTS} | $dumpoutput > ${tmpdir}/${target}
|
||||
pg_dump -h ${dbhost} -p ${dbport} -U ${dbuser} $db ${EXTRA_OPTS} | $dumpoutput > ${TEMP_LOCATION}/${target}
|
||||
exit_code=$?
|
||||
generate_md5
|
||||
move_backup
|
||||
@@ -218,7 +219,7 @@ backup_pgsql() {
|
||||
else
|
||||
export PGPASSWORD=${dbpass}
|
||||
compression
|
||||
pg_dump -h ${dbhost} -U ${dbuser} -p ${dbport} ${dbname} ${EXTRA_OPTS} | $dumpoutput > ${tmpdir}/${target}
|
||||
pg_dump -h ${dbhost} -U ${dbuser} -p ${dbport} ${dbname} ${EXTRA_OPTS} | $dumpoutput > ${TEMP_LOCATION}/${target}
|
||||
exit_code=$?
|
||||
generate_md5
|
||||
move_backup
|
||||
@@ -227,7 +228,7 @@ backup_pgsql() {
|
||||
|
||||
backup_redis() {
|
||||
target=redis_${db}_${dbhost}_${now}.rdb
|
||||
echo bgsave | redis-cli -h ${dbhost} -p ${dbport} ${REDIS_PASS_STR} --rdb ${tmpdir}/${target} ${EXTRA_OPTS}
|
||||
echo bgsave | redis-cli -h ${dbhost} -p ${dbport} ${REDIS_PASS_STR} --rdb ${TEMP_LOCATION}/${target} ${EXTRA_OPTS}
|
||||
print_info "Dumping Redis - Flushing Redis Cache First"
|
||||
sleep 10
|
||||
try=5
|
||||
@@ -244,7 +245,7 @@ backup_redis() {
|
||||
done
|
||||
target_original=${target}
|
||||
compression
|
||||
$dumpoutput "${tmpdir}/${target_original}"
|
||||
$dumpoutput "${TEMP_LOCATION}/${target_original}"
|
||||
generate_md5
|
||||
move_backup
|
||||
}
|
||||
@@ -256,10 +257,10 @@ backup_sqlite3() {
|
||||
compression
|
||||
|
||||
print_info "Dumping sqlite3 database: ${dbhost}"
|
||||
sqlite3 "${dbhost}" ".backup '${tmpdir}/backup.sqlite3'"
|
||||
sqlite3 "${dbhost}" ".backup '${TEMP_LOCATION}/backup.sqlite3'"
|
||||
exit_code=$?
|
||||
|
||||
cat "${tmpdir}/backup.sqlite3" | $dumpoutput > "${tmpdir}/${target}"
|
||||
cat "${TEMP_LOCATION}/backup.sqlite3" | $dumpoutput > "${TEMP_LOCATION}/${target}"
|
||||
|
||||
generate_md5
|
||||
move_backup
|
||||
@@ -295,17 +296,10 @@ check_availability() {
|
||||
"mysql" )
|
||||
COUNTER=0
|
||||
export MYSQL_PWD=${dbpass}
|
||||
while true; do
|
||||
mysqlcmd='mysql -u'${dbuser}' -P '${dbport}' -h '${dbhost}
|
||||
out="$($mysqlcmd -e "SELECT COUNT(*) FROM information_schema.FILES;" 2>&1)"
|
||||
echo "$out" | grep -E "COUNT|Enter" 2>&1 > /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
:
|
||||
break
|
||||
fi
|
||||
print_warn "MySQL/MariaDB Server '${dbhost}' is not accessible, retrying.. ($COUNTER seconds so far)"
|
||||
sleep 5
|
||||
(( COUNTER+=5 ))
|
||||
while ! (mysqladmin -u"${dbuser}" -P"${dbport}" -h"${dbhost}" status > /dev/null 2>&1) ; do
|
||||
sleep 5
|
||||
(( COUNTER+=5 ))
|
||||
print_warn "MySQL/MariaDB Server '${dbhost}' is not accessible, retrying.. (${COUNTER} seconds so far)"
|
||||
done
|
||||
;;
|
||||
"mssql" )
|
||||
@@ -383,7 +377,7 @@ compression() {
|
||||
generate_md5() {
|
||||
if var_true "$MD5" ; then
|
||||
print_notice "Generating MD5 for ${target}"
|
||||
cd $tmpdir
|
||||
cd ${TEMP_LOCATION}
|
||||
md5sum "${target}" > "${target}".md5
|
||||
MD5VALUE=$(md5sum "${target}" | awk '{ print $1}')
|
||||
fi
|
||||
@@ -403,30 +397,30 @@ move_backup() {
|
||||
;;
|
||||
esac
|
||||
if [ "$SIZE_VALUE" = "1" ] ; then
|
||||
FILESIZE=$(stat -c%s "${tmpdir}/${target}")
|
||||
FILESIZE=$(stat -c%s "${TEMP_LOCATION}/${target}")
|
||||
print_notice "Backup of ${target} created with the size of ${FILESIZE} bytes"
|
||||
else
|
||||
FILESIZE=$(du -h "${tmpdir}/${target}" | awk '{ print $1}')
|
||||
FILESIZE=$(du -h "${TEMP_LOCATION}/${target}" | awk '{ print $1}')
|
||||
print_notice "Backup of ${target} created with the size of ${FILESIZE}"
|
||||
fi
|
||||
|
||||
case "${BACKUP_LOCATION}" in
|
||||
"FILE" | "file" | "filesystem" | "FILESYSTEM" )
|
||||
mkdir -p "${DB_DUMP_TARGET}"
|
||||
mv ${tmpdir}/*.md5 "${DB_DUMP_TARGET}"/
|
||||
mv ${tmpdir}/"${target}" "${DB_DUMP_TARGET}"/"${target}"
|
||||
mv ${TEMP_LOCATION}/*.md5 "${DB_DUMP_TARGET}"/
|
||||
mv ${TEMP_LOCATION}/"${target}" "${DB_DUMP_TARGET}"/"${target}"
|
||||
;;
|
||||
"S3" | "s3" | "MINIO" | "minio" )
|
||||
export AWS_ACCESS_KEY_ID=${S3_KEY_ID}
|
||||
export AWS_SECRET_ACCESS_KEY=${S3_KEY_SECRET}
|
||||
export AWS_DEFAULT_REGION=ap-northeast-2
|
||||
export AWS_DEFAULT_REGION=${S3_REGION}
|
||||
|
||||
[[ ( -n "${S3_HOST}" ) ]] && PARAM_AWS_ENDPOINT_URL=" --endpoint-url ${S3_PROTOCOL}://${S3_HOST}"
|
||||
|
||||
aws ${PARAM_AWS_ENDPOINT_URL} s3 cp ${tmpdir}/${target} s3://${S3_BUCKET}/${S3_PATH}/${target}
|
||||
aws ${PARAM_AWS_ENDPOINT_URL} s3 cp ${TEMP_LOCATION}/${target} s3://${S3_BUCKET}/${S3_PATH}/${target}
|
||||
|
||||
rm -rf ${tmpdir}/*.md5
|
||||
rm -rf ${tmpdir}/"${target}"
|
||||
rm -rf ${TEMP_LOCATION}/*.md5
|
||||
rm -rf ${TEMP_LOCATION}/"${target}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -459,7 +453,7 @@ print_debug "Backup routines Initialized on $(date)"
|
||||
### Commence Backup
|
||||
while true; do
|
||||
# make sure the directory exists
|
||||
mkdir -p $tmpdir
|
||||
mkdir -p $TEMP_LOCATION
|
||||
|
||||
### Define Target name
|
||||
now=$(date +"%Y%m%d-%H%M%S")
|
||||
@@ -504,7 +498,7 @@ print_debug "Backup routines Initialized on $(date)"
|
||||
esac
|
||||
|
||||
### Zabbix
|
||||
if var_true "$CONTAINER_ENABLE_MONITORING}" ; then
|
||||
if var_true "${CONTAINER_ENABLE_MONITORING}" ; then
|
||||
print_notice "Sending Backup Statistics to Zabbix"
|
||||
silent zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k dbbackup.size -o "$(stat -c%s "${DB_DUMP_TARGET}"/"${target}")"
|
||||
silent zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k dbbackup.datetime -o "$(date -r "${DB_DUMP_TARGET}"/"${target}" +'%s')"
|
||||
@@ -534,7 +528,7 @@ print_debug "Backup routines Initialized on $(date)"
|
||||
|
||||
### Go back to Sleep until next Backup time
|
||||
if var_true $MANUAL ; then
|
||||
exit 1;
|
||||
exit 0;
|
||||
else
|
||||
sleep $(($DB_DUMP_FREQ*60))
|
||||
fi
|
||||
|
||||
@@ -1,515 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<zabbix_export>
|
||||
<version>3.4</version>
|
||||
<date>2018-02-02T19:04:27Z</date>
|
||||
<groups>
|
||||
<group>
|
||||
<name>Discovered Containers</name>
|
||||
</group>
|
||||
<group>
|
||||
<name>Templates</name>
|
||||
</group>
|
||||
</groups>
|
||||
<templates>
|
||||
<template>
|
||||
<template>Service - ICMP</template>
|
||||
<name>Service - ICMP (Ping)</name>
|
||||
<description/>
|
||||
<groups>
|
||||
<group>
|
||||
<name>Templates</name>
|
||||
</group>
|
||||
</groups>
|
||||
<applications>
|
||||
<application>
|
||||
<name>ICMP</name>
|
||||
</application>
|
||||
</applications>
|
||||
<items>
|
||||
<item>
|
||||
<name>ICMP ping</name>
|
||||
<type>3</type>
|
||||
<snmp_community/>
|
||||
<snmp_oid/>
|
||||
<key>icmpping</key>
|
||||
<delay>1m</delay>
|
||||
<history>1w</history>
|
||||
<trends>365d</trends>
|
||||
<status>0</status>
|
||||
<value_type>3</value_type>
|
||||
<allowed_hosts/>
|
||||
<units/>
|
||||
<snmpv3_contextname/>
|
||||
<snmpv3_securityname/>
|
||||
<snmpv3_securitylevel>0</snmpv3_securitylevel>
|
||||
<snmpv3_authprotocol>0</snmpv3_authprotocol>
|
||||
<snmpv3_authpassphrase/>
|
||||
<snmpv3_privprotocol>0</snmpv3_privprotocol>
|
||||
<snmpv3_privpassphrase/>
|
||||
<params/>
|
||||
<ipmi_sensor/>
|
||||
<authtype>0</authtype>
|
||||
<username/>
|
||||
<password/>
|
||||
<publickey/>
|
||||
<privatekey/>
|
||||
<port/>
|
||||
<description/>
|
||||
<inventory_link>0</inventory_link>
|
||||
<applications>
|
||||
<application>
|
||||
<name>ICMP</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap>
|
||||
<name>Service state</name>
|
||||
</valuemap>
|
||||
<logtimefmt/>
|
||||
<preprocessing/>
|
||||
<jmx_endpoint/>
|
||||
<master_item/>
|
||||
</item>
|
||||
<item>
|
||||
<name>ICMP loss</name>
|
||||
<type>3</type>
|
||||
<snmp_community/>
|
||||
<snmp_oid/>
|
||||
<key>icmppingloss</key>
|
||||
<delay>1m</delay>
|
||||
<history>1w</history>
|
||||
<trends>365d</trends>
|
||||
<status>0</status>
|
||||
<value_type>0</value_type>
|
||||
<allowed_hosts/>
|
||||
<units>%</units>
|
||||
<snmpv3_contextname/>
|
||||
<snmpv3_securityname/>
|
||||
<snmpv3_securitylevel>0</snmpv3_securitylevel>
|
||||
<snmpv3_authprotocol>0</snmpv3_authprotocol>
|
||||
<snmpv3_authpassphrase/>
|
||||
<snmpv3_privprotocol>0</snmpv3_privprotocol>
|
||||
<snmpv3_privpassphrase/>
|
||||
<params/>
|
||||
<ipmi_sensor/>
|
||||
<authtype>0</authtype>
|
||||
<username/>
|
||||
<password/>
|
||||
<publickey/>
|
||||
<privatekey/>
|
||||
<port/>
|
||||
<description/>
|
||||
<inventory_link>0</inventory_link>
|
||||
<applications>
|
||||
<application>
|
||||
<name>ICMP</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap/>
|
||||
<logtimefmt/>
|
||||
<preprocessing/>
|
||||
<jmx_endpoint/>
|
||||
<master_item/>
|
||||
</item>
|
||||
<item>
|
||||
<name>ICMP response time</name>
|
||||
<type>3</type>
|
||||
<snmp_community/>
|
||||
<snmp_oid/>
|
||||
<key>icmppingsec</key>
|
||||
<delay>1m</delay>
|
||||
<history>1w</history>
|
||||
<trends>365d</trends>
|
||||
<status>0</status>
|
||||
<value_type>0</value_type>
|
||||
<allowed_hosts/>
|
||||
<units>s</units>
|
||||
<snmpv3_contextname/>
|
||||
<snmpv3_securityname/>
|
||||
<snmpv3_securitylevel>0</snmpv3_securitylevel>
|
||||
<snmpv3_authprotocol>0</snmpv3_authprotocol>
|
||||
<snmpv3_authpassphrase/>
|
||||
<snmpv3_privprotocol>0</snmpv3_privprotocol>
|
||||
<snmpv3_privpassphrase/>
|
||||
<params/>
|
||||
<ipmi_sensor/>
|
||||
<authtype>0</authtype>
|
||||
<username/>
|
||||
<password/>
|
||||
<publickey/>
|
||||
<privatekey/>
|
||||
<port/>
|
||||
<description/>
|
||||
<inventory_link>0</inventory_link>
|
||||
<applications>
|
||||
<application>
|
||||
<name>ICMP</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap/>
|
||||
<logtimefmt/>
|
||||
<preprocessing/>
|
||||
<jmx_endpoint/>
|
||||
<master_item/>
|
||||
</item>
|
||||
</items>
|
||||
<discovery_rules/>
|
||||
<httptests/>
|
||||
<macros/>
|
||||
<templates/>
|
||||
<screens/>
|
||||
</template>
|
||||
<template>
|
||||
<template>Zabbix - Container Agent</template>
|
||||
<name>Zabbix - Container Agent</name>
|
||||
<description/>
|
||||
<groups>
|
||||
<group>
|
||||
<name>Discovered Containers</name>
|
||||
</group>
|
||||
<group>
|
||||
<name>Templates</name>
|
||||
</group>
|
||||
</groups>
|
||||
<applications>
|
||||
<application>
|
||||
<name>Packages</name>
|
||||
</application>
|
||||
<application>
|
||||
<name>Zabbix agent</name>
|
||||
</application>
|
||||
</applications>
|
||||
<items>
|
||||
<item>
|
||||
<name>Hostname of Container</name>
|
||||
<type>0</type>
|
||||
<snmp_community/>
|
||||
<snmp_oid/>
|
||||
<key>agent.hostname</key>
|
||||
<delay>1h</delay>
|
||||
<history>1w</history>
|
||||
<trends>0</trends>
|
||||
<status>0</status>
|
||||
<value_type>1</value_type>
|
||||
<allowed_hosts/>
|
||||
<units/>
|
||||
<snmpv3_contextname/>
|
||||
<snmpv3_securityname/>
|
||||
<snmpv3_securitylevel>0</snmpv3_securitylevel>
|
||||
<snmpv3_authprotocol>0</snmpv3_authprotocol>
|
||||
<snmpv3_authpassphrase/>
|
||||
<snmpv3_privprotocol>0</snmpv3_privprotocol>
|
||||
<snmpv3_privpassphrase/>
|
||||
<params/>
|
||||
<ipmi_sensor/>
|
||||
<authtype>0</authtype>
|
||||
<username/>
|
||||
<password/>
|
||||
<publickey/>
|
||||
<privatekey/>
|
||||
<port/>
|
||||
<description/>
|
||||
<inventory_link>3</inventory_link>
|
||||
<applications>
|
||||
<application>
|
||||
<name>Zabbix agent</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap/>
|
||||
<logtimefmt/>
|
||||
<preprocessing/>
|
||||
<jmx_endpoint/>
|
||||
<master_item/>
|
||||
</item>
|
||||
<item>
|
||||
<name>Contaner OS</name>
|
||||
<type>0</type>
|
||||
<snmp_community/>
|
||||
<snmp_oid/>
|
||||
<key>agent.os</key>
|
||||
<delay>6h</delay>
|
||||
<history>30d</history>
|
||||
<trends>0</trends>
|
||||
<status>0</status>
|
||||
<value_type>1</value_type>
|
||||
<allowed_hosts/>
|
||||
<units/>
|
||||
<snmpv3_contextname/>
|
||||
<snmpv3_securityname/>
|
||||
<snmpv3_securitylevel>0</snmpv3_securitylevel>
|
||||
<snmpv3_authprotocol>0</snmpv3_authprotocol>
|
||||
<snmpv3_authpassphrase/>
|
||||
<snmpv3_privprotocol>0</snmpv3_privprotocol>
|
||||
<snmpv3_privpassphrase/>
|
||||
<params/>
|
||||
<ipmi_sensor/>
|
||||
<authtype>0</authtype>
|
||||
<username/>
|
||||
<password/>
|
||||
<publickey/>
|
||||
<privatekey/>
|
||||
<port/>
|
||||
<description/>
|
||||
<inventory_link>5</inventory_link>
|
||||
<applications>
|
||||
<application>
|
||||
<name>Zabbix agent</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap/>
|
||||
<logtimefmt/>
|
||||
<preprocessing/>
|
||||
<jmx_endpoint/>
|
||||
<master_item/>
|
||||
</item>
|
||||
<item>
|
||||
<name>Zabbix Agent ping</name>
|
||||
<type>0</type>
|
||||
<snmp_community/>
|
||||
<snmp_oid/>
|
||||
<key>agent.ping</key>
|
||||
<delay>1m</delay>
|
||||
<history>1w</history>
|
||||
<trends>365d</trends>
|
||||
<status>0</status>
|
||||
<value_type>3</value_type>
|
||||
<allowed_hosts/>
|
||||
<units/>
|
||||
<snmpv3_contextname/>
|
||||
<snmpv3_securityname/>
|
||||
<snmpv3_securitylevel>0</snmpv3_securitylevel>
|
||||
<snmpv3_authprotocol>0</snmpv3_authprotocol>
|
||||
<snmpv3_authpassphrase/>
|
||||
<snmpv3_privprotocol>0</snmpv3_privprotocol>
|
||||
<snmpv3_privpassphrase/>
|
||||
<params/>
|
||||
<ipmi_sensor/>
|
||||
<authtype>0</authtype>
|
||||
<username/>
|
||||
<password/>
|
||||
<publickey/>
|
||||
<privatekey/>
|
||||
<port/>
|
||||
<description>The agent always returns 1 for this item. It could be used in combination with nodata() for availability check.</description>
|
||||
<inventory_link>0</inventory_link>
|
||||
<applications>
|
||||
<application>
|
||||
<name>Zabbix agent</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap>
|
||||
<name>Zabbix agent ping status</name>
|
||||
</valuemap>
|
||||
<logtimefmt/>
|
||||
<preprocessing/>
|
||||
<jmx_endpoint/>
|
||||
<master_item/>
|
||||
</item>
|
||||
<item>
|
||||
<name>Zabbix Agent Version</name>
|
||||
<type>0</type>
|
||||
<snmp_community/>
|
||||
<snmp_oid/>
|
||||
<key>agent.version</key>
|
||||
<delay>1h</delay>
|
||||
<history>1w</history>
|
||||
<trends>0</trends>
|
||||
<status>0</status>
|
||||
<value_type>1</value_type>
|
||||
<allowed_hosts/>
|
||||
<units/>
|
||||
<snmpv3_contextname/>
|
||||
<snmpv3_securityname/>
|
||||
<snmpv3_securitylevel>0</snmpv3_securitylevel>
|
||||
<snmpv3_authprotocol>0</snmpv3_authprotocol>
|
||||
<snmpv3_authpassphrase/>
|
||||
<snmpv3_privprotocol>0</snmpv3_privprotocol>
|
||||
<snmpv3_privpassphrase/>
|
||||
<params/>
|
||||
<ipmi_sensor/>
|
||||
<authtype>0</authtype>
|
||||
<username/>
|
||||
<password/>
|
||||
<publickey/>
|
||||
<privatekey/>
|
||||
<port/>
|
||||
<description/>
|
||||
<inventory_link>0</inventory_link>
|
||||
<applications>
|
||||
<application>
|
||||
<name>Zabbix agent</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap/>
|
||||
<logtimefmt/>
|
||||
<preprocessing/>
|
||||
<jmx_endpoint/>
|
||||
<master_item/>
|
||||
</item>
|
||||
<item>
|
||||
<name>Upgradable Packages</name>
|
||||
<type>0</type>
|
||||
<snmp_community/>
|
||||
<snmp_oid/>
|
||||
<key>packages.upgradable</key>
|
||||
<delay>6h</delay>
|
||||
<history>90d</history>
|
||||
<trends>365d</trends>
|
||||
<status>0</status>
|
||||
<value_type>3</value_type>
|
||||
<allowed_hosts/>
|
||||
<units/>
|
||||
<snmpv3_contextname/>
|
||||
<snmpv3_securityname/>
|
||||
<snmpv3_securitylevel>0</snmpv3_securitylevel>
|
||||
<snmpv3_authprotocol>0</snmpv3_authprotocol>
|
||||
<snmpv3_authpassphrase/>
|
||||
<snmpv3_privprotocol>0</snmpv3_privprotocol>
|
||||
<snmpv3_privpassphrase/>
|
||||
<params/>
|
||||
<ipmi_sensor/>
|
||||
<authtype>0</authtype>
|
||||
<username/>
|
||||
<password/>
|
||||
<publickey/>
|
||||
<privatekey/>
|
||||
<port/>
|
||||
<description/>
|
||||
<inventory_link>0</inventory_link>
|
||||
<applications>
|
||||
<application>
|
||||
<name>Packages</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap/>
|
||||
<logtimefmt/>
|
||||
<preprocessing/>
|
||||
<jmx_endpoint/>
|
||||
<master_item/>
|
||||
</item>
|
||||
</items>
|
||||
<discovery_rules/>
|
||||
<httptests/>
|
||||
<macros/>
|
||||
<templates/>
|
||||
<screens/>
|
||||
</template>
|
||||
</templates>
|
||||
<triggers>
|
||||
<trigger>
|
||||
<expression>{Service - ICMP:icmpping.max(3m)}=3</expression>
|
||||
<recovery_mode>0</recovery_mode>
|
||||
<recovery_expression/>
|
||||
<name>Cannot be pinged</name>
|
||||
<correlation_mode>0</correlation_mode>
|
||||
<correlation_tag/>
|
||||
<url/>
|
||||
<status>0</status>
|
||||
<priority>5</priority>
|
||||
<description/>
|
||||
<type>0</type>
|
||||
<manual_close>0</manual_close>
|
||||
<dependencies/>
|
||||
<tags/>
|
||||
</trigger>
|
||||
<trigger>
|
||||
<expression>{Service - ICMP:icmppingloss.min(10m)}>50</expression>
|
||||
<recovery_mode>0</recovery_mode>
|
||||
<recovery_expression/>
|
||||
<name>Ping loss is too high</name>
|
||||
<correlation_mode>0</correlation_mode>
|
||||
<correlation_tag/>
|
||||
<url/>
|
||||
<status>0</status>
|
||||
<priority>4</priority>
|
||||
<description/>
|
||||
<type>0</type>
|
||||
<manual_close>0</manual_close>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<name>Cannot be pinged</name>
|
||||
<expression>{Service - ICMP:icmpping.max(3m)}=3</expression>
|
||||
<recovery_expression/>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<tags/>
|
||||
</trigger>
|
||||
<trigger>
|
||||
<expression>{Service - ICMP:icmppingsec.avg(2m)}>100</expression>
|
||||
<recovery_mode>0</recovery_mode>
|
||||
<recovery_expression/>
|
||||
<name>Ping Response time is too high</name>
|
||||
<correlation_mode>0</correlation_mode>
|
||||
<correlation_tag/>
|
||||
<url/>
|
||||
<status>0</status>
|
||||
<priority>4</priority>
|
||||
<description/>
|
||||
<type>1</type>
|
||||
<manual_close>0</manual_close>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<name>Cannot be pinged</name>
|
||||
<expression>{Service - ICMP:icmpping.max(3m)}=3</expression>
|
||||
<recovery_expression/>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<tags/>
|
||||
</trigger>
|
||||
<trigger>
|
||||
<expression>{Zabbix - Container Agent:packages.upgradable.last()}>0</expression>
|
||||
<recovery_mode>0</recovery_mode>
|
||||
<recovery_expression/>
|
||||
<name>Upgraded Packages in Container Available</name>
|
||||
<correlation_mode>0</correlation_mode>
|
||||
<correlation_tag/>
|
||||
<url/>
|
||||
<status>0</status>
|
||||
<priority>1</priority>
|
||||
<description/>
|
||||
<type>0</type>
|
||||
<manual_close>0</manual_close>
|
||||
<dependencies/>
|
||||
<tags/>
|
||||
</trigger>
|
||||
<trigger>
|
||||
<expression>{Zabbix - Container Agent:agent.ping.nodata(3m)}=1</expression>
|
||||
<recovery_mode>0</recovery_mode>
|
||||
<recovery_expression/>
|
||||
<name>Zabbix agent is unreachable</name>
|
||||
<correlation_mode>0</correlation_mode>
|
||||
<correlation_tag/>
|
||||
<url/>
|
||||
<status>0</status>
|
||||
<priority>5</priority>
|
||||
<description/>
|
||||
<type>0</type>
|
||||
<manual_close>0</manual_close>
|
||||
<dependencies/>
|
||||
<tags/>
|
||||
</trigger>
|
||||
</triggers>
|
||||
<value_maps>
|
||||
<value_map>
|
||||
<name>Service state</name>
|
||||
<mappings>
|
||||
<mapping>
|
||||
<value>0</value>
|
||||
<newvalue>Down</newvalue>
|
||||
</mapping>
|
||||
<mapping>
|
||||
<value>1</value>
|
||||
<newvalue>Up</newvalue>
|
||||
</mapping>
|
||||
</mappings>
|
||||
</value_map>
|
||||
<value_map>
|
||||
<name>Zabbix agent ping status</name>
|
||||
<mappings>
|
||||
<mapping>
|
||||
<value>1</value>
|
||||
<newvalue>Up</newvalue>
|
||||
</mapping>
|
||||
</mappings>
|
||||
</value_map>
|
||||
</value_maps>
|
||||
</zabbix_export>
|
||||
Reference in New Issue
Block a user