somme options on zabbix-agent install
This commit is contained in:
parent
015307986d
commit
62c03fc009
@ -69,27 +69,41 @@ cp "$_assets"/zabbix/apt.conf "$_agent_conf_d"/
|
|||||||
# MYSQL
|
# MYSQL
|
||||||
# https://serverfault.com/questions/737018/zabbix-user-parameter-mysql-status-setting-home
|
# https://serverfault.com/questions/737018/zabbix-user-parameter-mysql-status-setting-home
|
||||||
# create zabbix user home
|
# create zabbix user home
|
||||||
mkdir /var/lib/zabbix
|
|
||||||
# generate random password for zabbix mysql user
|
echo -n "monitor mysql? [Y|n] "
|
||||||
_passwd="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12)"
|
read yn
|
||||||
# add mysql credentials to zabbix home
|
yn=${yn:-y}
|
||||||
printf "[client]\n
|
if [ "$yn" = "Y" ] || [ "$yn" = "y" ]; then
|
||||||
user=zabbix\n
|
mkdir /var/lib/zabbix
|
||||||
password=$_passwd" > /var/lib/zabbix/.my.cnf
|
# generate random password for zabbix mysql user
|
||||||
# create zabbix mysql user
|
_passwd="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12)"
|
||||||
mysql -uroot -p"$_root_mysql_passwd" -e "CREATE USER 'zabbix' IDENTIFIED BY '$_passwd';"
|
# add mysql credentials to zabbix home
|
||||||
mysql -uroot -p"$_root_mysql_passwd" -e "GRANT USAGE ON *.* TO 'zabbix'@'localhost' IDENTIFIED BY '$_passwd';"
|
printf "[client]\n
|
||||||
# add zabbix-agent parameter
|
user=zabbix\n
|
||||||
cp "$_assets"/zabbix/userparameter_mysql.conf "$_agent_conf_d"/
|
password=$_passwd" > /var/lib/zabbix/.my.cnf
|
||||||
|
# create zabbix mysql user
|
||||||
|
mysql -uroot -p"$_root_mysql_passwd" -e "CREATE USER 'zabbix' IDENTIFIED BY '$_passwd';"
|
||||||
|
mysql -uroot -p"$_root_mysql_passwd" -e "GRANT USAGE ON *.* TO 'zabbix'@'localhost' IDENTIFIED BY '$_passwd';"
|
||||||
|
# add zabbix-agent parameter
|
||||||
|
cp "$_assets"/zabbix/userparameter_mysql.conf "$_agent_conf_d"/
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# NGINX
|
# NGINX
|
||||||
# https://github.com/sfuerte/zbx-nginx
|
# https://github.com/sfuerte/zbx-nginx
|
||||||
# nginxconf already included in default.nginxconf asset
|
# nginxconf already included in default.nginxconf asset
|
||||||
sed -i "s/# allow CURRENT-SERVER-IP/allow $_cur_ip/g" /etc/nginx/sites-available/default
|
|
||||||
cp "$_assets"/zabbix/userparameter_nginx.conf "$_agent_conf_d"/
|
echo -n "Monitor nginx? [Y|n] "
|
||||||
mkdir /etc/zabbix/zabbix_agentd.scripts
|
read yn
|
||||||
cp "$_assets"/zabbix/scripts/nginx-stat.py /etc/zabbix/zabbix_agentd.scripts/
|
yn=${yn:-y}
|
||||||
chmod +x /etc/zabbix/zabbix_agentd.scripts/nginx-stat.py
|
if [ "$yn" = "Y" ] || [ "$yn" = "y" ]; then
|
||||||
|
sed -i "s/# allow CURRENT-SERVER-IP/allow $_cur_ip/g" /etc/nginx/sites-available/default
|
||||||
|
cp "$_assets"/zabbix/userparameter_nginx.conf "$_agent_conf_d"/
|
||||||
|
mkdir /etc/zabbix/zabbix_agentd.scripts
|
||||||
|
cp "$_assets"/zabbix/scripts/nginx-stat.py /etc/zabbix/zabbix_agentd.scripts/
|
||||||
|
chmod +x /etc/zabbix/zabbix_agentd.scripts/nginx-stat.py
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo -n "This is box is a proxmox CT? [Y|n] "
|
echo -n "This is box is a proxmox CT? [Y|n] "
|
||||||
read yn
|
read yn
|
||||||
|
Loading…
x
Reference in New Issue
Block a user