sarmic/zabbix-authention-type-cli/set-zabbix-auth-type.sh

61 lines
1.1 KiB
Bash
Raw Normal View History

2021-04-28 12:41:23 +05:00
#!/bin/bash
read -p "Database Host [localhost]: " DB_HOST
read -p "Database Port [3306]: " DB_PORT
read -p "Database Name [zabbix]: " DB_NAME
read -p "Database User [zabbix]: " DB_USER
read -s -p "Database Password [zabbix]: " DB_PASS
if [ "$DB_HOST" = "" ]
then
DB_HOST=localhost
else
:
fi
if [ "$DB_PORT" = "" ]
then
DB_PORT=3306
else
:
fi
if [ "$DB_NAME" = "" ]
then
DB_NAME=zabbix
else
:
fi
if [ "$DB_USER" = "" ]
then
DB_USER=zabbix
else
:
fi
if [ "$DB_PASS" = "" ]
then
DB_PASS=zabbix
else
:
fi
echo ""
echo ""
echo "Select Authention Type"
echo "0 - Internal"
echo "1 - LDAP"
read -p "Please Input: " AUTHTYPE
echo ""
if [ "$AUTHTYPE" = "0" ]
then
:
elif [ "$AUTHTYPE" = "1" ]
then
:
else
echo "There was an error"
exit
fi
mysql -u ${DB_USER} -p${DB_PASS} \
-h ${DB_HOST} -P ${DB_PORT} \
-D ${DB_NAME} \
--execute="update zabbix.config set authentication_type='${AUTHTYPE}' where configid='1'";