Skip to content

Instantly share code, notes, and snippets.

View isaqueprofeta's full-sized avatar
🎯
Focusing

Isaque Profeta isaqueprofeta

🎯
Focusing
View GitHub Profile
@isaqueprofeta
isaqueprofeta / fake_mail_list.py
Last active December 7, 2022 13:38
Fake list of emails using Python Faker
# Instalar Biblioteca do pip:
# - pip instal faker
from faker import Faker
fake = Faker()
# Número de emails
number_of_mails = 100
# Lista de domínios
@isaqueprofeta
isaqueprofeta / vbox_guest_add.sh
Created April 29, 2021 23:12
Install virtualbox guest addons Ubuntu
sudo apt install virtualbox-guest-additions-iso
sudo apt install gcc make perl
mkdir /tmp/virtualbox
sudo mount /usr/share/virtualbox/VBoxGuestAdditions.iso /tmp/virtualbox -o loop
cd /tmp/virtualbox
sudo ./VBoxLinuxAdditions.run
reboot
@isaqueprofeta
isaqueprofeta / iperf_test.sh
Created December 31, 2020 22:44
Dumb way to load with iperf
#!/bin/bash
i="1"
while true
do
echo $i
i=$[$i+1]
ssh root@192.168.0.47 'iperf -s -u > /dev/null 2>&1 &'; ssh root@192.168.0.56 'iperf -s -u > /dev/null 2>&1 &'; ssh root@192.168.0.57 'iperf -s -u > /dev/null 2>&1 &' &
ssh root@192.168.0.58 'iperf -c 192.168.0.47 -u -b 10m -t 300 > /dev/null 2>&1 &'; ssh root@192.168.0.59 'iperf -c 192.168.0.56 -u -b 10m -t 300 > /dev/null 2>&1 &'; ssh root@192.168.0.60 'iperf -c 192.168.0.57 -u -b 10m -t 300 > /dev/null 2>&1 &' &
sleep 320
@isaqueprofeta
isaqueprofeta / grafana.crontab
Last active May 14, 2024 15:30
Grafana simple full backup
# Create the archive file: grafana-YYYYMMdd.tar.gz with:
# - GrafanaPlugins: /tmp/grafana.plugins
# - Grafana Conf: /etc/grafana/grafana.ini
# - Grafana DB: /var/lib/grafana/grafana.db
0 1 * * * $(grafana-cli plugins ls | grep @ | sed 's/ @ / /' > /tmp/grafana.plugins)
5 1 * * * tar -czf /tmp/grafana-$(date +%Y%m%d).tar.gz /etc/grafana/grafana.ini /var/lib/grafana/grafana.db /tmp/grafana.plugins
# Copy it to your backup server
@isaqueprofeta
isaqueprofeta / consulta_004.py
Created August 9, 2020 22:32
Support to medium story for zabbixapi
import apizabbix
api = apizabbix.connect()
hostgroups = api.hostgroup.get(
output=['id'],
filter={
'name': 'Linux servers'
},
)
@isaqueprofeta
isaqueprofeta / consulta_003.py
Last active October 6, 2020 01:23
Support to medium story for zabbixapi
import apizabbix
api = apizabbix.connect()
hostgroups = api.hostgroup.get(
output='extend',
excludeSearch=True,
search={
'name': 'Templates'
},
@isaqueprofeta
isaqueprofeta / consulta_002.py
Last active August 9, 2020 06:18
Support to medium story for zabbixapi
import apizabbix
api = apizabbix.connect()
hostgroups = api.hostgroup.get(
output='extend',
excludeSearch=True,
search={
'name': 'Templates'
}
@isaqueprofeta
isaqueprofeta / consulta_001.py
Last active August 9, 2020 06:18
Support to medium story for zabbixapi
import apizabbix
api = apizabbix.connect()
hostgroups = api.hostgroup.get()
from pprint import pprint
pprint(hostgroups)
api.user.logout()
@isaqueprofeta
isaqueprofeta / apizabbix.py
Last active August 9, 2020 05:48
Support to medium story for zabbixapi
from pyzabbix import ZabbixAPI
import configparser
def connect():
config = configparser.ConfigParser()
config.read("config.ini")
user = config.get('zabbix', 'user')
password = config.get('zabbix', 'password')
server = config.get('zabbix', 'server')
@isaqueprofeta
isaqueprofeta / python_zabbix_api.md
Last active July 10, 2020 18:28
Usando a API do zabbix rapidamente em python

Instalar Python e o Pip:

sudo apt-get install python3 python3-pip

Criar pasta de projeto e instalar as dependências:

mkdir api_zabbix
cd api_zabbix
pip install pyzabbix