sudo apt-get install python3 python3-pip
mkdir api_zabbix
cd api_zabbix
pip install pyzabbix
# 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 |
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 |
#!/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 |
# 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 |
import apizabbix | |
api = apizabbix.connect() | |
hostgroups = api.hostgroup.get( | |
output=['id'], | |
filter={ | |
'name': 'Linux servers' | |
}, | |
) |
import apizabbix | |
api = apizabbix.connect() | |
hostgroups = api.hostgroup.get( | |
output='extend', | |
excludeSearch=True, | |
search={ | |
'name': 'Templates' | |
}, |
import apizabbix | |
api = apizabbix.connect() | |
hostgroups = api.hostgroup.get( | |
output='extend', | |
excludeSearch=True, | |
search={ | |
'name': 'Templates' | |
} |
import apizabbix | |
api = apizabbix.connect() | |
hostgroups = api.hostgroup.get() | |
from pprint import pprint | |
pprint(hostgroups) | |
api.user.logout() |
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') |