From 7760d9aaa95eb2841ee5c5d20e2e0a2f462449ff Mon Sep 17 00:00:00 2001 From: Daniel Allaire Date: Fri, 6 Mar 2026 13:35:44 -0500 Subject: [PATCH] =?UTF-8?q?deuxi=C3=A8me=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 +++ ansible/deploy_life_noc.yml | 5 ++ ansible/roles/life_noc/tasks/main.yml | 15 +++++ bpm/life-noc_structure.txt | 8 +++ checks/check_echeance_vie.sh | 24 ++++++++ icinga/commands/check_echeance_vie.conf | 13 +++++ icinga/hosts/life-noc.conf | 9 +++ icinga/services/finances.conf | 14 +++++ icinga/services/focus.conf | 35 ++++++++++++ icinga/templates/service-echeance.conf | 8 +++ icinga/templates/service_focus.conf | 5 ++ prepare_commit.sh | 75 +++++++++++++++++++++++++ 12 files changed, 220 insertions(+) create mode 100644 icinga/templates/service-echeance.conf create mode 100755 prepare_commit.sh diff --git a/README.md b/README.md index e69de29..7840f24 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,9 @@ +## Origine du projet + +Le concept Life-NOC est né d’une réflexion sur la surcharge mentale produite par la complexité du monde moderne. + +L’idée centrale est d’appliquer les principes de supervision des centres d’opérations (NOC) à la gestion du quotidien : + +- transformer la charge mentale invisible en état observable. + +Le projet est développé et partagé par Chezlepro Inc. afin d’aider les personnes qui souhaitent retrouver de la clarté et de la sérénité dans leur organisation personnelle. \ No newline at end of file diff --git a/ansible/deploy_life_noc.yml b/ansible/deploy_life_noc.yml index e69de29..a06a702 100644 --- a/ansible/deploy_life_noc.yml +++ b/ansible/deploy_life_noc.yml @@ -0,0 +1,5 @@ +- hosts: icinga + become: yes + + roles: + - life_noc diff --git a/ansible/roles/life_noc/tasks/main.yml b/ansible/roles/life_noc/tasks/main.yml index e69de29..197185a 100644 --- a/ansible/roles/life_noc/tasks/main.yml +++ b/ansible/roles/life_noc/tasks/main.yml @@ -0,0 +1,15 @@ +- name: installer script check + copy: + src: check_echeance_vie.sh + dest: /usr/lib/nagios/plugins/check_echeance_vie.sh + mode: '0755' + +- name: déployer configuration icinga + copy: + src: ../../icinga/ + dest: /etc/icinga2/conf.d/life-noc/ + +- name: recharger icinga + service: + name: icinga2 + state: reloaded diff --git a/bpm/life-noc_structure.txt b/bpm/life-noc_structure.txt index e69de29..dd4ce3e 100644 --- a/bpm/life-noc_structure.txt +++ b/bpm/life-noc_structure.txt @@ -0,0 +1,8 @@ +LIFE-NOC + ├ FOCUS + ├ FINANCES + ├ ADMIN + ├ MAISON + ├ SANTE + ├ PROJETS + └ RESILIENCE diff --git a/checks/check_echeance_vie.sh b/checks/check_echeance_vie.sh index e69de29..26eabac 100644 --- a/checks/check_echeance_vie.sh +++ b/checks/check_echeance_vie.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +DATE=$1 +WARN=$2 +CRIT=$3 + +NOW=$(date +%s) +DUE=$(date -d "$DATE" +%s) + +DELTA=$((DUE - NOW)) +DAYS=$((DELTA / 86400)) + +if [ "$DAYS" -le "$CRIT" ]; then + echo "CRITICAL - échéance imminente" + exit 2 +fi + +if [ "$DAYS" -le "$WARN" ]; then + echo "WARNING - échéance proche" + exit 1 +fi + +echo "OK - sous contrôle" +exit 0 diff --git a/icinga/commands/check_echeance_vie.conf b/icinga/commands/check_echeance_vie.conf index e69de29..29faf2c 100644 --- a/icinga/commands/check_echeance_vie.conf +++ b/icinga/commands/check_echeance_vie.conf @@ -0,0 +1,13 @@ +object CheckCommand "check_echeance_vie" { + + command = [ PluginDir + "/check_echeance_vie.sh" ] + + arguments = { + + "--date" = "$date_echeance$" + "--warn" = "$warning_days$" + "--crit" = "$critical_days$" + + } + +} diff --git a/icinga/hosts/life-noc.conf b/icinga/hosts/life-noc.conf index e69de29..ebfcb38 100644 --- a/icinga/hosts/life-noc.conf +++ b/icinga/hosts/life-noc.conf @@ -0,0 +1,9 @@ +object Host "life-noc" { + + import "generic-host" + + address = "127.0.0.1" + + vars.type = "life-noc" + +} diff --git a/icinga/services/finances.conf b/icinga/services/finances.conf index e69de29..0434606 100644 --- a/icinga/services/finances.conf +++ b/icinga/services/finances.conf @@ -0,0 +1,14 @@ +apply Service "CP-MENSUEL-FINANCES-REVISION_COMPTES" { + + import "service-echance-vie" + + vars.date_echeance = "2026-04-01" + + vars.warning_days = 5 + vars.critical_days = 1 + + vars.domaine_vie = "FINANCES" + + assign where host.name == "life-noc" + +} diff --git a/icinga/services/focus.conf b/icinga/services/focus.conf index e69de29..a2bd747 100644 --- a/icinga/services/focus.conf +++ b/icinga/services/focus.conf @@ -0,0 +1,35 @@ +apply Service "FOCUS-01" { + + import "service-focus" + + check_command = "dummy" + vars.dummy_state = 0 + vars.dummy_text = "Priorité 1" + + assign where host.name == "life-noc" + +} + +apply Service "FOCUS-02" { + + import "service-focus" + + check_command = "dummy" + vars.dummy_state = 0 + vars.dummy_text = "Priorité 2" + + assign where host.name == "life-noc" + +} + +apply Service "FOCUS-03" { + + import "service-focus" + + check_command = "dummy" + vars.dummy_state = 0 + vars.dummy_text = "Priorité 3" + + assign where host.name == "life-noc" + +} diff --git a/icinga/templates/service-echeance.conf b/icinga/templates/service-echeance.conf new file mode 100644 index 0000000..bcf49d5 --- /dev/null +++ b/icinga/templates/service-echeance.conf @@ -0,0 +1,8 @@ +template Service "service-echance-vie" { + + check_command = "check_echeance_vie" + + vars.warning_days = 5 + vars.critical_days = 1 + +} diff --git a/icinga/templates/service_focus.conf b/icinga/templates/service_focus.conf index e69de29..7712c2e 100644 --- a/icinga/templates/service_focus.conf +++ b/icinga/templates/service_focus.conf @@ -0,0 +1,5 @@ +template Service "service-focus" { + + check_command = "dummy" + +} diff --git a/prepare_commit.sh b/prepare_commit.sh new file mode 100755 index 0000000..2b254b1 --- /dev/null +++ b/prepare_commit.sh @@ -0,0 +1,75 @@ +#!/usr/bin/env bash + +set -e + +echo "=== Life-NOC repository preparation ===" + +# Vérifier qu'on est dans un repo git +if [ ! -d ".git" ]; then + echo "Erreur: ce répertoire n'est pas un dépôt git." + exit 1 +fi + +echo +echo "1) Suppression du doublon template" + +DUPLICATE="icinga/templates/service-echeance.conf" + +if [ -f "$DUPLICATE" ]; then + git rm "$DUPLICATE" + echo "Supprimé: $DUPLICATE" +else + echo "Doublon déjà absent." +fi + +echo +echo "2) Création du .gitignore" + +cat > .gitignore << 'EOF' +*.swp +*.log +*.retry +*.pyc +__pycache__/ +.ansible/ +.vscode/ +EOF + +echo ".gitignore créé." + +echo +echo "3) Création du CHANGELOG" + +cat > CHANGELOG.md << 'EOF' +# CHANGELOG + +## v0.1 + +Initialisation du projet Life-NOC + +Contenu : + +- concept Life-NOC +- architecture Icinga +- premiers services +- check échéance +- structure BPM +- déploiement Ansible initial +EOF + +echo "CHANGELOG.md créé." + +echo +echo "4) Ajout des fichiers" + +git add . + +echo +echo "5) Commit" + +git commit -m "Life-NOC v0.1 initial architecture" + +echo +echo "=== Terminé ===" +echo +echo "Le dépôt Life-NOC est maintenant cristallisé."