Schlagwort: script

2 Replies

Synology Docker Zabbix Backup and Restore

Backup the Database:
The most important settings are all stored in the Database. The easiest and most secure way to save them is to export all the Data at a specific time and store them on the Synology Raid. So this is my solution:

  1. Go to „Control Panel“ -> „Task Schedueler“ and create a „User-defined script“
  1. Choose the name you want to have and set the User to „root“
  1. Choose the time you want to have the script running
  1. Change the code to your settings.
docker exec Zabbix-Server /usr/bin/mysqldump -u root --password=zabbix zabbix > /volume1/docker/Zabbix/backup.sql

tar -zcvf /volume1/docker/Zabbix/$(date +%Y%m%d).tar.gz /volume1/docker/Zabbix/backup.sql
rm /volume1/docker/Zabbix/backup.sql

Restore Database
If you want to restore your Database you have to enable SSH and connect with your Terminal. Then you can paste following command: (Attention you have to unpack the tar file if you use my Backup scirpt

cat /volume1/docker/Zabbix/backup.sql | docker exec -i Zabbix-Server /usr/bin/mysql -u zabbix --password=zabbix zabbix

Links:
https://gist.github.com/spalladino/6d981f7b33f6e0afe6bb


2 Replies

Ubuntu 20.X fast Docker install

After installing Docker on lots of machines I automated this with following sh script. Just create a new script or download it with this link: DOWNLOAD install_docker.sh

You can use this command:

wget https://www.schaupper.at/Upload/scripts/installdocker.sh
chmod +x installdocker.sh
sudo ./installdocker.sh

Content of the script:

# /bin/bash
# install docker
sudo apt update
#remove older versions
sudo apt-get -y remove docker docker-engine docker.io
#install docker
sudo apt-get install docker.io
#enable docker at boot
sudo systemctl start docker
sudo systemctl enable docker

I am follwing this manual : Docker Manual


Leave a reply

ping with time and log

Usage:

Download the ping.sh file. Unpack it and start it in with ./ping.sh (don’t forget to be in the right folder). The script will ping google (8.8.8.8, if you do not change it in the script) and will create an „log“ file with the default name „tping“ in the same folder.

The output should look like this: (if you have a working connection to the host)
Mon Jun 12 12:17:41 CEST 2017: 64 bytes from 8.8.8.8: icmp_seq=0 ttl=46 time=28.139 ms

It will look like this if your connection is not working or the server could not be reached
Mon Jun 12 12:17:41 CEST 2017: Request timeout for icmp_seq 0

The ping time depends if you ping some device in your own network or in the internet.
If it is in the internet:
0-30 ms -> GOOD
30 – 80 ms -> OK
80-120 ms -> Mhhhhh
120 > -> go out and do something else ­čśë

WAN

Example Ping into the wan

64 bytes from 8.8.8.8: icmp_seq=1 ttl=47 time=18.991 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=47 time=18.917 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=47 time=18.961 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=47 time=18.893 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=47 time=18.932 ms
64 bytes from 8.8.8.8: icmp_seq=6 ttl=47 time=19.114 ms

If it is in you network┬á(LAN – Cable)
0-15 ms -> GOOD
15-50 ms -> OK
50 ms > you should have a look why this is so slow (maybe your destination is under heavy network traffic or you are, or some device in between)

LAN – Cable Network

Example Ping in the local network

64 bytes from 172.100.10.20: icmp_seq=1 ttl=128 time=0.236 ms
64 bytes from 172.100.10.20: icmp_seq=2 ttl=128 time=0.140 ms
64 bytes from 172.100.10.20: icmp_seq=3 ttl=128 time=0.161 ms
64 bytes from 172.100.10.20: icmp_seq=4 ttl=128 time=0.151 ms
64 bytes from 172.100.10.20: icmp_seq=5 ttl=128 time=0.161 ms
64 bytes from 172.100.10.20: icmp_seq=6 ttl=128 time=0.153 ms

WLan – Wireless Network

Example Ping in the local network

64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=15.531 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=3.515 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=14.879 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=6.182 ms
64 bytes from 192.168.1.1: icmp_seq=5 ttl=64 time=7.358 ms
64 bytes from 192.168.1.1: icmp_seq=6 ttl=64 time=5.746 ms

 

System:

Linux & Mac

#!/bin/bash
#example: Mon Jun 12 12:17:41 CEST 2017: 64 bytes from 8.8.8.8: icmp_seq=0 ttl=46 time=28.139 ms

server="8.8.8.8"
log="tping"

ping $server | while read pong; do echo "$(date): $pong"; done >> $log.txt

Download File: ping.sh


Durch die weitere Nutzung der Seite stimmst du der Verwendung von Cookies zu. Weitere Informationen

Die Cookie-Einstellungen auf dieser Website sind auf "Cookies zulassen" eingestellt, um das beste Surferlebnis zu erm├Âglichen. Wenn du diese Website ohne ├änderung der Cookie-Einstellungen verwendest oder auf "Akzeptieren" klickst, erkl├Ąrst du sich damit einverstanden.

Schlie├čen