diff --git a/README.md b/README.md index 98ba18e..05a9156 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,14 @@ Are LDAP auth supported Only Debian - Stretch 64b supported actually. ## Limitations - +Do not change admin password. ## Additional information -* Other information you would add about this application +* Do not change the default admin user password. The user is disabled juste after the install but used to update templates. +* The Zabbix server port is not opened by default for external monitoring (active agent). +* Install or update apply a template yunohost on the host "Zabbix-server" (127.0.0.1) for basic monitoring for Yunohost. +* If you want more information about Yunohost in the template, please open an issue on git. **More information on the documentation page:** https://yunohost.org/packaging_apps @@ -39,4 +42,4 @@ got to https://framagit.org/Mickael-Martin/zabbix_ynh/blob/master/LICENSE ## Links * Report a bug: https://framagit.org/Mickael-Martin/zabbix_ynh/issues - * YunoHost website: https://yunohost.org/ \ No newline at end of file + * YunoHost website: https://yunohost.org/ diff --git a/scripts/backup b/scripts/backup index 0999145..a5bd1ad 100644 --- a/scripts/backup +++ b/scripts/backup @@ -46,6 +46,9 @@ ynh_backup "/etc/zabbix/zabbix_server.conf" ynh_backup "/etc/zabbix/zabbix_agentd.conf" ynh_backup "/etc/zabbix/zabbix_agentd.d" +#backup sudo file +ynh_backup "/etc/sudoers.d/zabbix" + #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= diff --git a/scripts/install b/scripts/install index 6f16f7c..0b69a65 100644 --- a/scripts/install +++ b/scripts/install @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # Exit if an error occurs during the execution of the script -#ynh_abort_if_errors +ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST @@ -74,6 +74,9 @@ ynh_app_setting_set $app language $language ### If you're not using these lines: ### - Remove the section "CLOSE A PORT" in the remove script +### Zabbix server is not opened by default for external usage. +### if you want use zabbix server with external agent (in active mode), setup the listen address in server configuration and open port on firewall via the cmd yunohost firewall + # Find a free port #port=$(ynh_find_port 8095) # Open this port @@ -153,7 +156,7 @@ name=$(ynh_user_get_info $admin firstname) mysql -u$db_user -p$db_pwd $db_name -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', '"$lang"', '30s', 3, 'default', 0, '', 0, 50);" mysql -u$db_user -p$db_pwd $db_name -e "INSERT INTO \`users_groups\` (\`id\`, \`usrgrpid\`, \`userid\`) VALUES (5, 7, 3);" -#users creation +#users creation in zabbix database i=4 for u in $(ynh_user_list); do @@ -165,8 +168,6 @@ do fi done - - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -194,6 +195,8 @@ ynh_add_nginx_config # Create a system user #ynh_system_user_create $app +# +### zabbix user created in zabbix server dpkg install #================================================= # PHP-FPM CONFIGURATION @@ -237,6 +240,8 @@ ynh_add_fpm_config # Create a dedicated systemd config #ynh_add_systemd_config +### Systemd service created when dpkg install + #================================================= # SETUP APPLICATION WITH CURL #================================================= @@ -392,6 +397,8 @@ cp $confUserPpath /etc/zabbix/zabbix_agentd.d/userP_yunohost.conf cp $bashUserPpath /etc/zabbix/zabbix_agentd.d/yunohost.sh chmod a+x /etc/zabbix/zabbix_agentd.d/yunohost.sh +systemctl restart zabbix-agent + curl -k -s --cookie cookiejar.txt --cookie-jar cookiejar.txt \ --form enter=Sign+in \ --form name=Admin \ diff --git a/scripts/remove b/scripts/remove index bc13f0e..cd95114 100644 --- a/scripts/remove +++ b/scripts/remove @@ -37,11 +37,8 @@ yunohost service remove snmpd #================================================= # Remove a service from the admin panel, added by `yunohost service add` -if yunohost service status | grep -q $app -then - echo "Remove $app service" - yunohost service remove $app -fi +yunohost service remove zabbix-server +yunohost service remove zabbix-agent #================================================= # REMOVE PHP-FPM CONFIGURATION diff --git a/scripts/restore b/scripts/restore index f712ca0..4409c8a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -75,6 +75,9 @@ rm $final_path/conf/zabbix.conf.php ynh_app_setting_set $app final_path $final_path +yunohost service add zabbix-server -d "Management of Zabbix Server - Monitoring server" +yunohost service add zabbix-agent -d "Management of Zabbix Agent" + #================================================= # NGINX CONFIGURATION #================================================= @@ -91,6 +94,8 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf" +# Restore sudo file +ynh_restore_file "/etc/sudoers.d/zabbix" # Reload SSOwat config yunohost app ssowatconf diff --git a/scripts/upgrade b/scripts/upgrade index f69c382..ca00b43 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -78,6 +78,7 @@ cp $confUserPpath /etc/zabbix/zabbix_agentd.d/userP_yunohost.conf cp $bashUserPpath /etc/zabbix/zabbix_agentd.d/yunohost.sh chmod a+x /etc/zabbix/zabbix_agentd.d/yunohost.sh +systemctl restart zabbix-agent curl -k -s --cookie cookiejar.txt --cookie-jar cookiejar.txt \ --form enter=Sign+in \ diff --git a/sources/extra_files/app/etc_sudoers.d_zabbix b/sources/extra_files/app/etc_sudoers.d_zabbix index de296b5..ce70ecb 100644 --- a/sources/extra_files/app/etc_sudoers.d_zabbix +++ b/sources/extra_files/app/etc_sudoers.d_zabbix @@ -1 +1 @@ -zabbix ALL=(root) NOPASSWD: /etc/zabbix/zabbix_agentd.d/yunohost.sh \ No newline at end of file +zabbix ALL=(ALL) NOPASSWD: /etc/zabbix/zabbix_agentd.d/yunohost.sh