Giter Club home page Giter Club logo

trend-micro-vision-one-alert-monitoring's Introduction

Alerts Monitoring : Trend Micro Vision One with API, Prometheus and Grafana

Alerts Monitoring : Trend Micro Vision One with API, Prometheus and Grafana sert à obtenir certaines metriques exploitables concernant les events de l'XDR Trend comme le nombre d'events total sur une durée choisie, le lien de l'event, la sevérité, etc. Il est possible par la suite de les intégrer à un outil de monitoring tel que Grafana.

C'est un projet qui comporte :

  • un dockerfile pour faciliter l'installation
  • un script python servant d'exporter et de colleteur Prometheus
  • un fichier de config qui contient le token
  • un fichier de config prometheus.yml
  • les requirements

Prérequis

Installer Python (3.10).

Installer Docker Desktop.

Créer un fichier prometheus.yml vide ou récupérer celui du projet.

Dans Docker Desktop il faut :

Dans Windows PowerShell (ou autre console) :

docker run -d -p 9090:9090 --name prometheus -v /VOTRECHEMIN/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus:v2.29.2
docker run -d -p 3000:3000 --name grafana grafana/grafana:latest

Installation

Dans Windows PowerShell (ou autre console), se rendre dans le répertoire du projet :

docker build -t trendmicro:1.0 .
docker images 
docker run -p 9400:9400 --name trend [IMAGEID]

Installation alternative

Installer les libraires et les modules nécessaires.

pip install -r REQUIREMENTS.txt

Mise en place

Il faut modifier le token dans le fichier config.py et mettre votre token Trend (droits admin nécessaires).

token = 'YOURTOKEN'

Modifier également le fichier de config prometheus.yml (/VOTRECHEMIN/prometheus.yml) afin de renseigner votre IP dans les jobs.

global:
  scrape_interval: 5s
  external_labels:
    monitor: 'node'
scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['YOURIP:9090'] ## IP Address of the localhost. Match the port to your container port
  - job_name: 'vision_one'
    static_configs:
      - targets: ['YOURIP:9400']

Token : variable d'environnement

Il y a la possibilité de passer le token en variable d'environnement dans Windows PowerShell (laisser la fenêtre ouverte) :

$Env:token='VOTRETOKEN'

Il faut alors renommer le fichier config_token_env.py en config.py.

Il est parfois nécessaire d'ajouter le paramètre -e (export) pour lancer le container :

docker run -p 9400:9400 --name trend -e token='VOTRETOKEN' [IMAGEID]

Sinon l'usage alternatif fonctionne de la même façon.

Usage

Lancer le container Prometheus, le container Grafana et le container trend via Docker Desktop (ils sont normalement déjà lancés).

Usage alternatif

Les containers Prometheus et Grafana sont normalement déjà lancés. Alors il suffit de lancer le script python api.py dans une console Windows (ou autre console).

python api.py

Et ensuite ?

Pour observer les métrics il faut se rendre à l'adresse : http://YOURIP:9400.

Pour aller sur Prometheus il faut se rendre à l'adresse : http://YOURIP:9090.

Pour créer votre dashboard il faut se rendre sur : http://YOURIP:3000.

Sur Grafana, renseigner la data source Prometheus avec l'adresse que vous avez attribuée (http://YOURIP:9090).

Documentation

Guide API Trend

API utilisée

Cacher une colonne sur Grafana

Faire un exporter Prometheus en Python

Windows variable environnement

Python variable environnement

Contribution

Toutes les contributions sont les bienvenues.

Licence

MIT

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.