mirror of
https://github.com/YunoHost-Apps/zabbix_ynh.git
synced 2024-09-03 20:36:14 +02:00
Revert "Delete ynh_add_extra_apt_repos__3"
This reverts commit 99d93bbc7a00c433d3f088176f347b15ae1e9431
This commit is contained in:
parent
691a07f48a
commit
2285ee09b1
12 changed files with 165 additions and 52 deletions
|
@ -18,7 +18,7 @@ location __PATH__/ {
|
||||||
try_files $uri $uri/ index.php;
|
try_files $uri $uri/ index.php;
|
||||||
location ~ [^/]\.php(/|$) {
|
location ~ [^/]\.php(/|$) {
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock;
|
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
|
||||||
|
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
|
|
|
@ -18,5 +18,5 @@ catch_workers_output = yes
|
||||||
php_value[post_max_size] = 16M
|
php_value[post_max_size] = 16M
|
||||||
php_value[max_execution_time] = 300
|
php_value[max_execution_time] = 300
|
||||||
php_value[max_input_time] = 300
|
php_value[max_input_time] = 300
|
||||||
php_value[open_basedir] = /var/www/zabbix/:/usr/share/fonts/:/tmp
|
php_value[open_basedir] = /var/www/zabbix/:/usr/share/fonts/:/tmp:/etc/zabbix/web
|
||||||
php_value[date.timezone] = Europe/Paris
|
php_value[date.timezone] = Europe/Paris
|
|
@ -6,7 +6,7 @@
|
||||||
"en": "A monitoring tool for diverse IT components, including networks, servers, VMs and cloud services.",
|
"en": "A monitoring tool for diverse IT components, including networks, servers, VMs and cloud services.",
|
||||||
"fr": "Un outil pour monitorer des réseaux, des serveurs, des VMs et autres services en ligne"
|
"fr": "Un outil pour monitorer des réseaux, des serveurs, des VMs et autres services en ligne"
|
||||||
},
|
},
|
||||||
"version": "3.1",
|
"version": "3.2",
|
||||||
"url": "https://www.zabbix.com",
|
"url": "https://www.zabbix.com",
|
||||||
"license": "free",
|
"license": "free",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
|
|
@ -179,3 +179,32 @@ remove_zabbix_repo(){
|
||||||
source "$ynh_add_extra_apt_repos__3_path"
|
source "$ynh_add_extra_apt_repos__3_path"
|
||||||
ynh_remove_extra_repo --name=zabbix
|
ynh_remove_extra_repo --name=zabbix
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_initZabbixConf(){
|
||||||
|
if [ ! -d /etc/zabbix/web ] ;then mkdir -p /etc/zabbix/web ;fi
|
||||||
|
cp $(find /var/cache/yunohost/ -name "etc_zabbix_web_init.zabbix.conf.php.sh") /etc/zabbix/web/init.zabbix.conf.php.sh
|
||||||
|
chmod 700 /etc/zabbix/web/init.zabbix.conf.php.sh
|
||||||
|
cp $(find /var/cache/yunohost/ -name "etc_apt_apt.conf.d_100update_force_init_zabbix_frontend_config") /etc/apt/apt.conf.d/100update_force_init_zabbix_frontend_config
|
||||||
|
}
|
||||||
|
delete_initZabbixConf(){
|
||||||
|
if [ -f /etc/zabbix/web/init.zabbix.conf.php.sh ] ; then ynh_secure_remove /etc/zabbix/web/init.zabbix.conf.php.sh;fi
|
||||||
|
if [ -f /etc/apt/apt.conf.d/100update_force_init_zabbix_frontend_config ] ;then ynh_secure_remove /etc/apt/apt.conf.d/100update_force_init_zabbix_frontend_config ;fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#Patch timeout too short for zabbix agent if needed
|
||||||
|
change_timeoutAgent(){
|
||||||
|
timeout_ok=$(grep "^Timeout" /etc/zabbix/zabbix_agentd.conf 2>/dev/null || true;)
|
||||||
|
if [ -z "$timeout_ok" ] ;then
|
||||||
|
ynh_replace_string --match_string="# Timeout=3" --replace_string="Timeout=10" --target_file=/etc/zabbix/zabbix_agentd.conf
|
||||||
|
grep -C 2 "Timeout" /etc/zabbix/zabbix_agentd.conf
|
||||||
|
systemctl restart zabbix-agent
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
convert_ZabbixDB(){
|
||||||
|
mysql --user=$db_user --password=$db_pwd --database=zabbix -e "ALTER DATABASE $db_name CHARACTER SET utf8 COLLATE utf8_general_ci;"
|
||||||
|
for t in $(mysql -B -N --user=$db_user --password=$db_pwd --database=$db_name -e "show tables";)
|
||||||
|
do
|
||||||
|
mysql --user=$db_user --password=$db_pwd --database=$db_name -e "ALTER TABLE $t CONVERT TO character set utf8 collate utf8_bin;"
|
||||||
|
done
|
||||||
|
}
|
|
@ -39,31 +39,42 @@ nonfree=$(ynh_app_setting_get $app nonfree)
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
#backup frontend config
|
#backup frontend config
|
||||||
|
ynh_print_info "Backup $final_path conf/zabbix.conf.php"
|
||||||
ynh_backup "$final_path/conf/zabbix.conf.php"
|
ynh_backup "$final_path/conf/zabbix.conf.php"
|
||||||
|
ynh_print_info "Backup /etc/zabbix/web"
|
||||||
|
ynh_backup "/etc/zabbix/web"
|
||||||
|
#ynh_print_info "Backup /etc/zabbix/web/init.zabbix.conf.php.sh"
|
||||||
|
#ynh_backup "/etc/zabbix/web/init.zabbix.conf.php.sh"
|
||||||
|
ynh_print_info "Backup /etc/apt/apt.conf.d/100update_force_init_zabbix_frontend_config"
|
||||||
|
ynh_backup "/etc/apt/apt.conf.d/100update_force_init_zabbix_frontend_config"
|
||||||
|
|
||||||
#backup server confif
|
#backup server confif
|
||||||
|
ynh_print_info "Backup /etc/zabbix/zabbix_server.conf"
|
||||||
ynh_backup "/etc/zabbix/zabbix_server.conf"
|
ynh_backup "/etc/zabbix/zabbix_server.conf"
|
||||||
|
|
||||||
#backup agent config
|
#backup agent config
|
||||||
|
ynh_print_info "Backup /etc/zabbix/zabbix_agentd.conf"
|
||||||
ynh_backup "/etc/zabbix/zabbix_agentd.conf"
|
ynh_backup "/etc/zabbix/zabbix_agentd.conf"
|
||||||
|
ynh_print_info "Backup /etc/zabbix/zabbix_agentd.d"
|
||||||
ynh_backup "/etc/zabbix/zabbix_agentd.d"
|
ynh_backup "/etc/zabbix/zabbix_agentd.d"
|
||||||
|
|
||||||
#backup sudo file
|
#backup sudo file
|
||||||
|
ynh_print_info "Backup /etc/sudoers.d/zabbix"
|
||||||
ynh_backup "/etc/sudoers.d/zabbix"
|
ynh_backup "/etc/sudoers.d/zabbix"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backup /etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE PHP-FPM CONFIGURATION
|
# BACKUP THE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backup /etc/php/7.0/fpm/pool.d/$app.conf"
|
||||||
ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf"
|
ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE MYSQL DATABASE
|
# BACKUP THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backup Zabbix database"
|
||||||
ynh_mysql_dump_db "$db_name" > db.sql
|
ynh_mysql_dump_db "$db_name" > db.sql
|
|
@ -57,7 +57,7 @@ ynh_webpath_register "$app" "$domain" "$path_url"
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Get infos from manifest"
|
ynh_script_progression --message="Get infos from manifest" -w 1
|
||||||
|
|
||||||
ynh_app_setting_set "$app" domain "$domain"
|
ynh_app_setting_set "$app" domain "$domain"
|
||||||
ynh_app_setting_set "$app" path "$path_url"
|
ynh_app_setting_set "$app" path "$path_url"
|
||||||
|
@ -95,14 +95,14 @@ ynh_app_setting_set "$app" language "$language"
|
||||||
### - Remove the section "REMOVE DEPENDENCIES" in the remove script
|
### - Remove the section "REMOVE DEPENDENCIES" in the remove script
|
||||||
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
|
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
|
||||||
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
|
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
|
||||||
ynh_print_info "Remove Zabbix if already installed"
|
ynh_script_progression --message="Remove Zabbix if already installed" -w 1
|
||||||
apt purge zabbix* -y
|
apt-get purge zabbix* -y
|
||||||
rm -fr /var/cache/apt/archives/zabbix-server-mysql*
|
rm -fr /var/cache/apt/archives/zabbix-server-mysql*
|
||||||
|
|
||||||
ynh_print_info "Install Zabbix repository"
|
ynh_script_progression --message="Install Zabbix repository" -w 3
|
||||||
install_zabbix_repo
|
install_zabbix_repo
|
||||||
|
|
||||||
ynh_print_info "Update and install dependencies"
|
ynh_script_progression --message="Update and install dependencies" -w 5
|
||||||
#ynh_package_update no need cause ynh_install_app_dependencies after
|
#ynh_package_update no need cause ynh_install_app_dependencies after
|
||||||
ynh_install_app_dependencies libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 php7.0 php-bcmath php7.0-bcmath ttf-dejavu-core php7.0-bcmath patch smistrip unzip wget fping libcap2-bin libiksemel3 libopenipmi0 libpam-cap libsnmp-base libsnmp30 snmptrapd snmpd libjs-prototype jq zabbix-server-mysql zabbix-agent zabbix-frontend-php
|
ynh_install_app_dependencies libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 php7.0 php-bcmath php7.0-bcmath ttf-dejavu-core php7.0-bcmath patch smistrip unzip wget fping libcap2-bin libiksemel3 libopenipmi0 libpam-cap libsnmp-base libsnmp30 snmptrapd snmpd libjs-prototype jq zabbix-server-mysql zabbix-agent zabbix-frontend-php
|
||||||
dpkg -i --force-confmiss /var/cache/apt/archives/zabbix-server-mysql*
|
dpkg -i --force-confmiss /var/cache/apt/archives/zabbix-server-mysql*
|
||||||
|
@ -116,7 +116,7 @@ rm "$final_path/conf/zabbix.conf.php"
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A MYSQL DATABASE
|
# CREATE A MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Create and add default data in db"
|
ynh_script_progression --message="Creation of database " -w 10
|
||||||
|
|
||||||
### Use these lines if you need a database for the application.
|
### Use these lines if you need a database for the application.
|
||||||
### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password.
|
### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password.
|
||||||
|
@ -133,11 +133,15 @@ db_user="$db_name"
|
||||||
ynh_app_setting_set "$app" db_name "$db_name"
|
ynh_app_setting_set "$app" db_name "$db_name"
|
||||||
ynh_app_setting_set "$app" db_user "$db_user"
|
ynh_app_setting_set "$app" db_user "$db_user"
|
||||||
ynh_mysql_setup_db "$db_user" "$db_name"
|
ynh_mysql_setup_db "$db_user" "$db_name"
|
||||||
|
|
||||||
export mysqlconn="mysql -u$db_user -p$db_pwd $db_name"
|
export mysqlconn="mysql -u$db_user -p$db_pwd $db_name"
|
||||||
|
mysql --user=$db_user --password=$db_pwd --database=zabbix -e "ALTER DATABASE $db_name CHARACTER SET utf8 COLLATE utf8_general_ci;"
|
||||||
|
|
||||||
|
ynh_script_progression --message="Import default data in database..." -w 25
|
||||||
|
|
||||||
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | $mysqlconn
|
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | $mysqlconn
|
||||||
|
|
||||||
|
convert_ZabbixDB
|
||||||
|
|
||||||
#sso integration
|
#sso integration
|
||||||
$mysqlconn -e "UPDATE \`config\` SET \`http_auth_enabled\` = '1', \`http_login_form\` = '1' WHERE \`config\`.\`configid\` = 1;"
|
$mysqlconn -e "UPDATE \`config\` SET \`http_auth_enabled\` = '1', \`http_login_form\` = '1' WHERE \`config\`.\`configid\` = 1;"
|
||||||
|
|
||||||
|
@ -180,7 +184,7 @@ ynh_app_setting_set "$app" final_path "$final_path"
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
#ynh_setup_source "$final_path"
|
#ynh_setup_source "$final_path"
|
||||||
|
|
||||||
ynh_print_info "Generate web config"
|
ynh_script_progression --message="Generate web config" -w 5
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -274,7 +278,9 @@ systemctl reload nginx
|
||||||
|
|
||||||
### `ynh_replace_string` is used to replace a string in a file.
|
### `ynh_replace_string` is used to replace a string in a file.
|
||||||
### (It's compatible with sed regular expressions syntax)
|
### (It's compatible with sed regular expressions syntax)
|
||||||
ynh_print_info "Generate zabbix config files"
|
|
||||||
|
ynh_script_progression -m "Generate zabbix config files" -w 5
|
||||||
|
|
||||||
confServerPath=$(find /var/cache/yunohost/ -name "usr_share_zabbix_conf_zabbix.conf.php")
|
confServerPath=$(find /var/cache/yunohost/ -name "usr_share_zabbix_conf_zabbix.conf.php")
|
||||||
cp "$confServerPath" /usr/share/zabbix/conf/zabbix.conf.php
|
cp "$confServerPath" /usr/share/zabbix/conf/zabbix.conf.php
|
||||||
ynh_replace_string --match_string="db_name" --replace_string="$db_name" --target_file=/usr/share/zabbix/conf/zabbix.conf.php
|
ynh_replace_string --match_string="db_name" --replace_string="$db_name" --target_file=/usr/share/zabbix/conf/zabbix.conf.php
|
||||||
|
@ -287,10 +293,14 @@ ynh_replace_string --match_string="DBName=zabbix" --replace_string="DBName=$db_n
|
||||||
ynh_replace_string --match_string="DBUser=zabbix" --replace_string="DBUser=$db_user" --target_file=/etc/zabbix/zabbix_server.conf
|
ynh_replace_string --match_string="DBUser=zabbix" --replace_string="DBUser=$db_user" --target_file=/etc/zabbix/zabbix_server.conf
|
||||||
ynh_replace_string --match_string="# DBPassword=" --replace_string="# DBPassword=\nDBPassword=$db_pwd" --target_file=/etc/zabbix/zabbix_server.conf
|
ynh_replace_string --match_string="# DBPassword=" --replace_string="# DBPassword=\nDBPassword=$db_pwd" --target_file=/etc/zabbix/zabbix_server.conf
|
||||||
|
|
||||||
ynh_replace_string --match_string="# Timeout=3" --replace_string="# Timeout=3\nTimeout=10" --target_file=/etc/zabbix/zabbix_agentd.conf
|
systemctl enable zabbix-agent --quiet && systemctl restart zabbix-agent
|
||||||
|
change_timeoutAgent
|
||||||
|
systemctl enable zabbix-server --quiet && systemctl restart zabbix-server
|
||||||
|
|
||||||
systemctl enable zabbix-agent && systemctl restart zabbix-agent
|
#=================================================
|
||||||
systemctl enable zabbix-server && systemctl restart zabbix-server
|
# INSTALL hook to verify if conf file is broken (after an update for example)
|
||||||
|
#=================================================
|
||||||
|
update_initZabbixConf
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
# STORE THE CONFIG FILE CHECKSUM
|
||||||
|
@ -365,11 +375,13 @@ yunohost app ssowatconf
|
||||||
#=================================================
|
#=================================================
|
||||||
# Import Yunohost template
|
# Import Yunohost template
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression -m "Importing last template Yunohost in Zabbix" -w 5
|
||||||
import_template
|
import_template
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Link Yunohost template to the ZAbbix Server Host
|
# Link Yunohost template to the ZAbbix Server Host
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression -m "Importing last template Yunohost in Zabbix" -w 5
|
||||||
link_template
|
link_template
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -402,3 +414,9 @@ check_proc_zabbixagent
|
||||||
|
|
||||||
#test if zabbix agent is started
|
#test if zabbix agent is started
|
||||||
check_proc_zabbixserver
|
check_proc_zabbixserver
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Installation of $app completed" --last
|
|
@ -42,20 +42,23 @@ ynh_remove_fpm_config
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
timeout 5 systemctl stop zabbix-server || killall zabbix_server
|
timeout 5 systemctl stop zabbix-server || killall zabbix_server
|
||||||
systemctl disable zabbix-server
|
systemctl disable zabbix-server --quiet
|
||||||
killall zabbix_server
|
killall zabbix_server
|
||||||
|
|
||||||
timeout 5 systemctl stop zabbix-agent || killall zabbix_agentd
|
timeout 5 systemctl stop zabbix-agent || killall zabbix_agentd
|
||||||
systemctl disable zabbix-agent
|
systemctl disable zabbix-agent --quiet
|
||||||
killall zabbix_agentd
|
killall zabbix_agentd
|
||||||
|
|
||||||
DEBIAN_FRONTEND=noninteractive apt purge zabbix-release -y
|
#Remove config file detection
|
||||||
|
delete_initZabbixConf
|
||||||
|
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get purge zabbix-release -y
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
#force removing if ynh_remove_app_dependencies not work (old zabbix version)
|
#force removing if ynh_remove_app_dependencies not work (old zabbix version)
|
||||||
for zabbix_pkg in $(apt list --installed | grep -Po "\K(zabbix-.*)(?=/)")
|
for zabbix_pkg in $(apt list --installed | grep -Po "\K(zabbix-.*)(?=/)")
|
||||||
do
|
do
|
||||||
DEBIAN_FRONTEND=noninteractive apt purge --allow-change-held-packages "$zabbix_pkg" -y
|
DEBIAN_FRONTEND=noninteractive apt-get purge --allow-change-held-packages "$zabbix_pkg" -y
|
||||||
done
|
done
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -97,20 +100,20 @@ fi
|
||||||
|
|
||||||
remove_zabbix_repo
|
remove_zabbix_repo
|
||||||
|
|
||||||
#remove symlink
|
if [ -d /var/www/zabbix ] ;then ynh_secure_remove /var/www/zabbix;fi
|
||||||
rm /var/www/zabbix
|
|
||||||
|
|
||||||
# Remove a directory securely
|
# Remove a directory securely
|
||||||
ynh_secure_remove "/etc/zabbix"
|
if [ -d /etc/zabbix ] ;then ynh_secure_remove "/etc/zabbix";fi
|
||||||
|
|
||||||
# Remove the log files
|
# Remove the log files
|
||||||
ynh_secure_remove "/var/log/zabbix"
|
if [ -d /var/log/zabbix ] ;then ynh_secure_remove "/var/log/zabbix";fi
|
||||||
|
|
||||||
# Remove the pid/socket files
|
# Remove the pid/socket files
|
||||||
ynh_secure_remove "/run/zabbix"
|
if [ -d /run/zabbix ] ;then ynh_secure_remove "/run/zabbix";fi
|
||||||
|
|
||||||
# Remove the sudoers file
|
# Remove the sudoers file
|
||||||
ynh_secure_remove "/etc/sudoers.d/zabbix"
|
if [ -f /etc/sudoers.d/zabbix ] ;then ynh_secure_remove "/etc/sudoers.d/zabbix";fi
|
||||||
|
|
||||||
|
|
||||||
#REMOVE NONFREE PART PATCH IF NEEDED (snmp-mibs-downloader (non-free) installed in version 1)
|
#REMOVE NONFREE PART PATCH IF NEEDED (snmp-mibs-downloader (non-free) installed in version 1)
|
||||||
nonfreepackagelist=$(dpkg-query -W -f='${Section}\t${Package}\n' | grep ^non-free)
|
nonfreepackagelist=$(dpkg-query -W -f='${Section}\t${Package}\n' | grep ^non-free)
|
||||||
|
|
|
@ -96,8 +96,10 @@ db_user=$(ynh_app_setting_get $app db_user)
|
||||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||||
|
|
||||||
ynh_mysql_setup_db "$db_user" "$db_name" "$db_pwd"
|
ynh_mysql_setup_db "$db_user" "$db_name" "$db_pwd"
|
||||||
|
convert_ZabbixDB
|
||||||
ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < ./db.sql
|
ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < ./db.sql
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Restore configs files
|
# Restore configs files
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -110,13 +112,20 @@ ynh_restore_file "/usr/share/zabbix/conf/zabbix.conf.php"
|
||||||
chown -R www-data. /usr/share/zabbix
|
chown -R www-data. /usr/share/zabbix
|
||||||
|
|
||||||
ynh_restore_file "/etc/zabbix"
|
ynh_restore_file "/etc/zabbix"
|
||||||
|
ls -Rail "/etc/zabbix"
|
||||||
# systemd and yunohost service management
|
#ynh_restore_file "/etc/zabbix/web"
|
||||||
systemctl enable zabbix-server && systemctl start zabbix-server
|
#ynh_restore_file "/etc/zabbix/web/init.zabbix.conf.php.sh"
|
||||||
|
ynh_restore_file "/etc/apt/apt.conf.d/100update_force_init_zabbix_frontend_config"
|
||||||
|
if [ ! -L /etc/zabbix/zabbix_agentd.d ];then
|
||||||
|
ln -s /etc/zabbix/zabbix_agentd.conf.d /etc/zabbix/zabbix_agentd.d
|
||||||
|
fi
|
||||||
|
systemctl enable zabbix-agent && systemctl restart zabbix-agent
|
||||||
|
change_timeoutAgent
|
||||||
|
systemctl enable zabbix-server && systemctl restart zabbix-server
|
||||||
|
|
||||||
yunohost service add snmpd -d "Management of SNMP Daemon"
|
yunohost service add snmpd -d "Management of SNMP Daemon"
|
||||||
yunohost service add zabbix-server -d "Management Zabbix server daemon : Collect, agregate, compute and notify"
|
yunohost service add zabbix-server -d "Management Zabbix server daemon : Collect, agregate, compute and notify"
|
||||||
yunohost service add zabbix-client -d "Management Zabbix client daemon : send informations about this host to the server"
|
yunohost service add zabbix-agent -d "Management Zabbix agent daemon : send informations about this host to the server"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
|
|
|
@ -93,25 +93,8 @@ disable_guest_user
|
||||||
# Normalize the URL path syntax
|
# Normalize the URL path syntax
|
||||||
path_url=$(ynh_normalize_url_path "$path_url")
|
path_url=$(ynh_normalize_url_path "$path_url")
|
||||||
|
|
||||||
#REMOVE NONFREE PART PATCH IF NEEDED (snmp-mibs-downloader (non-free) installed in version 1)
|
|
||||||
nonfreepackagelist=$(dpkg-query -W -f='${Section}\t${Package}\n' | grep ^non-free)
|
|
||||||
if [ $(echo $nonfreepackagelist | wc -l) -eq 1 ] && [ $(echo $nonfreepackagelist | grep -c "snmp-mibs-downloader") -eq 1 ] ;then
|
|
||||||
ynh_print_info "Removing snmp-mibs-downloader (non-free package)"
|
|
||||||
#want backup file , cannot use ynh_replace_string
|
|
||||||
cp /var/lib/dpkg/status{,.$(date "+%m%d%y")}
|
|
||||||
ynh_replace_string --match_string=" snmp-mibs-downloader," --replace_string="" --target_file=/var/lib/dpkg/status
|
|
||||||
DEBIAN_FRONTEND=noninteractive apt purge snmp-mibs-downloader -y
|
|
||||||
if [ -f /etc/apt/sources.list.d/non-free.list ];then
|
|
||||||
ynh_secure_remove /etc/apt/sources.list.d/non-free.list
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#Patch timeout too short for zabbix agent if needed
|
#Patch timeout too short for zabbix agent if needed
|
||||||
timeout_ok=$(grep -c "^Timeout" /etc/zabbix/zabbix_agentd.conf 2>/dev/null)
|
change_timeoutAgent
|
||||||
if [ $timeout_ok -ne 1 ] ;then
|
|
||||||
ynh_replace_string --match_string="# Timeout=3" --replace_string="# Timeout=3\nTimeout=10" --target_file=/etc/zabbix/zabbix_agentd.conf
|
|
||||||
systemctl enable zabbix-agent && systemctl restart zabbix-agent
|
|
||||||
fi
|
|
||||||
|
|
||||||
#patch if zabbix-release installed
|
#patch if zabbix-release installed
|
||||||
if [ "$(dpkg -l zabbix-release 2>/dev/null | wc -l)" -ne 0 ];then
|
if [ "$(dpkg -l zabbix-release 2>/dev/null | wc -l)" -ne 0 ];then
|
||||||
|
@ -189,6 +172,35 @@ else
|
||||||
ynh_print_info "No repo update ! (Trusted version)"
|
ynh_print_info "No repo update ! (Trusted version)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INSTALL hook to verify if conf file is broken (after an update for example)
|
||||||
|
#=================================================
|
||||||
|
update_initZabbixConf
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# Update db to utf8
|
||||||
|
#=================================================
|
||||||
|
convert_ZabbixDB
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# Update php-fpm confi
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Update php-fpm config"
|
||||||
|
# Remove the dedicated php-fpm config
|
||||||
|
ynh_remove_fpm_config
|
||||||
|
# Create a dedicated php-fpm config
|
||||||
|
ynh_add_fpm_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# Update nginx config
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Update nginx config"
|
||||||
|
# Remove the dedicated nginx config
|
||||||
|
ynh_remove_nginx_config
|
||||||
|
# Create a dedicated nginx config
|
||||||
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RE-ENABLE SSOWAT
|
# RE-ENABLE SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<zabbix_export>
|
<zabbix_export>
|
||||||
<version>4.4</version>
|
<version>4.4</version>
|
||||||
<date>2020-01-13T12:25:26Z</date>
|
<date>2020-04-22T11:49:47Z</date>
|
||||||
<groups>
|
<groups>
|
||||||
<group>
|
<group>
|
||||||
<name>Templates/Applications</name>
|
<name>Templates/Applications</name>
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
DPkg::Post-Invoke {"/etc/zabbix/web/init.zabbix.conf.php.sh;"};
|
|
@ -0,0 +1,30 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ ! -e "/var/www/zabbix/conf/zabbix.conf.php" ] ; then
|
||||||
|
if [ ! -f /etc/zabbix/web/zabbix.conf.php ];then
|
||||||
|
cp /usr/share/zabbix/conf/zabbix.conf.php.example /etc/zabbix/web/zabbix.conf.php
|
||||||
|
fi
|
||||||
|
|
||||||
|
ln -s /etc/zabbix/web/zabbix.conf.php /usr/share/zabbix/conf/zabbix.conf.php
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
echo "<?php
|
||||||
|
// Zabbix GUI configuration file.
|
||||||
|
global \$DB, \$HISTORY;
|
||||||
|
|
||||||
|
\$DB['TYPE'] = 'MYSQL';
|
||||||
|
\$DB['SERVER'] = 'localhost';
|
||||||
|
\$DB['PORT'] = '0';
|
||||||
|
\$DB['DATABASE'] = '"$(yunohost app setting zabbix db_name)"';
|
||||||
|
\$DB['USER'] = '"$(yunohost app setting zabbix db_user)"';
|
||||||
|
\$DB['PASSWORD'] = '"$(yunohost app setting zabbix mysqlpwd)"';
|
||||||
|
// Schema name. Used for IBM DB2 and PostgreSQL.
|
||||||
|
\$DB['SCHEMA'] = '';
|
||||||
|
|
||||||
|
\$ZBX_SERVER = 'localhost';
|
||||||
|
\$ZBX_SERVER_PORT = '10051';
|
||||||
|
\$ZBX_SERVER_NAME = '';
|
||||||
|
|
||||||
|
\$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;">/etc/zabbix/web/zabbix.conf.php
|
||||||
|
|
||||||
|
echo "Frontend Zabbix Configuration fixed !"
|
||||||
|
fi
|
Loading…
Add table
Reference in a new issue