Giter Site home page Giter Site logo

akg4281 / prometheus-exporter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from neuvector/prometheus-exporter

0.0 0.0 0.0 4.23 MB

Prometheus exporter and Grafana template for NeuVector container security platform

License: Apache License 2.0

Python 97.70% Dockerfile 2.30%

prometheus-exporter's Introduction

Prometheus exporter and Grafana template

NV_Exporter Setup:

To run the exporter as Python program

  • Clone the repository
  • Make sure you installed Python 3 and python3-pip:
$ sudo apt-get install python3
$ sudo apt-get install python3-pip
  • Install the Prometheus Python client:
$ sudo pip3 install -U setuptools
$ sudo pip3 install -U pip
$ sudo pip3 install prometheus_client requests

To run the exporter and prometheus as a container

It's easier to start NeuVector exporter as a container. The following section describe how to start the exporter in the Docker environment. A kubernetes sample yaml file, nv_exporter.yml, is also included.

Modify both docker-compose.yml and nv_exporter.yml. Specify NeuVector controller's RESTful API endpoint CTRL_API_SERVICE, login username CTRL_USERNAME, password CTRL_PASSWORD, and the port that the export listens on through environment variables EXPORTER_PORT. It's highly recommanded to create a read-only user account for the exporter.

In native docker environment

Start NeuVector exporter container.

$ docker-compose up -d
  • Open browser, go to: [exporter_host:exporter_port] (example: localbost:8068)
  • If you can load the metric page, the exporter is working fine.

Add and modify the exporter target in your prometheus.yml file under scrape_configs:

scrape_configs:
  - job_name: prometheus
    scrape_interval: 10s
    static_configs:
      - targets: ["localhost:9090"]
  - job_name: nv-exporter
    scrape_interval: 30s
    static_configs:
      - targets: ["neuvector-svc-prometheus-exporter.neuvector:8068"]

Start Prometheus container.

$ docker run -itd -p 9090:9090 -v $(pwd)/prometheus.yml:/etc/prometheus/prometheus.yml --name prometheus prom/prometheus
  • After deployed Prometheus, open browser and go to: [prometheus_host:9090] (example: localhost:9090)
  • On the top bar go to Status -> Targets to check exporter status. If the name is blue and State is UP, the exporter is running and Prometheus is successfully connected to the exporter.
  • On the top bar go to Graph and in the Expression box type nv to view all the metrics the exporter has.
In Kubernetes

Start NeuVector exporter pod and service.

$ kubectl create -f nv_exporter.yml

Create configMap for Prometheus scrape_configs.

$ kubectl create cm prometheus-cm --from-file prom-config.yml

Start Prometheus pod and service.

$ kubectl create -f prometheus.yml

Grafana Setup:

  • Start Grafana container. "docker run" example,
$ sudo docker run -d -p 3000:3000 --name grafana grafana/grafana
  • After deployed Grafana, open browser and go to: [grafana_host:3000] (example: localhost:3000)
  • Login and add Prometheus data source from Configurations -> Data Sources
  • find the + on the left bar, select Import. Upload NeuVector dashboard templet JSON file.

prometheus-exporter's People

Contributors

garyduan avatar dtzwylb avatar becitsthere 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.