Просмотр исходного кода

Multiples modif pour le template

Mickaël 7 лет назад
Родитель
Сommit
93f837a401
7 измененных файлов с 29 добавлено и 13 удалено
  1. 6 3
      README.md
  2. 3 0
      scripts/backup
  3. 11 4
      scripts/install
  4. 2 5
      scripts/remove
  5. 5 0
      scripts/restore
  6. 1 0
      scripts/upgrade
  7. 1 1
      sources/extra_files/app/etc_sudoers.d_zabbix

+ 6 - 3
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/
+ * YunoHost website: https://yunohost.org/

+ 3 - 0
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
 #=================================================

+ 11 - 4
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 \

+ 2 - 5
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

+ 5 - 0
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

+ 1 - 0
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 \

+ 1 - 1
sources/extra_files/app/etc_sudoers.d_zabbix

@@ -1 +1 @@
-zabbix    ALL=(root) NOPASSWD: /etc/zabbix/zabbix_agentd.d/yunohost.sh
+zabbix    ALL=(ALL) NOPASSWD: /etc/zabbix/zabbix_agentd.d/yunohost.sh