Giter Club home page Giter Club logo

b2-tp3-linux-hugoa's Introduction

TP3 : Développement d'un outil pour les admins

Outil de monitoring pour serveur Rocky Linux 9

Installation

Installation et lancement du script init pour créer le user, les dossiers et lancer le service

git clone https://github.com/HugoANDRIAMAMPIANINA/b2-tp3-linux-hugoa
cd b2-tp3-linux-hugoa/
chmod +x init.sh
sudo ./init.sh

IMPORTANT Pour joindre l'API, il faut ouvrir le port 8000 de votre

sudo firewall-cmd --add-port=8000/tcp --permanent
sudo firewall-cmd --reload

Usage

monit.py

  • Lancer un check des ressources du système dont la RAM, le disque, le CPU et l'état des ports TCP précisés dans le fichier de conf monit.conf et afficher ces valeurs dans le terminal. Stock les valeurs dans un fichier json dans /var/monit :
    sudo -u monit-man monit.py --check
  • Afficher la liste des rapports qui ont été effectués :
    sudo -u monit-man monit.py --list
  • Afficher le dernier rapport :
    sudo -u monit-man monit.py --get-last
  • Afficher les valeurs moyennes des X dernières heures selon les rapports :
    sudo -u monit-man monit.py --get-avg X

monit-api.py

Accès à l'API : <ip-machine>:8000

  • Récupérer tous les rapports au format json :

    # sur la machine
    curl 127.0.0.1:8000/reports
    
    # sur une autre machine
    curl <ip-machine>:8000/reports
  • Récupérer un rapport via son id au format json :

    # sur la machine
    curl 127.0.0.1:8000/reports/<id-rapport>
    
    # sur une autre machine
    curl <ip-machine>:8000/reports/<id-rapport>

Configuration

Fichier de configuration : monit.conf

Il se situe dans /etc/monit/monit.conf

Structure :

{
    "tcp_ports": []
}

Pour ajouter des ports à surveiller, :

# chaque port doit être séparé par une virgule
{
    "tcp_ports": [80,443,22,8888]
}

b2-tp3-linux-hugoa's People

Watchers

SeigneurHugo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.