Commit 3d11af21 authored by Joab Bremer's avatar Joab Bremer

update script RC

parent b835b5db
dnf install *.rpm dnf install \*.rpm
/etc/zabbix/zabbix_agent2.conf /etc/zabbix/zabbix_agent2.conf
Server=IP_SERVIDOR_DO_PROXY_DO_CAMPO Server=IP_SERVIDOR_DO_PROXY_DO_CAMPO
...@@ -8,7 +8,18 @@ Hostname=NOME_DO_PROXY_DO_CAMPO ...@@ -8,7 +8,18 @@ Hostname=NOME_DO_PROXY_DO_CAMPO
commentar commentar
#ServerActive=127.0.0.1 #ServerActive=127.0.0.1
-A INPUT -s 10.11.0.0/22 -p tcp -m state --state NEW -m tcp --dport 10050:10053 -j ACCEPT
-A INPUT -p tcp -m state -m tcp --dport 10050:10053 --state NEW -j ACCEPT
systemctl enable --now zabbix-agent2 systemctl enable --now zabbix-agent2
### Instalação com script
```
curl -fsSL https://git.usb.org.br/infra/zabbix/raw/master/zabbix_v2/Centos%206/agent2/zabbix_install.sh | bash -s -- <IP_PROXY> <SERVER_NAME>
```
### Adicionar regra de iptables
```
-A INPUT -s 10.11.0.0/22 -p tcp -m state --state NEW -m tcp --dport 10050:10053 -j ACCEPT
```
#!/bin/bash #!/bin/bash
if [ "$#" -ne 2 ]; then if [ "$#" -ne 2 ]; then
echo "Uso: $0 <Novo_IP> <Novo_Hostname>" echo "Uso: $0 <PROXY_IP> <HOSTNAME>"
exit 1 exit 1
fi fi
NOVO_IP=$1 PROXY_IP=$1
NOVO_HOSTNAME=$2 HOSTNAME=$2
CONFIG_FILE="/etc/zabbix/zabbix_agent2.conf" CONFIG_FILE="/etc/zabbix/zabbix_agent2.conf"
mkdir /zabbix_files mkdir /zabbix_files
cd /zabbix_files cd /zabbix_files
echo "Baixando Arquivos..." echo "Baixando Arquivos..."
wget https://git.usb.org.br/infra/zabbix/raw/master/zabbix_v2/Centos%206/zabbix-agent2-7.0.0-release1.el6.x86_64.rpm -P /zabbix_files wget https://git.usb.org.br/infra/zabbix/raw/master/zabbix_v2/Rock%20Linux%208/agent2/7.0.1/zabbix-agent2-7.0.1-release1.el8.x86_64.rpm -P /zabbix_files
wget https://git.usb.org.br/infra/zabbix/raw/master/zabbix_v2/Rock%20Linux%208/agent2/7.0.1/zabbix-get-7.0.1-release1.el8.x86_64.rpm -P /zabbix_files
wget https://git.usb.org.br/infra/zabbix/raw/master/zabbix_v2/Rock%20Linux%208/agent2/7.0.1/zabbix-sender-7.0.1-release1.el8.x86_64.rpm -P /zabbix_files
echo "instalando zabbix-agent2..." echo "instalando zabbix-agent2..."
yum -y install /zabbix_files/*.rpm dnf -y install /zabbix_files/*.rpm
echo "Configurando..." echo "Configurando..."
sed -i "s/^Server=.*/Server=$NOVO_IP/" "$CONFIG_FILE" sed -i "s/^Server=.*/Server=$PROXY_IP/" "$CONFIG_FILE"
sed -i "s/^Hostname=.*/Hostname=$NOVO_HOSTNAME/" "$CONFIG_FILE" sed -i "s/^Hostname=.*/Hostname=$HOSTNAME/" "$CONFIG_FILE"
sed -i "s/^ServerActive=.*/#&/" "$CONFIG_FILE" sed -i "s/^ServerActive=.*/#&/" "$CONFIG_FILE"
echo "Configurações atualizadas com sucesso no arquivo $CONFIG_FILE:" echo "Configurações atualizadas com sucesso no arquivo $CONFIG_FILE:"
echo "Server=$NOVO_IP" echo "Server=$PROXY_IP"
echo "Hostname=$NOVO_HOSTNAME" echo "Hostname=$HOSTNAME"
mkdir -p /run/zabbix/
chown zabbix. /run/zabbix
service zabbix-agent2 start systemctl start zabbix-agent2
chkconfig zabbix-agent2 on systemctl enable zabbix-agent2
echo "Instalação Concluida" echo "Instalação Concluida"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment