1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/zabbix_ynh.git synced 2024-09-03 20:36:14 +02:00

Update install

This commit is contained in:
Mickael-Martin 2019-01-17 13:39:35 +01:00
parent 9af92b1050
commit a0ba5d5537

View file

@ -165,6 +165,57 @@ do
fi fi
done done
#=================================================
# Import Yunohost template
#=================================================
zabbixFullpath=https://$domain$path_url
localpath=$(find /var/cache/yunohost/ -name "Template_Yunohost.xml")
curl -s --cookie cookiejar.txt --cookie-jar cookiejar.txt \
--form "enter=Sign+in" \
--form "name=Admin" \
--form "password=zabbix" \
"$zabbixFullpath/index.php"
sid=$(curl -s --cookie cookiejar.txt --cookie-jar cookiejar.txt \
"$zabbixFullpath/conf.import.php?rules_preset=template" \
| grep -Po 'name="sid" value="\K([a-z0-9]{16})(?=")' )
importState=$(curl -s --cookie cookiejar.txt --cookie-jar cookiejar.txt \
--form "config=1" \
--form "import_file=@$localpath" \
--form rules[groups][createMissing]=1 \
--form rules[templates][updateExisting]=1 \
--form rules[templates][createMissing]=1 \
--form rules[templateScreens][updateExisting]=1 \
--form rules[templateScreens][createMissing]=1 \
--form rules[templateLinkage][createMissing]=1 \
--form rules[applications][createMissing]=1 \
--form rules[items][updateExisting]=1 \
--form rules[items][createMissing]=1 \
--form rules[discoveryRules][updateExisting]=1 \
--form rules[discoveryRules][createMissing]=1 \
--form rules[triggers][updateExisting]=1 \
--form rules[triggers][createMissing]=1 \
--form rules[graphs][updateExisting]=1 \
--form rules[graphs][createMissing]=1 \
--form rules[httptests][updateExisting]=1 \
--form rules[httptests][createMissing]=1 \
--form rules[valueMaps][createMissing]=1 \
--form "import=Import" \
--form "backurl=templates.php" \
--form "form_refresh=1" \
--form "sid=${sid}" \ \
"${zabbixFullpath}/conf.import.php?rules_preset=template" \
| grep -c "Imported successfully")
if [ "$importState" -eq "1" ];then
ynh_print_info "Template Yunohost imported !"
else
ynh_print_warn "Template Yunohost imported !"
fi
#disable default admin #disable default admin
lastid=$(mysql -u$db_user -p$db_pwd $db_name -BN -e "SELECT max(id) from \`users_groups\`") lastid=$(mysql -u$db_user -p$db_pwd $db_name -BN -e "SELECT max(id) from \`users_groups\`")
lastid=$(($lastid + 1 )) lastid=$(($lastid + 1 ))