mirror of
https://github.com/YunoHost-Apps/zabbix_ynh.git
synced 2024-09-03 20:36:14 +02:00
Merge branch 'testing' into 6.4
This commit is contained in:
commit
a5ff6446a4
25 changed files with 507 additions and 923 deletions
71
.github/workflows/updater.sh
vendored
71
.github/workflows/updater.sh
vendored
|
@ -1,71 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# PACKAGE UPDATING HELPER
|
||||
#=================================================
|
||||
|
||||
# This script is meant to be run by GitHub Actions
|
||||
# The YunoHost-Apps organisation offers a template Action to run this script periodically
|
||||
# Since each app is different, maintainers can adapt its contents so as to perform
|
||||
# automatic actions when a new upstream release is detected.
|
||||
|
||||
#=================================================
|
||||
# FETCHING LATEST RELEASE AND ITS ASSETS
|
||||
#=================================================
|
||||
|
||||
# Fetching information
|
||||
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
|
||||
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
|
||||
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
|
||||
i=1
|
||||
version=$(curl --silent "https://api.github.com/repos/$repo/tags?page=$i" | jq -r '.[] | select( .name | contains("rc") or contains("beta") or contains("alpha") or startswith("6") or startswith("7") | not ) | .name' | sort -V | tail -1)
|
||||
while [ -z $version ] ; do
|
||||
sleep 10
|
||||
i=$(($i + 1))
|
||||
version=$(curl --silent "https://api.github.com/repos/$repo/tags?page=$i" | jq -r '.[] | select( .name | contains("rc") or contains("beta") or contains("alpha") or startswith("6") or startswith("7") | not ) | .name' | sort -V | tail -1)
|
||||
done
|
||||
|
||||
# Later down the script, we assume the version has only digits and dots
|
||||
# Sometimes the release name starts with a "v", so let's filter it out.
|
||||
# You may need more tweaks here if the upstream repository has different naming conventions.
|
||||
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
|
||||
version=${version:1}
|
||||
fi
|
||||
|
||||
# Setting up the environment variables
|
||||
echo "Current version: $current_version"
|
||||
echo "Latest release from upstream: $version"
|
||||
echo "VERSION=$version" >> $GITHUB_ENV
|
||||
echo "REPO=$repo" >> $GITHUB_ENV
|
||||
# For the time being, let's assume the script will fail
|
||||
echo "PROCEED=false" >> $GITHUB_ENV
|
||||
|
||||
# Proceed only if the retrieved version is greater than the current one
|
||||
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
|
||||
echo "::warning ::No new version available"
|
||||
exit 0
|
||||
# Proceed only if a PR for this new version does not already exist
|
||||
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
|
||||
echo "::warning ::A branch already exists for this update"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPDATE STEPS
|
||||
#=================================================
|
||||
|
||||
# Any action on the app's source code can be done.
|
||||
# The GitHub Action workflow takes care of committing all changes after this script ends.
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
||||
# Replace new version in manifest
|
||||
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
|
||||
|
||||
# No need to update the README, yunohost-bot takes care of it
|
||||
|
||||
# The Action will proceed only if the PROCEED environment variable is set to true
|
||||
echo "PROCEED=true" >> $GITHUB_ENV
|
||||
exit 0
|
49
.github/workflows/updater.yml
vendored
49
.github/workflows/updater.yml
vendored
|
@ -1,49 +0,0 @@
|
|||
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
|
||||
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
|
||||
# This file should be enough by itself, but feel free to tune it to your needs.
|
||||
# It calls updater.sh, which is where you should put the app-specific update steps.
|
||||
name: Check for new upstream releases
|
||||
on:
|
||||
# Allow to manually trigger the workflow
|
||||
workflow_dispatch:
|
||||
# Run it every day at 6:00 UTC
|
||||
schedule:
|
||||
- cron: '0 6 * * *'
|
||||
jobs:
|
||||
updater:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Fetch the source code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Run the updater script
|
||||
id: run_updater
|
||||
run: |
|
||||
# Setting up Git user
|
||||
git config --global user.name 'yunohost-bot'
|
||||
git config --global user.email 'yunohost-bot@users.noreply.github.com'
|
||||
# Run the updater script
|
||||
/bin/bash .github/workflows/updater.sh
|
||||
- name: Commit changes
|
||||
id: commit
|
||||
if: ${{ env.PROCEED == 'true' }}
|
||||
run: |
|
||||
git commit -am "Upgrade to v$VERSION"
|
||||
- name: Create Pull Request
|
||||
id: cpr
|
||||
if: ${{ env.PROCEED == 'true' }}
|
||||
uses: peter-evans/create-pull-request@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
commit-message: Update to version ${{ env.VERSION }}
|
||||
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
|
||||
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
|
||||
signoff: false
|
||||
base: testing
|
||||
branch: ci-auto-update-v${{ env.VERSION }}
|
||||
delete-branch: true
|
||||
title: 'Upgrade to version ${{ env.VERSION }}'
|
||||
body: |
|
||||
Upgrade to v${{ env.VERSION }}
|
||||
draft: false
|
7
ALL_README.md
Normal file
7
ALL_README.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
# All available README files by language
|
||||
|
||||
- [Read the README in English](README.md)
|
||||
- [Irakurri README euskaraz](README_eu.md)
|
||||
- [Lire le README en français](README_fr.md)
|
||||
- [Le o README en galego](README_gl.md)
|
||||
- [阅读中文(简体)的 README](README_zh_Hans.md)
|
37
README.md
37
README.md
|
@ -1,5 +1,5 @@
|
|||
<!--
|
||||
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
||||
N.B.: This README was automatically generated by <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
|
||||
It shall NOT be edited by hand.
|
||||
-->
|
||||
|
||||
|
@ -9,47 +9,36 @@ It shall NOT be edited by hand.
|
|||
|
||||
[](https://install-app.yunohost.org/?app=zabbix)
|
||||
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
*[Read this README in other languages.](./ALL_README.md)*
|
||||
|
||||
> *This package allows you to install Zabbix quickly and simply on a YunoHost server.
|
||||
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
|
||||
> *This package allows you to install Zabbix quickly and simply on a YunoHost server.*
|
||||
> *If you don't have YunoHost, please consult [the guide](https://yunohost.org/install) to learn how to install it.*
|
||||
|
||||
## Overview
|
||||
|
||||
A monitoring tool for diverse IT components, including networks, servers, VMs and cloud services.
|
||||
|
||||
**Shipped version:** 5.0.40~ynh1
|
||||
**Shipped version:** 5.0.41~ynh2
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||
|
||||
## Disclaimers / important information
|
||||
|
||||
#### Known limitations or important informations
|
||||
|
||||
* Only x86_64 architecture is supported
|
||||
* Single sign-on is supported
|
||||
* Do not change the default admin user password. The user is disabled just after the install but is used to update templates.
|
||||
* The Zabbix server port is not opened by default for external monitoring (active agent).
|
||||
* You can add your users in a group in Zabbix (for permissions/rights).
|
||||
* A YunoHost template is imported and linked to the host "Zabbix-server" (127.0.0.1) for basic monitoring for YunoHost.
|
||||
|
||||
## Documentation and resources
|
||||
|
||||
* Official app website: <https://www.zabbix.com>
|
||||
* Official admin documentation: <https://www.zabbix.com/manuals>
|
||||
* Upstream app code repository: <https://github.com/zabbix/zabbix>
|
||||
* YunoHost Store: <https://apps.yunohost.org/app/zabbix>
|
||||
* Report a bug: <https://github.com/YunoHost-Apps/zabbix_ynh/issues>
|
||||
- Official app website: <https://www.zabbix.com>
|
||||
- Official admin documentation: <https://www.zabbix.com/manuals>
|
||||
- Upstream app code repository: <https://github.com/zabbix/zabbix>
|
||||
- YunoHost Store: <https://apps.yunohost.org/app/zabbix>
|
||||
- Report a bug: <https://github.com/YunoHost-Apps/zabbix_ynh/issues>
|
||||
|
||||
## Developer info
|
||||
|
||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing).
|
||||
Please send your pull request to the [`testing` branch](https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
To try the `testing` branch, please proceed like that:
|
||||
|
||||
``` bash
|
||||
```bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing --debug
|
||||
or
|
||||
sudo yunohost app upgrade zabbix -u https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing --debug
|
||||
|
|
47
README_de.md
Normal file
47
README_de.md
Normal file
|
@ -0,0 +1,47 @@
|
|||
<!--
|
||||
N.B.: Diese README wurde automatisch von <https://github.com/YunoHost/apps/tree/master/tools/readme_generator> generiert.
|
||||
Sie darf NICHT von Hand bearbeitet werden.
|
||||
-->
|
||||
|
||||
# Zabbix für YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/zabbix)  
|
||||
|
||||
[](https://install-app.yunohost.org/?app=zabbix)
|
||||
|
||||
*[Dieses README in anderen Sprachen lesen.](./ALL_README.md)*
|
||||
|
||||
> *Mit diesem Paket können Sie Zabbix schnell und einfach auf einem YunoHost-Server installieren.
|
||||
Wenn Sie YunoHost nicht haben, lesen Sie bitte [die Anleitung](https://yunohost.org/#/install), um zu erfahren, wie Sie es installieren.*
|
||||
|
||||
## Übersicht
|
||||
|
||||
A monitoring tool for diverse IT components, including networks, servers, VMs and cloud services.
|
||||
**Ausgelieferte Version:** 5.0.41~ynh1
|
||||
|
||||
## Bildschirmfotos
|
||||
|
||||

|
||||
|
||||
## Dokumentation und Ressourcen
|
||||
|
||||
- Offizielle Website der App: <https://www.zabbix.com>
|
||||
- Offizielle Verwaltungsdokumentation: <https://www.zabbix.com/manuals>
|
||||
- Upstream App Repository: <https://github.com/zabbix/zabbix>
|
||||
- YunoHost-Shop: <https://apps.yunohost.org/app/zabbix>
|
||||
- Einen Fehler melden: <https://github.com/YunoHost-Apps/zabbix_ynh/issues>
|
||||
|
||||
## Entwicklerinformationen
|
||||
|
||||
Bitte senden Sie Ihren Pull-Request an den [testing branch](https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing),
|
||||
|
||||
|
||||
Um den Testing-Branch auszuprobieren, gehen Sie bitte wie folgt vor.
|
||||
|
||||
```bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing --debug
|
||||
oder
|
||||
sudo yunohost app upgrade zabbix -u https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Weitere Informationen zur App-Paketierung:** <https://yunohost.org/packaging_apps>
|
47
README_eu.md
Normal file
47
README_eu.md
Normal file
|
@ -0,0 +1,47 @@
|
|||
<!--
|
||||
Ohart ongi: README hau automatikoki sortu da <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>ri esker
|
||||
EZ editatu eskuz.
|
||||
-->
|
||||
|
||||
# Zabbix YunoHost-erako
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/zabbix)  
|
||||
|
||||
[](https://install-app.yunohost.org/?app=zabbix)
|
||||
|
||||
*[Irakurri README hau beste hizkuntzatan.](./ALL_README.md)*
|
||||
|
||||
> *Pakete honek Zabbix YunoHost zerbitzari batean azkar eta zailtasunik gabe instalatzea ahalbidetzen dizu.*
|
||||
> *YunoHost ez baduzu, kontsultatu [gida](https://yunohost.org/install) nola instalatu ikasteko.*
|
||||
|
||||
## Aurreikuspena
|
||||
|
||||
A monitoring tool for diverse IT components, including networks, servers, VMs and cloud services.
|
||||
|
||||
**Paketatutako bertsioa:** 5.0.41~ynh2
|
||||
|
||||
## Pantaila-argazkiak
|
||||
|
||||

|
||||
|
||||
## Dokumentazioa eta baliabideak
|
||||
|
||||
- Aplikazioaren webgune ofiziala: <https://www.zabbix.com>
|
||||
- Administratzaileen dokumentazio ofiziala: <https://www.zabbix.com/manuals>
|
||||
- Jatorrizko aplikazioaren kode-gordailua: <https://github.com/zabbix/zabbix>
|
||||
- YunoHost Denda: <https://apps.yunohost.org/app/zabbix>
|
||||
- Eman errore baten berri: <https://github.com/YunoHost-Apps/zabbix_ynh/issues>
|
||||
|
||||
## Garatzaileentzako informazioa
|
||||
|
||||
Bidali `pull request`a [`testing` abarrera](https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing).
|
||||
|
||||
`testing` abarra probatzeko, ondorengoa egin:
|
||||
|
||||
```bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing --debug
|
||||
edo
|
||||
sudo yunohost app upgrade zabbix -u https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Informazio gehiago aplikazioaren paketatzeari buruz:** <https://yunohost.org/packaging_apps>
|
40
README_fr.md
40
README_fr.md
|
@ -1,6 +1,6 @@
|
|||
<!--
|
||||
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
||||
It shall NOT be edited by hand.
|
||||
Nota bene : ce README est automatiquement généré par <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
|
||||
Il NE doit PAS être modifié à la main.
|
||||
-->
|
||||
|
||||
# Zabbix pour YunoHost
|
||||
|
@ -9,50 +9,40 @@ It shall NOT be edited by hand.
|
|||
|
||||
[](https://install-app.yunohost.org/?app=zabbix)
|
||||
|
||||
*[Read this readme in english.](./README.md)*
|
||||
*[Lire le README dans d'autres langues.](./ALL_README.md)*
|
||||
|
||||
> *Ce package vous permet d’installer Zabbix rapidement et simplement sur un serveur YunoHost.
|
||||
Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l’installer et en profiter.*
|
||||
> *Ce package vous permet d’installer Zabbix rapidement et simplement sur un serveur YunoHost.*
|
||||
> *Si vous n’avez pas YunoHost, consultez [ce guide](https://yunohost.org/install) pour savoir comment l’installer et en profiter.*
|
||||
|
||||
## Vue d’ensemble
|
||||
|
||||
Un outil de surveillance pour divers composants informatiques, notamment les réseaux, les serveurs, les machines virtuelles et les services en nuage.
|
||||
|
||||
|
||||
**Version incluse :** 5.0.40~ynh1
|
||||
**Version incluse :** 5.0.41~ynh2
|
||||
|
||||
## Captures d’écran
|
||||
|
||||

|
||||
|
||||
## Avertissements / informations importantes
|
||||
|
||||
#### Limitations connues et autres informations importantes
|
||||
|
||||
* Seule l'architecture x86_64 est prise en charge
|
||||
* L'authentification unique (SSO) fonctionne.
|
||||
* Ne modifiez pas le mot de passe de l'utilisateur administrateur par défaut. L'utilisateur est désactivé juste après l'installation mais il est utilisé pour mettre à jour les modèles.
|
||||
* Le port du serveur Zabbix n'est pas ouvert par défaut pour la surveillance externe (agent actif).
|
||||
* Vous pouvez ajouter vos utilisateurs dans un groupe dans Zabbix (pour les autorisations/droits).
|
||||
* Un modèle YunoHost est importé et lié à l'hôte "Zabbix-server" (127.0.0.1) pour la surveillance de base de YunoHost.
|
||||
## Documentations et ressources
|
||||
|
||||
* Site officiel de l’app : <https://www.zabbix.com>
|
||||
* Documentation officielle de l’admin : <https://www.zabbix.com/manuals>
|
||||
* Dépôt de code officiel de l’app : <https://github.com/zabbix/zabbix>
|
||||
* YunoHost Store: <https://apps.yunohost.org/app/zabbix>
|
||||
* Signaler un bug : <https://github.com/YunoHost-Apps/zabbix_ynh/issues>
|
||||
- Site officiel de l’app : <https://www.zabbix.com>
|
||||
- Documentation officielle de l’admin : <https://www.zabbix.com/manuals>
|
||||
- Dépôt de code officiel de l’app : <https://github.com/zabbix/zabbix>
|
||||
- YunoHost Store : <https://apps.yunohost.org/app/zabbix>
|
||||
- Signaler un bug : <https://github.com/YunoHost-Apps/zabbix_ynh/issues>
|
||||
|
||||
## Informations pour les développeurs
|
||||
|
||||
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing).
|
||||
Merci de faire vos pull request sur la [branche `testing`](https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing).
|
||||
|
||||
Pour essayer la branche testing, procédez comme suit.
|
||||
Pour essayer la branche `testing`, procédez comme suit :
|
||||
|
||||
``` bash
|
||||
```bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing --debug
|
||||
ou
|
||||
sudo yunohost app upgrade zabbix -u https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Plus d’infos sur le packaging d’applications :** <https://yunohost.org/packaging_apps>
|
||||
**Plus d’infos sur le packaging d’applications :** <https://yunohost.org/packaging_apps>
|
||||
|
|
47
README_gl.md
Normal file
47
README_gl.md
Normal file
|
@ -0,0 +1,47 @@
|
|||
<!--
|
||||
NOTA: Este README foi creado automáticamente por <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
|
||||
NON debe editarse manualmente.
|
||||
-->
|
||||
|
||||
# Zabbix para YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/zabbix)  
|
||||
|
||||
[](https://install-app.yunohost.org/?app=zabbix)
|
||||
|
||||
*[Le este README en outros idiomas.](./ALL_README.md)*
|
||||
|
||||
> *Este paquete permíteche instalar Zabbix de xeito rápido e doado nun servidor YunoHost.*
|
||||
> *Se non usas YunoHost, le a [documentación](https://yunohost.org/install) para saber como instalalo.*
|
||||
|
||||
## Vista xeral
|
||||
|
||||
A monitoring tool for diverse IT components, including networks, servers, VMs and cloud services.
|
||||
|
||||
**Versión proporcionada:** 5.0.41~ynh2
|
||||
|
||||
## Capturas de pantalla
|
||||
|
||||

|
||||
|
||||
## Documentación e recursos
|
||||
|
||||
- Web oficial da app: <https://www.zabbix.com>
|
||||
- Documentación oficial para admin: <https://www.zabbix.com/manuals>
|
||||
- Repositorio de orixe do código: <https://github.com/zabbix/zabbix>
|
||||
- Tenda YunoHost: <https://apps.yunohost.org/app/zabbix>
|
||||
- Informar dun problema: <https://github.com/YunoHost-Apps/zabbix_ynh/issues>
|
||||
|
||||
## Info de desenvolvemento
|
||||
|
||||
Envía a túa colaboración á [rama `testing`](https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing).
|
||||
|
||||
Para probar a rama `testing`, procede deste xeito:
|
||||
|
||||
```bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing --debug
|
||||
ou
|
||||
sudo yunohost app upgrade zabbix -u https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Máis info sobre o empaquetado da app:** <https://yunohost.org/packaging_apps>
|
47
README_it.md
Normal file
47
README_it.md
Normal file
|
@ -0,0 +1,47 @@
|
|||
<!--
|
||||
N.B.: Questo README è stato automaticamente generato da <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
|
||||
NON DEVE essere modificato manualmente.
|
||||
-->
|
||||
|
||||
# Zabbix per YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/zabbix)  
|
||||
|
||||
[](https://install-app.yunohost.org/?app=zabbix)
|
||||
|
||||
*[Leggi questo README in altre lingue.](./ALL_README.md)*
|
||||
|
||||
> *Questo pacchetto ti permette di installare Zabbix su un server YunoHost in modo semplice e veloce.*
|
||||
> *Se non hai YunoHost, consulta [la guida](https://yunohost.org/install) per imparare a installarlo.*
|
||||
|
||||
## Panoramica
|
||||
|
||||
A monitoring tool for diverse IT components, including networks, servers, VMs and cloud services.
|
||||
|
||||
**Versione pubblicata:** 5.0.41~ynh1
|
||||
|
||||
## Screenshot
|
||||
|
||||

|
||||
|
||||
## Documentazione e risorse
|
||||
|
||||
- Sito web ufficiale dell’app: <https://www.zabbix.com>
|
||||
- Documentazione ufficiale per gli amministratori: <https://www.zabbix.com/manuals>
|
||||
- Repository upstream del codice dell’app: <https://github.com/zabbix/zabbix>
|
||||
- Store di YunoHost: <https://apps.yunohost.org/app/zabbix>
|
||||
- Segnala un problema: <https://github.com/YunoHost-Apps/zabbix_ynh/issues>
|
||||
|
||||
## Informazioni per sviluppatori
|
||||
|
||||
Si prega di inviare la tua pull request alla [branch di `testing`](https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing).
|
||||
|
||||
Per provare la branch di `testing`, si prega di procedere in questo modo:
|
||||
|
||||
```bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing --debug
|
||||
o
|
||||
sudo yunohost app upgrade zabbix -u https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Maggiori informazioni riguardo il pacchetto di quest’app:** <https://yunohost.org/packaging_apps>
|
47
README_zh_Hans.md
Normal file
47
README_zh_Hans.md
Normal file
|
@ -0,0 +1,47 @@
|
|||
<!--
|
||||
注意:此 README 由 <https://github.com/YunoHost/apps/tree/master/tools/readme_generator> 自动生成
|
||||
请勿手动编辑。
|
||||
-->
|
||||
|
||||
# YunoHost 的 Zabbix
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/zabbix)  
|
||||
|
||||
[](https://install-app.yunohost.org/?app=zabbix)
|
||||
|
||||
*[阅读此 README 的其它语言版本。](./ALL_README.md)*
|
||||
|
||||
> *通过此软件包,您可以在 YunoHost 服务器上快速、简单地安装 Zabbix。*
|
||||
> *如果您还没有 YunoHost,请参阅[指南](https://yunohost.org/install)了解如何安装它。*
|
||||
|
||||
## 概况
|
||||
|
||||
A monitoring tool for diverse IT components, including networks, servers, VMs and cloud services.
|
||||
|
||||
**分发版本:** 5.0.41~ynh2
|
||||
|
||||
## 截图
|
||||
|
||||

|
||||
|
||||
## 文档与资源
|
||||
|
||||
- 官方应用网站: <https://www.zabbix.com>
|
||||
- 官方管理文档: <https://www.zabbix.com/manuals>
|
||||
- 上游应用代码库: <https://github.com/zabbix/zabbix>
|
||||
- YunoHost 商店: <https://apps.yunohost.org/app/zabbix>
|
||||
- 报告 bug: <https://github.com/YunoHost-Apps/zabbix_ynh/issues>
|
||||
|
||||
## 开发者信息
|
||||
|
||||
请向 [`testing` 分支](https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing) 发送拉取请求。
|
||||
|
||||
如要尝试 `testing` 分支,请这样操作:
|
||||
|
||||
```bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing --debug
|
||||
或
|
||||
sudo yunohost app upgrade zabbix -u https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**有关应用打包的更多信息:** <https://yunohost.org/packaging_apps>
|
|
@ -1,29 +0,0 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
path="/path"
|
||||
is_public=1
|
||||
language="fr_FR"
|
||||
admin="john"
|
||||
password="1Strong-Password"
|
||||
port="10051"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
# 5.0.20~ynh2
|
||||
upgrade=1 from_commit=8f8961c239f890069c867e40005db98465add0c9
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
change_url=1
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=PORT&
|
||||
; commit=8f8961c239f890069c867e40005db98465add0c9
|
||||
name=5.0.20~ynh2
|
|
@ -2,7 +2,7 @@
|
|||
location __PATH__/ {
|
||||
|
||||
# Path to source
|
||||
alias __FINALPATH__/;
|
||||
alias /usr/share/zabbix/;
|
||||
|
||||
index index_http.php;
|
||||
|
||||
|
|
|
@ -358,7 +358,7 @@ request_terminate_timeout = 1d
|
|||
; Chdir to this directory at the start.
|
||||
; Note: relative path can be used.
|
||||
; Default Value: current directory or / when chroot
|
||||
chdir = __FINALPATH__
|
||||
chdir = /usr/share/zabbix
|
||||
|
||||
; Redirect worker stdout and stderr into main error log. If not set, stdout and
|
||||
; stderr will be redirected to /dev/null according to FastCGI specs.
|
||||
|
@ -428,5 +428,5 @@ php_admin_value[max_execution_time] = 300
|
|||
php_admin_value[max_input_time] = 300
|
||||
; php_admin_value[memory_limit] = 256M
|
||||
; php_admin_flag[short_open_tag] = On
|
||||
php_admin_value[open_basedir] = /var/www/zabbix/:/usr/share/fonts/:/tmp:/etc/zabbix/web
|
||||
php_admin_value[open_basedir] = /usr/share/zabbix/:/usr/share/fonts/:/tmp:/etc/zabbix/web
|
||||
php_admin_value[date.timezone] = Europe/Paris
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#### Known limitations or important informations
|
||||
|
||||
* Only x86_64 architecture is supported
|
||||
* Single sign-on is supported
|
||||
* Do not change the default admin user password. The user is disabled just after the install but is used to update templates.
|
||||
* The Zabbix server port is not opened by default for external monitoring (active agent).
|
||||
* You can add your users in a group in Zabbix (for permissions/rights).
|
|
@ -1,8 +1,6 @@
|
|||
#### Limitations connues et autres informations importantes
|
||||
|
||||
* Seule l'architecture x86_64 est prise en charge
|
||||
* L'authentification unique (SSO) fonctionne.
|
||||
* Ne modifiez pas le mot de passe de l'utilisateur administrateur par défaut. L'utilisateur est désactivé juste après l'installation mais il est utilisé pour mettre à jour les modèles.
|
||||
* Le port du serveur Zabbix n'est pas ouvert par défaut pour la surveillance externe (agent actif).
|
||||
* Vous pouvez ajouter vos utilisateurs dans un groupe dans Zabbix (pour les autorisations/droits).
|
||||
* Un modèle YunoHost est importé et lié à l'hôte "Zabbix-server" (127.0.0.1) pour la surveillance de base de YunoHost.
|
||||
* Un modèle YunoHost est importé et lié à l'hôte "Zabbix-server" (127.0.0.1) pour la surveillance de base de YunoHost.
|
|
@ -1,84 +0,0 @@
|
|||
{
|
||||
"name": "Zabbix",
|
||||
"id": "zabbix",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "Monitoring tool for diverse IT components, including networks, servers, VMs and cloud services",
|
||||
"fr": "Outil pour monitorer des réseaux, des serveurs, des VMs et autres services en ligne"
|
||||
},
|
||||
"version": "5.0.40~ynh1",
|
||||
"url": "https://www.zabbix.com",
|
||||
"upstream": {
|
||||
"license": "GPL-2.0-or-later",
|
||||
"website": "https://www.zabbix.com",
|
||||
"admindoc": "https://www.zabbix.com/manuals",
|
||||
"code": "https://github.com/zabbix/zabbix"
|
||||
},
|
||||
"license": "GPL-2.0-or-later",
|
||||
"maintainer": {
|
||||
"name": "",
|
||||
"email": ""
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 11.2"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
"nginx",
|
||||
"php7.4-fpm",
|
||||
"mysql"
|
||||
],
|
||||
"arguments": {
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"example": "/zabbix",
|
||||
"default": "/zabbix"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"help": {
|
||||
"en": "A public app doesn't need SSO auth : the auth page is opened for everyone",
|
||||
"fr": "Une application publique ne nécessite pas une authentification SSO : sa page d'authentication est ouverte à tous"
|
||||
},
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "language",
|
||||
"type": "select",
|
||||
"ask": {
|
||||
"en": "Choose the application language",
|
||||
"fr": "Choisissez la langue de l'application"
|
||||
},
|
||||
"choices": [
|
||||
"en_GB",
|
||||
"en_US",
|
||||
"cz_CN",
|
||||
"cs_CZ",
|
||||
"fr_FR",
|
||||
"ko_KR",
|
||||
"ja_JP",
|
||||
"nb_NO",
|
||||
"pl_PL",
|
||||
"pt_BR",
|
||||
"pt_PT",
|
||||
"ru_RU",
|
||||
"sk_SK",
|
||||
"tr_TR",
|
||||
"uk_UA"
|
||||
],
|
||||
"default": "en_US"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
103
manifest.toml
Normal file
103
manifest.toml
Normal file
|
@ -0,0 +1,103 @@
|
|||
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
|
||||
|
||||
packaging_format = 2
|
||||
|
||||
id = "zabbix"
|
||||
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~ynh2"
|
||||
|
||||
maintainers = []
|
||||
|
||||
[upstream]
|
||||
license = "GPL-2.0-or-later"
|
||||
website = "https://www.zabbix.com"
|
||||
admindoc = "https://www.zabbix.com/manuals"
|
||||
code = "https://github.com/zabbix/zabbix"
|
||||
cpe = "cpe:2.3:a:zabbix:zabbix"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.2"
|
||||
architectures = ["amd64"]
|
||||
multi_instance = false
|
||||
ldap = true
|
||||
sso = true
|
||||
disk = "500M"
|
||||
ram.build = "200M"
|
||||
ram.runtime = "200M"
|
||||
|
||||
[install]
|
||||
[install.domain]
|
||||
type = "domain"
|
||||
|
||||
[install.path]
|
||||
type = "path"
|
||||
default = "/zabbix"
|
||||
|
||||
[install.init_main_permission]
|
||||
help.en = "A public app doesn't need SSO auth : the auth page is opened for everyone"
|
||||
help.fr = "Une application publique ne nécessite pas une authentification SSO : sa page d'authentication est ouverte à tous"
|
||||
type = "group"
|
||||
default = "visitors"
|
||||
|
||||
[install.language]
|
||||
ask.en = "Choose the application language"
|
||||
ask.fr = "Choisissez la langue de l'application"
|
||||
type = "select"
|
||||
choices = ["en_GB", "en_US", "cz_CN", "cs_CZ", "fr_FR", "ko_KR", "ja_JP", "nb_NO", "pl_PL", "pt_BR", "pt_PT", "ru_RU", "sk_SK", "tr_TR", "uk_UA"]
|
||||
default = "en_US"
|
||||
|
||||
[install.admin]
|
||||
type = "user"
|
||||
|
||||
[resources]
|
||||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
||||
|
||||
[resources.apt]
|
||||
packages = [
|
||||
"libapr1",
|
||||
"libaprutil1",
|
||||
"libaprutil1-dbd-sqlite3",
|
||||
"libaprutil1-ldap",
|
||||
"liblua5.2-0",
|
||||
"fonts-dejavu-core",
|
||||
"patch",
|
||||
"smistrip",
|
||||
"unzip",
|
||||
"wget",
|
||||
"fping",
|
||||
"libcap2-bin",
|
||||
"libiksemel3",
|
||||
"libopenipmi0",
|
||||
"libpam-cap",
|
||||
"libsnmp-base",
|
||||
"libsnmp40",
|
||||
"snmptrapd",
|
||||
"snmpd",
|
||||
"libjs-prototype",
|
||||
"jq",
|
||||
"libssh-4",
|
||||
"php7.4-fpm",
|
||||
"php7.4-bcmath",
|
||||
|
||||
"mariadb-server",
|
||||
]
|
||||
|
||||
[resources.apt.extras.zabbix]
|
||||
repo = "http://repo.zabbix.com/zabbix/5.0/debian bullseye main"
|
||||
key = "https://repo.zabbix.com/zabbix-official-repo.key"
|
||||
packages = [
|
||||
"zabbix-agent",
|
||||
"zabbix-frontend-php",
|
||||
"zabbix-server-mysql",
|
||||
]
|
||||
|
||||
[resources.database]
|
||||
type = "mysql"
|
|
@ -1,38 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
YNH_PHP_VERSION="7.4"
|
||||
|
||||
# dependencies used by the app
|
||||
if [ "$(lsb_release --codename --short)" = "bullseye" ]; then
|
||||
libsnmpd_version="libsnmp40"
|
||||
else
|
||||
libsnmpd_version="libsnmp30"
|
||||
fi
|
||||
|
||||
pkg_dependencies="libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 fonts-dejavu-core patch smistrip unzip wget fping libcap2-bin libiksemel3 libopenipmi0 libpam-cap libsnmp-base $libsnmpd_version snmptrapd snmpd libjs-prototype jq libssh-4 php${YNH_PHP_VERSION}-fpm php${YNH_PHP_VERSION}-bcmath"
|
||||
|
||||
zabbix_pkg_dependencies="zabbix-agent zabbix-frontend-php zabbix-server-mysql zabbix-sql-scripts"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# ZABBIX HELPERS
|
||||
#=================================================
|
||||
|
||||
# Get guest user state
|
||||
#
|
||||
# return 0 if enable, else 1
|
||||
|
@ -67,7 +34,7 @@ get_state_admin_user () {
|
|||
# Disable admin user
|
||||
#
|
||||
disable_admin_user () {
|
||||
if [ $(get_state_admin_user) = "0" ]
|
||||
if [ $(get_state_admin_user) = "0" ]
|
||||
then
|
||||
ynh_print_info --message="Disable admin user"
|
||||
lastid=$($mysqlconn -BN -e "SELECT max(id) from \`users_groups\`")
|
||||
|
@ -97,7 +64,7 @@ enable_admin_user () {
|
|||
#
|
||||
import_template () {
|
||||
ynh_print_info --message="Import YunoHost template in the agent"
|
||||
zabbixFullpath=https://$domain$path_url
|
||||
zabbixFullpath=https://$domain$path
|
||||
localpath="../conf/Template_Yunohost.xml"
|
||||
sudoUserPpath="../conf/etc_sudoers.d_zabbix"
|
||||
confUserPpath="../conf/etc_zabbix_zabbix_agentd.d_userP_yunohost.conf"
|
||||
|
@ -121,6 +88,13 @@ import_template () {
|
|||
chmod a+x /etc/zabbix/zabbix_agentd.d/yunohost.sh
|
||||
|
||||
systemctl restart zabbix-agent
|
||||
|
||||
# Temporarily enable visitors if needed...
|
||||
local visitors_enabled=$(ynh_permission_has_user "main" "visitors" && echo yes || echo no)
|
||||
if [[ $visitors_enabled == "no" ]]; then
|
||||
ynh_permission_update --permission "main" --add "visitors"
|
||||
fi
|
||||
|
||||
curlOptions="--noproxy $domain -k -s --cookie cookiejar.txt --cookie-jar cookiejar.txt --resolve $domain:443:127.0.0.1"
|
||||
|
||||
curl -L $curlOptions \
|
||||
|
@ -133,7 +107,7 @@ import_template () {
|
|||
then
|
||||
sid=$(curl $curlOptions \
|
||||
"$zabbixFullpath/conf.import.php?rules_preset=template" \
|
||||
| grep -Po 'name="sid" value="\K([a-z0-9]{16})(?=")' )
|
||||
| grep -Po 'name="sid" value="\K([a-z0-9]{16})(?=")' )
|
||||
|
||||
importState=$(curl $curlOptions \
|
||||
--form "config=1" \
|
||||
|
@ -172,12 +146,23 @@ import_template () {
|
|||
else
|
||||
ynh_print_warn --message="Admin user cannot connect to the interface !"
|
||||
fi
|
||||
|
||||
if [[ $visitors_enabled == "no" ]]; then
|
||||
ynh_permission_update --permission "main" --remove "visitors"
|
||||
fi
|
||||
}
|
||||
|
||||
# Link YunoHost template to Zabbix server
|
||||
#
|
||||
link_template () {
|
||||
ynh_print_info --message="Link YunoHost template to Zabbix server"
|
||||
|
||||
# Temporarily enable visitors if needed...
|
||||
local visitors_enabled=$(ynh_permission_has_user "main" "visitors" && echo yes || echo no)
|
||||
if [[ $visitors_enabled == "no" ]]; then
|
||||
ynh_permission_update --permission "main" --add "visitors"
|
||||
fi
|
||||
|
||||
#apply template to host
|
||||
tokenapi=$(curl --noproxy $domain -k -s --resolve $domain:443:127.0.0.1 --header "Content-Type: application/json" --request POST --data '{ "jsonrpc": "2.0","method": "user.login","params": {"user": "Admin","password": "zabbix"},"id": 1,"auth": null}' "${zabbixFullpath}/api_jsonrpc.php" | jq -r '.result')
|
||||
zabbixHostID=$(curl --noproxy $domain -k -s --resolve $domain:443:127.0.0.1 --header "Content-Type: application/json" --request POST --data '{"jsonrpc":"2.0","method":"host.get","params":{"filter":{"host":["Zabbix server"]}},"auth":"'"$tokenapi"'","id":1}' "${zabbixFullpath}/api_jsonrpc.php" | jq -r '.result[0].hostid')
|
||||
|
@ -189,6 +174,10 @@ link_template () {
|
|||
else
|
||||
ynh_print_warn --message="YunoHost template not linked to Zabbix server !"
|
||||
fi
|
||||
|
||||
if [[ $visitors_enabled == "no" ]]; then
|
||||
ynh_permission_update --permission "main" --remove "visitors"
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if Zabbix server is started
|
||||
|
@ -217,14 +206,6 @@ check_proc_zabbixagent () {
|
|||
fi
|
||||
}
|
||||
|
||||
# Remove previous Zabbix installation
|
||||
#
|
||||
remove_previous_zabbix () {
|
||||
ynh_print_info --message="Previous Zabbix installation will be purged !"
|
||||
apt-get purge zabbix* -y
|
||||
ynh_secure_remove --file="/var/cache/apt/archives/zabbix-server-mysql*"
|
||||
ynh_print_info --message="Previous Zabbix installation purged !"
|
||||
}
|
||||
|
||||
# Update Zabbix configuration initialisation
|
||||
#
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -10,43 +8,17 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
# BACKUP THE SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -9,110 +7,12 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
old_domain=$YNH_APP_OLD_DOMAIN
|
||||
old_path=$YNH_APP_OLD_PATH
|
||||
|
||||
new_domain=$YNH_APP_NEW_DOMAIN
|
||||
new_path=$YNH_APP_NEW_PATH
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
# Add settings here as needed by your application
|
||||
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#db_user=$db_name
|
||||
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||
#=================================================
|
||||
|
||||
change_domain=0
|
||||
if [ "$old_domain" != "$new_domain" ]
|
||||
then
|
||||
change_domain=1
|
||||
fi
|
||||
|
||||
change_path=0
|
||||
if [ "$old_path" != "$new_path" ]
|
||||
then
|
||||
change_path=1
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..."
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
# Change the path in the NGINX config file
|
||||
if [ $change_path -eq 1 ]
|
||||
then
|
||||
# Make a backup of the original NGINX config file if modified
|
||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||
# Set global variables for NGINX helper
|
||||
domain="$old_domain"
|
||||
path_url="$new_path"
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
fi
|
||||
|
||||
# Change the domain for NGINX
|
||||
if [ $change_domain -eq 1 ]
|
||||
then
|
||||
# Delete file checksum for the old conf file location
|
||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||
# Store file checksum for the new config file location
|
||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC MODIFICATIONS
|
||||
#=================================================
|
||||
# ...
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_change_url_nginx_config
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
164
scripts/install
164
scripts/install
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -9,105 +7,14 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
language=$YNH_APP_ARG_LANGUAGE
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters..."
|
||||
|
||||
remove_previous_zabbix
|
||||
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..."
|
||||
|
||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..."
|
||||
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="http://repo.zabbix.com/zabbix/6.4/debian $(lsb_release -sc) main" --package="$zabbix_pkg_dependencies" --key="https://repo.zabbix.com/zabbix-official-repo.key"
|
||||
|
||||
ynh_replace_string --match_string="# $language.UTF-8 UTF-8" --replace_string="$language.UTF-8 UTF-8" --target_file=/etc/locale.gen
|
||||
locale-gen
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a MySQL database..."
|
||||
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..."
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
ln -s "/usr/share/zabbix" "$final_path"
|
||||
|
||||
chmod 750 "/usr/share/zabbix"
|
||||
chmod -R o-rwx "/usr/share/zabbix"
|
||||
chown -R $app:www-data "/usr/share/zabbix"
|
||||
chown -R "$app:www-data" "/usr/share/zabbix"
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring PHP-FPM..."
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# IMPORT DEFAULT DATA
|
||||
#=================================================
|
||||
|
@ -132,8 +39,8 @@ $mysqlconn -e "INSERT INTO \`users_groups\` (\`id\`, \`usrgrpid\`, \`userid\`) V
|
|||
|
||||
#users creation in zabbix database
|
||||
i=4
|
||||
for user in $(ynh_user_list);
|
||||
do
|
||||
for user in $(ynh_user_list);
|
||||
do
|
||||
if [ "$user" != "$admin" ]
|
||||
then
|
||||
surname=$(ynh_user_get_info --username="$user" --key=lastname)
|
||||
|
@ -155,33 +62,40 @@ ynh_script_progression --message="Adding a configuration file..."
|
|||
ynh_add_config --template="../conf/etc_zabbix_web_zabbix.conf.php" --destination="/etc/zabbix/web/zabbix.conf.php"
|
||||
|
||||
chmod 400 "/etc/zabbix/web/zabbix.conf.php"
|
||||
chown $app:www-data "/etc/zabbix/web/zabbix.conf.php"
|
||||
chown "$app:www-data" "/etc/zabbix/web/zabbix.conf.php"
|
||||
|
||||
ynh_replace_string --match_string="DBName=zabbix" --replace_string="DBName=$db_name" --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
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
# SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..."
|
||||
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
||||
|
||||
ynh_replace_string --match_string="# $language.UTF-8 UTF-8" --replace_string="$language.UTF-8 UTF-8" --target_file=/etc/locale.gen
|
||||
locale-gen
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
change_timeoutAgent
|
||||
|
||||
systemctl enable zabbix-agent --quiet
|
||||
systemctl enable zabbix-server --quiet
|
||||
yunohost service add snmpd --description="Management of SNMP Daemon"
|
||||
yunohost service add zabbix-server --description="Management Zabbix server daemon : collect, agregate, compute and notify" --log="/var/log/$app/${app}_server.log"
|
||||
yunohost service add zabbix-agent --description="Management Zabbix agent daemon : send informations about this host to the server" --log="/var/log/$app/${app}_agent.log"
|
||||
|
||||
update_initZabbixConf
|
||||
|
||||
#=================================================
|
||||
# SETUP APPLICATION WITH CURL
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setuping application with CURL..."
|
||||
|
||||
# Set the app as temporarily public for curl call
|
||||
ynh_script_progression --message="Configuring SSOwat..."
|
||||
# Making the app public for curl
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
ynh_script_progression --message="Setting up application with CURL..."
|
||||
|
||||
import_template
|
||||
|
||||
|
@ -189,48 +103,14 @@ link_template
|
|||
|
||||
disable_admin_user
|
||||
|
||||
# Remove the public access
|
||||
ynh_permission_update --permission="main" --remove="visitors"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add snmpd --description="Management of SNMP Daemon"
|
||||
yunohost service add zabbix-server --description="Management Zabbix server daemon : collect, agregate, compute and notify" --log="/var/log/$app/${app}_server.log"
|
||||
yunohost service add zabbix-agent --description="Management Zabbix agent daemon : send informations about this host to the server" --log="/var/log/$app/${app}_agent.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
ynh_script_progression --message="Starting $app's systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app-server --action="restart" --log_path="/var/log/$app/${app}_server.log"
|
||||
ynh_systemd_action --service_name=$app-agent --action="restart" --log_path="/var/log/$app/${app}_agent.log"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..."
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
# Everyone can access the app.
|
||||
# The "main" permission is automatically created before the install script.
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemd_action --service_name="$app-server" --action="restart" --log_path="/var/log/$app/${app}_server.log"
|
||||
ynh_systemd_action --service_name="$app-agent" --action="restart" --log_path="/var/log/$app/${app}_agent.log"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
107
scripts/remove
107
scripts/remove
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -10,94 +8,38 @@ source _common.sh
|
|||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
# REMOVE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removing snmpd service integration..."
|
||||
yunohost service remove snmpd
|
||||
|
||||
ynh_script_progression --message="Removing Zabbix-server service integration..."
|
||||
yunohost service remove zabbix-server
|
||||
|
||||
ynh_script_progression --message="Removing Zabbix-agent service integration..."
|
||||
yunohost service remove zabbix-agent
|
||||
|
||||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping and removing the systemd service..."
|
||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_systemd_action --service_name=$app-server --action="stop" --log_path="/var/log/$app/${app}_server.log"
|
||||
ynh_systemd_action --service_name=$app-agent --action="stop" --log_path="/var/log/$app/${app}_agent.log"
|
||||
|
||||
ynh_systemd_action --service_name="$app-server" --action="stop" --log_path="/var/log/$app/${app}_server.log"
|
||||
ynh_systemd_action --service_name="$app-agent" --action="stop" --log_path="/var/log/$app/${app}_agent.log"
|
||||
systemctl disable zabbix-server --quiet
|
||||
systemctl disable zabbix-agent --quiet
|
||||
|
||||
ynh_exec_warn_less killall zabbix_server
|
||||
ynh_exec_warn_less killall zabbix_agentd
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the MySQL database..."
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..."
|
||||
yunohost service remove snmpd
|
||||
yunohost service remove zabbix-server
|
||||
yunohost service remove zabbix-agent
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing PHP-FPM configuration..."
|
||||
|
||||
# Remove the dedicated PHP-FPM config
|
||||
ynh_remove_fpm_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..."
|
||||
ynh_script_progression --message="Removing $app's configuration..."
|
||||
|
||||
#Remove config file detection
|
||||
# Remove config file detection
|
||||
delete_initZabbixConf
|
||||
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
ynh_remove_extra_repo --name=$app
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing app main directory..."
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
ynh_secure_remove --file="/usr/share/$app"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
# REMOVE VARIOUS FILES
|
||||
#=================================================
|
||||
|
@ -113,30 +55,19 @@ ynh_secure_remove --file="/run/$app"
|
|||
|
||||
ynh_secure_remove --file="/etc/sudoers.d/$app"
|
||||
|
||||
#REMOVE NONFREE PART PATCH IF NEEDED (snmp-mibs-downloader (non-free) installed in version 1)
|
||||
# FIXME: useless?
|
||||
# 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 --message="Removing snmp-mibs-downloader (non-free package)"
|
||||
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 --file="/etc/apt/sources.list.d/non-free.list"
|
||||
fi
|
||||
if [ "$(echo $nonfreepackagelist | wc -l)" -eq 1 ] && [ "$(echo $nonfreepackagelist | grep -c "snmp-mibs-downloader")" -eq 1 ]; then
|
||||
ynh_print_info --message="Removing snmp-mibs-downloader (non-free package)"
|
||||
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 --file="/etc/apt/sources.list.d/non-free.list"
|
||||
fi
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..."
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
125
scripts/restore
125
scripts/restore
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -10,90 +8,20 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..."
|
||||
|
||||
remove_previous_zabbix
|
||||
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..."
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="http://repo.zabbix.com/zabbix/5.0/debian $(lsb_release -sc) main" --package="$zabbix_pkg_dependencies" --key="https://repo.zabbix.com/zabbix-official-repo.key"
|
||||
|
||||
ynh_replace_string --match_string="# $language.UTF-8 UTF-8" --replace_string="$language.UTF-8 UTF-8" --target_file=/etc/locale.gen
|
||||
locale-gen
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
|
||||
ln -s /usr/share/zabbix "$final_path"
|
||||
|
||||
chmod 750 "/usr/share/zabbix"
|
||||
chmod -R o-rwx "/usr/share/zabbix"
|
||||
chown -R $app:www-data "/usr/share/zabbix"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
chown -R "$app:www-data" "/usr/share/zabbix"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the MySQL database..."
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
|
||||
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
|
||||
|
||||
export mysqlconn="mysql --user=$db_user --password=$db_pwd --database=$db_name"
|
||||
convert_ZabbixDB
|
||||
|
@ -103,65 +31,56 @@ convert_ZabbixDB
|
|||
#=================================================
|
||||
ynh_script_progression --message="Restoring various files..."
|
||||
|
||||
if [ -f "/etc/zabbix/web/zabbix.conf.php" ]
|
||||
then
|
||||
ynh_secure_remove --file="/etc/zabbix/web/zabbix.conf.php"
|
||||
if [ -f "/etc/zabbix/web/zabbix.conf.php" ]; then
|
||||
ynh_secure_remove --file="/etc/zabbix/web/zabbix.conf.php"
|
||||
fi
|
||||
|
||||
ynh_restore_file --origin_path="/etc/zabbix/web/zabbix.conf.php"
|
||||
|
||||
chmod 400 "/etc/zabbix/web/zabbix.conf.php"
|
||||
chown $app:www-data "/etc/zabbix/web/zabbix.conf.php"
|
||||
chown "$app:www-data" "/etc/zabbix/web/zabbix.conf.php"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/apt/apt.conf.d/100update_force_init_zabbix_frontend_config"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/zabbix/zabbix_server.conf"
|
||||
ynh_restore_file --origin_path="/etc/zabbix/zabbix_agentd.conf"
|
||||
|
||||
if [ ! -L /etc/zabbix/zabbix_agentd.d ]
|
||||
then
|
||||
ln -s /etc/zabbix/zabbix_agentd.conf.d /etc/zabbix/zabbix_agentd.d
|
||||
if [ ! -L /etc/zabbix/zabbix_agentd.d ]; then
|
||||
ln -s /etc/zabbix/zabbix_agentd.conf.d /etc/zabbix/zabbix_agentd.d
|
||||
fi
|
||||
|
||||
# Restore sudo file
|
||||
ynh_restore_file --origin_path="/etc/sudoers.d/zabbix"
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the systemd configuration..."
|
||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||
|
||||
ynh_replace_string --match_string="# $language.UTF-8 UTF-8" --replace_string="$language.UTF-8 UTF-8" --target_file=/etc/locale.gen
|
||||
locale-gen
|
||||
|
||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
change_timeoutAgent
|
||||
|
||||
systemctl enable zabbix-agent --quiet
|
||||
systemctl enable zabbix-server --quiet
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add snmpd --description="Management of SNMP Daemon"
|
||||
yunohost service add zabbix-server --description="Management Zabbix server daemon : collect, agregate, compute and notify" --log="/var/log/$app/${app}_server.log"
|
||||
yunohost service add zabbix-agent --description="Management Zabbix agent daemon : send informations about this host to the server" --log="/var/log/$app/${app}_agent.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app-server --action="restart" --log_path="/var/log/$app/${app}_server.log"
|
||||
ynh_systemd_action --service_name=$app-agent --action="restart" --log_path="/var/log/$app/${app}_agent.log"
|
||||
ynh_systemd_action --service_name="$app-server" --action="restart" --log_path="/var/log/$app/${app}_server.log"
|
||||
ynh_systemd_action --service_name="$app-agent" --action="restart" --log_path="/var/log/$app/${app}_agent.log"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
|
||||
|
||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
||||
ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
|
|
155
scripts/upgrade
155
scripts/upgrade
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -9,91 +7,35 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
|
||||
trustedversion="5.0.0-1+stretch"
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Checking version..."
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
ynh_script_progression --message="Stopping $app's systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app-server --action="stop" --log_path="/var/log/$app/${app}_server.log"
|
||||
ynh_systemd_action --service_name=$app-agent --action="stop" --log_path="/var/log/$app/${app}_agent.log"
|
||||
ynh_systemd_action --service_name="$app-server" --action="stop" --log_path="/var/log/$app/${app}_server.log"
|
||||
ynh_systemd_action --service_name="$app-agent" --action="stop" --log_path="/var/log/$app/${app}_agent.log"
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
|
||||
# If db_name doesn't exist, create it
|
||||
if [ -z "$db_name" ]; then
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
if [ "$language" == "fr" ]; then
|
||||
language="fr_FR"
|
||||
ynh_app_setting_set --app="$app" --key="language" --value="$language"
|
||||
fi
|
||||
|
||||
# If final_path doesn't exist, create it
|
||||
if [ -z "$final_path" ]; then
|
||||
final_path=/var/www/$app
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
fi
|
||||
|
||||
if [ "$language" == "fr" ]
|
||||
then
|
||||
language="fr_FR"
|
||||
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||
fi
|
||||
|
||||
if [ "$language" == "en" ]
|
||||
then
|
||||
language="en_GB"
|
||||
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||
if [ "$language" == "en" ]; then
|
||||
language="en_GB"
|
||||
ynh_app_setting_set --app="$app" --key="language" --value="$language"
|
||||
fi
|
||||
|
||||
export mysqlconn="mysql --user=$db_user --password=$db_pwd --database=$db_name"
|
||||
|
||||
# patch to remove old zabbix-client service
|
||||
if [ ! -z "$(yunohost service status | grep zabbix-client)" ]
|
||||
then
|
||||
ynh_script_progression --message="remove zabbix-client old service"
|
||||
yunohost service remove zabbix-client
|
||||
if yunohost service status | grep zabbix-client; then
|
||||
ynh_script_progression --message="remove zabbix-client old service"
|
||||
yunohost service remove zabbix-client
|
||||
fi
|
||||
|
||||
ynh_remove_logrotate
|
||||
|
@ -105,49 +47,19 @@ ynh_package_update
|
|||
ynh_add_config --template="../conf/etc_zabbix_web_zabbix.conf.php" --destination="/etc/zabbix/web/zabbix.conf.php"
|
||||
|
||||
chmod 400 "/etc/zabbix/web/zabbix.conf.php"
|
||||
chown $app:www-data "/etc/zabbix/web/zabbix.conf.php"
|
||||
chown "$app:www-data" "/etc/zabbix/web/zabbix.conf.php"
|
||||
|
||||
if [ -f "/usr/share/zabbix/conf/zabbix.conf.php" ]
|
||||
then
|
||||
ynh_secure_remove --file="/usr/share/zabbix/conf/zabbix.conf.php"
|
||||
if [ -f "/usr/share/zabbix/conf/zabbix.conf.php" ]; then
|
||||
ynh_secure_remove --file="/usr/share/zabbix/conf/zabbix.conf.php"
|
||||
fi
|
||||
|
||||
ln -s "/etc/zabbix/web/zabbix.conf.php" "/usr/share/zabbix/conf/zabbix.conf.php"
|
||||
|
||||
ynh_remove_extra_repo --name=zabbix
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading dependencies..."
|
||||
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="http://repo.zabbix.com/zabbix/5.0/debian $(lsb_release -sc) main" --package="$zabbix_pkg_dependencies" --key="https://repo.zabbix.com/zabbix-official-repo.key"
|
||||
fi
|
||||
|
||||
chmod 750 "/usr/share/zabbix"
|
||||
chmod -R o-rwx "/usr/share/zabbix"
|
||||
chown -R $app:www-data "/usr/share/zabbix"
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
chown -R "$app:www-data" "/usr/share/zabbix"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
|
@ -161,43 +73,34 @@ convert_ZabbixDB
|
|||
set_mediatype_default_yunohost
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
# REAPPLY SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading systemd configuration..."
|
||||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
change_timeoutAgent
|
||||
|
||||
systemctl enable zabbix-agent --quiet
|
||||
systemctl enable zabbix-server --quiet
|
||||
|
||||
update_initZabbixConf
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add snmpd --description="Management of SNMP Daemon"
|
||||
yunohost service add zabbix-server --description="Management Zabbix server daemon : collect, agregate, compute and notify" --log="/var/log/$app/${app}_server.log"
|
||||
yunohost service add zabbix-agent --description="Management Zabbix agent daemon : send informations about this host to the server" --log="/var/log/$app/${app}_agent.log"
|
||||
|
||||
update_initZabbixConf
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app-server --action="restart" --log_path="/var/log/$app/${app}_server.log" --line_match="server #0 started"
|
||||
ynh_systemd_action --service_name=$app-agent --action="restart" --log_path="/var/log/$app/${app}_agent.log"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemd_action --service_name="$app-server" --action="restart" --log_path="/var/log/$app/${app}_server.log" --line_match="server #0 started"
|
||||
ynh_systemd_action --service_name="$app-agent" --action="restart" --log_path="/var/log/$app/${app}_agent.log"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
11
tests.toml
Normal file
11
tests.toml
Normal file
|
@ -0,0 +1,11 @@
|
|||
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
|
||||
|
||||
test_format = 1.0
|
||||
|
||||
[default]
|
||||
|
||||
# ------------
|
||||
# Tests to run
|
||||
# ------------
|
||||
|
||||
test_upgrade_from.8f8961c239f890069c867e40005db98465add0c9.name = "5.0.20~ynh2"
|
Loading…
Add table
Reference in a new issue