1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/zabbix_ynh.git synced 2024-09-03 20:36:14 +02:00
This commit is contained in:
Thomas 2024-06-26 11:34:28 +00:00 committed by GitHub
commit 6a4157a09a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 33 additions and 26 deletions

View file

@ -7,7 +7,7 @@ location __PATH__/ {
index index_http.php;
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
#client_max_body_size 50M;
client_max_body_size 50M;
try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) {

View file

@ -7,7 +7,7 @@ name = "Zabbix"
description.en = "Monitoring tool for diverse IT components, including networks, servers, VMs and cloud services"
description.fr = "Outil pour monitorer des réseaux, des serveurs, des VMs et autres services en ligne"
version = "5.0.41~ynh3"
version = "6.4~ynh1"
maintainers = []
@ -87,18 +87,25 @@ ram.runtime = "200M"
"libjs-prototype",
"jq",
"libssh-4",
"php7.4-fpm",
"php7.4-bcmath",
"mariadb-server",
]
packages_from_raw_bash = """
if [[ $YNH_DEBIAN_VERSION == "bullseye" ]]; then
echo "php7.4-fpm", "php7.4-bcmath";
elif [[ $YNH_DEBIAN_VERSION == "bookworm" ]]; then
echo "php8.2-fpm", "php8.2-bcmath";
fi
"""
[resources.apt.extras.zabbix]
repo = "http://repo.zabbix.com/zabbix/5.0/debian __YNH_DEBIAN_VERSION__ main"
repo = "http://repo.zabbix.com/zabbix/6.4/debian __YNH_DEBIAN_VERSION__ main"
key = "https://repo.zabbix.com/zabbix-official-repo.key"
packages = [
"zabbix-agent",
"zabbix-frontend-php",
"zabbix-server-mysql",
"zabbix-sql-scripts"
]
[resources.database]

View file

@ -37,7 +37,7 @@ ynh_backup --src_path="/etc/zabbix/zabbix_agentd.conf"
ynh_backup --src_path="/etc/zabbix/zabbix_agentd.d"
# Backup sudo file
ynh_backup --src_path="/etc/sudoers.d/zabbix"
# ynh_backup --src_path="/etc/sudoers.d/zabbix"
#=================================================
# BACKUP THE MYSQL DATABASE

View file

@ -23,7 +23,7 @@ ynh_script_progression --message="Import default data in database..."
export mysqlconn="mysql --user=$db_user --password=$db_pwd --database=$db_name"
$mysqlconn -e "ALTER DATABASE $db_name CHARACTER SET utf8 COLLATE utf8_general_ci;"
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | $mysqlconn
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | $mysqlconn
convert_ZabbixDB
@ -34,23 +34,23 @@ $mysqlconn -e "UPDATE \`config\` SET \`http_auth_enabled\` = '1', \`http_login_f
surname=$(ynh_user_get_info "$admin" lastname)
name=$(ynh_user_get_info "$admin" firstname)
$mysqlconn -e "INSERT INTO \`users\` (\`userid\`,\`alias\`, \`name\`, \`surname\`, \`passwd\`, \`url\`, \`autologin\`, \`autologout\`, \`lang\`, \`refresh\`, \`type\`, \`theme\`, \`attempt_failed\`, \`attempt_ip\`, \`attempt_clock\`, \`rows_per_page\`) VALUES (3,'$admin', '$admin', '$admin', '5fce1b3e34b520afeffb37ce08c7cd66', '', 0, '0', '$language', '30s', 3, 'default', 0, '', 0, 50);"
$mysqlconn -e "INSERT INTO \`users_groups\` (\`id\`, \`usrgrpid\`, \`userid\`) VALUES (5, 7, 3);"
#$mysqlconn -e "INSERT INTO \`users\` (\`userid\`,\`username\`, \`name\`, \`surname\`, \`passwd\`, \`url\`, \`autologin\`, \`autologout\`, \`lang\`, \`refresh\`, \`theme\`, \`attempt_failed\`, \`attempt_ip\`, \`attempt_clock\`, \`rows_per_page\`) VALUES (3,'$admin', '$admin', '$admin', '5fce1b3e34b520afeffb37ce08c7cd66', '', 0, '0', '$language', '30s', 3, 'default', 0, '', 0, 50);"
#$mysqlconn -e "INSERT INTO \`users_groups\` (\`id\`, \`usrgrpid\`, \`userid\`) VALUES (5, 7, 3);"
#users creation in zabbix database
i=4
for user in $(ynh_user_list);
do
if [ "$user" != "$admin" ]
then
surname=$(ynh_user_get_info --username="$user" --key=lastname)
name=$(ynh_user_get_info --username="$user" --key=firstname)
$mysqlconn -e "INSERT INTO \`users\` (\`userid\`, \`alias\`, \`name\`, \`surname\`, \`passwd\`, \`url\`, \`autologin\`, \`autologout\`, \`lang\`, \`refresh\`, \`type\`, \`theme\`, \`attempt_failed\`, \`attempt_ip\`, \`attempt_clock\`, \`rows_per_page\`) VALUES ($i,'$user', '$name', '$surname', '5fce1b3e34b520afeffb37ce08c7cd66', '', 0, '0', '$language', '30s', 1, 'default', 0, '', 0, 50);"
i=$((i+1))
fi
done
#i=4
#for user in $(ynh_user_list);
#do
# if [ "$user" != "$admin" ]
# then
# surname=$(ynh_user_get_info --username="$user" --key=lastname)
# name=$(ynh_user_get_info --username="$user" --key=firstname)
# $mysqlconn -e "INSERT INTO \`users\` (\`userid\`, \`alias\`, \`name\`, \`surname\`, \`passwd\`, \`url\`, \`autologin\`, \`autologout\`, \`lang\`, \`refresh\`, \`type\`, \`theme\`, \`attempt_failed\`, \`attempt_ip\`, \`attempt_clock\`, \`rows_per_page\`) VALUES ($i,'$user', '$name', '$surname', '5fce1b3e34b520afeffb37ce08c7cd66', '', 0, '0', '$language', '30s', 'default', 0, '', 0, 50);"
# i=$((i+1))
# fi
#done
disable_guest_user
#disable_guest_user
set_mediatype_default_yunohost
@ -95,13 +95,13 @@ update_initZabbixConf
#=================================================
# SETUP APPLICATION WITH CURL
#=================================================
ynh_script_progression --message="Setting up application with CURL..."
#ynh_script_progression --message="Setting up application with CURL..."
import_template
#import_template
link_template
#link_template
disable_admin_user
#disable_admin_user
#=================================================
# START SYSTEMD SERVICE

View file

@ -49,7 +49,7 @@ if [ ! -L /etc/zabbix/zabbix_agentd.d ]; then
fi
# Restore sudo file
ynh_restore_file --origin_path="/etc/sudoers.d/zabbix"
# ynh_restore_file --origin_path="/etc/sudoers.d/zabbix"
#=================================================
# RESTORE SYSTEM CONFIGURATIONS