Skip to content

Instantly share code, notes, and snippets.

#This gist is intended to install Zabbix-agent2 5.4 on Ubuntu 16/18/20
#Just create the hosts file and run
#ansible-playbook -i hosts zabbix.yml
- hosts: all
user: ubuntu
become: yes
vars:
zbx_srv: monitor.solidops.cloud
#!/bin/bash
sudo service zabbix-agent stop
sudo apt -y remove zabbix-agent
sudo wget https://repo.zabbix.com/zabbix/5.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.2-1+ubuntu$(lsb_release -sr)_all.deb
sudo dpkg -i zabbix-release_5.2-1+ubuntu$(lsb_release -sr)_all.deb
sudo apt update
sudo apt -y install zabbix-agent2
sudo sed -i 's/Server=127.0.0.1/Server=$1/g' /etc/zabbix/zabbix_agent2.conf
sudo sed -i 's/ServerActive=127.0.0.1/#ServerActive=127.0.0.1/g' /etc/zabbix/zabbix_agent2.conf
sudo sed -i 's/Hostname=Zabbix server/#Hostname=Zabbix server/g' /etc/zabbix/zabbix_agent2.conf
@andretapxure
andretapxure / cloud-init-mongo.yaml
Created April 15, 2021 19:17
This snippet is a cloud-init to prepare kubernetes nodes and masters before the kubeadm init script. just boring work of apt and users
users:
- default
- name: ubuntu
gecos: Ubuntu
sudo: ALL=(ALL) NOPASSWD:ALL
groups: users, admin, docker
shell: /bin/bash
ssh_import_id: None
lock_passwd: true
ssh_authorized_keys:
@andretapxure
andretapxure / cloud-init-kubernetes.yaml
Last active April 15, 2021 19:18
This snippet is a cloud-init to prepare kubernetes nodes and masters before the kubeadm init script. just boring work of apt and users
users:
- default
- name: ubuntu
gecos: Ubuntu
sudo: ALL=(ALL) NOPASSWD:ALL
groups: users, admin, docker
shell: /bin/bash
ssh_import_id: None
lock_passwd: true
ssh_authorized_keys:
#!/bin/bash
# Autor: remontti.com.br
#Insert your bot token without the "bot" part in the variable bellow
TOKEN="2ef92jfn2;uf9nf2nFUE(U@sadfwewoijfe#$"
USER=$1
SUBJECT=$2
MESSAGE=$3
NL="
"
#!/bin/bash
#Reads the date parameter. empty then date is today
if [ -z "$1" ]
then
date=$(date +"%Y-%m-%d")
else
date=$1
fi
@andretapxure
andretapxure / zabbix5.yml
Last active May 13, 2021 21:11
Zabbix 5 docker-compose file with external database
version: '3.7'
#Dont forget to create mysql user with native password authentication
#create user 'zabbix'@'172.%' IDENTIFIED WITH mysql_native_password BY 'MySQLPasswordHere';
services:
server:
image:
zabbix/zabbix-server-mysql:alpine-5.0-latest
ports:
- 10051:10051
environment:
@andretapxure
andretapxure / mongobackup.sh
Last active October 8, 2020 21:04
SH version of mongobackup
!/bin/bash
rm -rf /mongotemp
mkdir /mongotemp
mongodbs=$(/usr/bin/mongo --quiet --eval "printjson(db.adminCommand('listDatabases'))" | grep name | cut -d: -f2 | cut -d\" -f2)
for db in $mongodbs
do
echo "Backing Up $db "
/usr/bin/mongodump --out=/mongotemp --db=$db
@andretapxure
andretapxure / imapsync_docker.sh
Last active September 24, 2020 20:41
This gist will migrate from server1 to server2 with the outlook options
docker run gilleslamiral/imapsync imapsync --host1 dino.solucoesideais.com.br --
user1 [email protected] --password1 Change123 --host2 outlook.office365.com --user2
[email protected] --password2 Chante123 --tls2 --subfolder2 ArchivedItems
@andretapxure
andretapxure / mongobackup.bat
Last active October 8, 2020 20:39
This snippet is a windows and linux version for MongoDB Backup. Just need to replace the MongoDB Binary for it to work. I had some dificulty doing "if (condition) && (condition) so I nested it.
@echo off
echo ### Cleaning up
rmdir /s /q e:\mongotemp
mkdir e:\mongotemp
echo ### Listing and backing up each database
rem the following line must be uncommented in case you want to backup ALL databases. if not, create a input.txt file as follows comment the line that lists the databases
rem [ "admin", "config", "local", "database1", "database2" ]