better zabbix-agent pinning and activated mysql monitoring
This commit is contained in:
+18
-19
@@ -28,9 +28,10 @@ if [ "$yn" = "Y" ] || [ "$yn" = "y" ]; then
|
|||||||
echo -e "Stick with zabbix-agent 3.4"
|
echo -e "Stick with zabbix-agent 3.4"
|
||||||
echo "http://dl-cdn.alpinelinux.org/alpine/v3.8/main" >> /etc/apk/repositories
|
echo "http://dl-cdn.alpinelinux.org/alpine/v3.8/main" >> /etc/apk/repositories
|
||||||
echo "http://dl-cdn.alpinelinux.org/alpine/v3.8/community" >> /etc/apk/repositories
|
echo "http://dl-cdn.alpinelinux.org/alpine/v3.8/community" >> /etc/apk/repositories
|
||||||
echo -e "zabbix-agent<3.4.99" >> /etc/apk/world
|
# echo -e "zabbix-agent<3.4.99" >> /etc/apk/world
|
||||||
apk update
|
apk update
|
||||||
apk upgrade
|
# apk upgrade
|
||||||
|
apk add 'zabbix-agent=~3.4'
|
||||||
else
|
else
|
||||||
apk add zabbix-agent
|
apk add zabbix-agent
|
||||||
fi
|
fi
|
||||||
@@ -47,8 +48,6 @@ echo -n "Please provide the mysql root password : "
|
|||||||
read _root_mysql_passwd
|
read _root_mysql_passwd
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# configure zabbix agent
|
# configure zabbix agent
|
||||||
sed -i "s#Server=127.0.0.1#Server=$_ip#g" /etc/zabbix/zabbix_agentd.conf
|
sed -i "s#Server=127.0.0.1#Server=$_ip#g" /etc/zabbix/zabbix_agentd.conf
|
||||||
sed -i "s#ServerActive=127.0.0.1#ServerActive=$_ip#g" /etc/zabbix/zabbix_agentd.conf
|
sed -i "s#ServerActive=127.0.0.1#ServerActive=$_ip#g" /etc/zabbix/zabbix_agentd.conf
|
||||||
@@ -61,21 +60,21 @@ sed -i "s|#\ Include=$|Include= $_agent_conf_d|g" /etc/zabbix/zabbix_agentd.conf
|
|||||||
# apk
|
# apk
|
||||||
# check for alpine security updates
|
# check for alpine security updates
|
||||||
|
|
||||||
# # 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
|
mkdir /var/lib/zabbix
|
||||||
# # generate random password for zabbix mysql user
|
# generate random password for zabbix mysql user
|
||||||
# _passwd="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12)"
|
_passwd="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c16)"
|
||||||
# # add mysql credentials to zabbix home
|
# add mysql credentials to zabbix home
|
||||||
# printf "[client]\n
|
printf "[client]\n
|
||||||
# user=zabbix\n
|
user=zabbix\n
|
||||||
# password=$_passwd" > /var/lib/zabbix/.my.cnf
|
password=$_passwd" > /var/lib/zabbix/.my.cnf
|
||||||
# # create zabbix mysql user
|
# create zabbix mysql user
|
||||||
# mysql -uroot -p"$_root_mysql_passwd" -e "CREATE USER 'zabbix' IDENTIFIED BY '$_passwd';"
|
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';"
|
mysql -uroot -p"$_root_mysql_passwd" -e "GRANT USAGE ON *.* TO 'zabbix'@'localhost' IDENTIFIED BY '$_passwd';"
|
||||||
# # add zabbix-agent parameter
|
# add zabbix-agent parameter
|
||||||
# cp "$_assets"/zabbix/userparameter_mysql.conf "$_agent_conf_d"/
|
cp "$_assets"/zabbix/userparameter_mysql.conf "$_agent_conf_d"/
|
||||||
|
|
||||||
# NGINX
|
# NGINX
|
||||||
# https://github.com/sfuerte/zbx-nginx
|
# https://github.com/sfuerte/zbx-nginx
|
||||||
|
|||||||
Reference in New Issue
Block a user