- passage de zabbix agent en zabbix agent2
This commit is contained in:
parent
6770e2d6b2
commit
efdb68a61a
|
|
@ -6,7 +6,7 @@
|
||||||
SERVICES_TO_CHECK=(
|
SERVICES_TO_CHECK=(
|
||||||
# MONITORING
|
# MONITORING
|
||||||
"Zabbix Server|zabbix_server"
|
"Zabbix Server|zabbix_server"
|
||||||
"Zabbix Agent|zabbix_agentd"
|
"Zabbix Agent2|zabbix_agent2"
|
||||||
# DATABASE
|
# DATABASE
|
||||||
"MySQL Server|mysql"
|
"MySQL Server|mysql"
|
||||||
"PostgreSQL|psql"
|
"PostgreSQL|psql"
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ check_deb_sys_ipv6(){
|
||||||
}
|
}
|
||||||
|
|
||||||
check_deb_sys_zabbix(){
|
check_deb_sys_zabbix(){
|
||||||
if dpkg -s zabbix-agent >/dev/null 2>&1; then
|
if dpkg -s zabbix-agent2 >/dev/null 2>&1; then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
|
|
@ -59,7 +59,7 @@ check_deb_sys_zabbix(){
|
||||||
}
|
}
|
||||||
|
|
||||||
check_deb_sys_zabbix_conf(){
|
check_deb_sys_zabbix_conf(){
|
||||||
if dpkg -s zabbix-agent >/dev/null 2>&1; then
|
if dpkg -s zabbix-agent2 >/dev/null 2>&1; then
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
|
|
@ -407,23 +407,40 @@ do_deb_sys_apparmor(){
|
||||||
|
|
||||||
do_deb_sys_zabbix(){
|
do_deb_sys_zabbix(){
|
||||||
local ip
|
local ip
|
||||||
|
|
||||||
|
# 1. Désinstallation de l'ancien agent s'il existe
|
||||||
|
if dpkg -s zabbix-agent >/dev/null 2>&1; then
|
||||||
|
msg_info "Ancien Zabbix Agent détecté, suppression..."
|
||||||
|
$SUDO systemctl stop zabbix-agent >/dev/null 2>&1
|
||||||
|
$SUDO apt-get purge -y zabbix-agent
|
||||||
|
$SUDO apt-get autoremove -y
|
||||||
|
fi
|
||||||
|
|
||||||
read -rp "IP Zabbix [${CONFIG_DEB_INSTALL_ZABBIX_SERVER_IP}]: " ip;
|
read -rp "IP Zabbix [${CONFIG_DEB_INSTALL_ZABBIX_SERVER_IP}]: " ip;
|
||||||
ip=${ip:-${CONFIG_DEB_INSTALL_ZABBIX_SERVER_IP}}
|
ip=${ip:-${CONFIG_DEB_INSTALL_ZABBIX_SERVER_IP}}
|
||||||
$SUDO apt-get install -y zabbix-agent;
|
$SUDO apt-get install -y zabbix-agent2;
|
||||||
$SUDO sed -i "s/^Server=.*/Server=$ip/" /etc/zabbix/zabbix_agentd.conf
|
$SUDO sed -i "s/^Server=.*/Server=$ip/" /etc/zabbix/zabbix_agent2.conf
|
||||||
$SUDO sed -i "s/^ServerActive=.*/ServerActive=$ip/" /etc/zabbix/zabbix_agentd.conf
|
$SUDO sed -i "s/^ServerActive=.*/ServerActive=$ip/" /etc/zabbix/zabbix_agent2.conf
|
||||||
$SUDO systemctl restart zabbix-agent
|
# OPTIONNEL : Force l'agent à envoyer son propre nom d'hôte système
|
||||||
msg_success "Zabbix agent configuré."
|
$SUDO sed -i "s/^# HostnameItem=.*/HostnameItem=system.hostname/" /etc/zabbix/zabbix_agent2.conf
|
||||||
|
$SUDO sed -i "s/^Hostname=.*/# Hostname=Zabbix server/" /etc/zabbix/zabbix_agent2.conf
|
||||||
|
$SUDO systemctl enable zabbix-agent2
|
||||||
|
$SUDO systemctl restart zabbix-agent2
|
||||||
|
msg_success "Zabbix agent 2 configuré."
|
||||||
}
|
}
|
||||||
|
|
||||||
do_deb_sys_zabbix_conf(){
|
do_deb_sys_zabbix_conf(){
|
||||||
local ip
|
local ip
|
||||||
read -rp "IP Zabbix [${CONFIG_DEB_INSTALL_ZABBIX_SERVER_IP}]: " ip;
|
read -rp "IP Zabbix [${CONFIG_DEB_INSTALL_ZABBIX_SERVER_IP}]: " ip;
|
||||||
ip=${ip:-${CONFIG_DEB_INSTALL_ZABBIX_SERVER_IP}}
|
ip=${ip:-${CONFIG_DEB_INSTALL_ZABBIX_SERVER_IP}}
|
||||||
$SUDO sed -i "s/^Server=.*/Server=$ip/" /etc/zabbix/zabbix_agentd.conf
|
$SUDO sed -i "s/^Server=.*/Server=$ip/" /etc/zabbix/zabbix_agent2.conf
|
||||||
$SUDO sed -i "s/^ServerActive=.*/ServerActive=$ip/" /etc/zabbix/zabbix_agentd.conf
|
$SUDO sed -i "s/^ServerActive=.*/ServerActive=$ip/" /etc/zabbix/zabbix_agent2.conf
|
||||||
$SUDO systemctl restart zabbix-agent
|
# OPTIONNEL : Force l'agent à envoyer son propre nom d'hôte système
|
||||||
msg_success "Zabbix agent configuré."
|
$SUDO sed -i "s/^# HostnameItem=.*/HostnameItem=system.hostname/" /etc/zabbix/zabbix_agent2.conf
|
||||||
|
$SUDO sed -i "s/^Hostname=.*/# Hostname=Zabbix server/" /etc/zabbix/zabbix_agent2.conf
|
||||||
|
$SUDO systemctl enable zabbix-agent2
|
||||||
|
$SUDO systemctl restart zabbix-agent2
|
||||||
|
msg_success "Zabbix agent 2 configuré."
|
||||||
}
|
}
|
||||||
|
|
||||||
do_deb_sys_ipv6(){
|
do_deb_sys_ipv6(){
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue