summaryrefslogtreecommitdiffstats
path: root/test/docker/docker-entrypoint-initdb.d/icinga/dump.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/docker/docker-entrypoint-initdb.d/icinga/dump.sh')
-rwxr-xr-xtest/docker/docker-entrypoint-initdb.d/icinga/dump.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/docker/docker-entrypoint-initdb.d/icinga/dump.sh b/test/docker/docker-entrypoint-initdb.d/icinga/dump.sh
new file mode 100755
index 0000000..54f91a9
--- /dev/null
+++ b/test/docker/docker-entrypoint-initdb.d/icinga/dump.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+set -e
+
+CONFIG="$(docker-compose config)"
+MYSQL_ROOT_PASSWORD="$(echo "$CONFIG" | grep MYSQL_ROOT_PASSWORD | cut -d: -f2 | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
+
+set -x
+
+docker exec -i \
+ "$(docker-compose ps -q db)" \
+ mysqldump -p"${MYSQL_ROOT_PASSWORD}" --no-create-info icinga \
+ icinga_instances icinga_programstatus icinga_objects \
+ icinga_hosts icinga_hoststatus \
+ icinga_services icinga_servicestatus \
+ icinga_hostgroups icinga_hostgroup_members \
+ > ido-data.sql
+
+docker exec -i \
+ "$(docker-compose ps -q db)" \
+ mysqldump -p"${MYSQL_ROOT_PASSWORD}" icinga \
+ > full.sql