Giter Site home page Giter Site logo

mirzawaqasahmed / netbox-prometheus-sd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from enix/netbox-prometheus-sd

0.0 0.0 0.0 11 KB

Service discovery for Prometheus using devices from Netbox

License: MIT License

Dockerfile 9.26% Python 90.74%

netbox-prometheus-sd's Introduction

Service discovery for Prometheus using devices from Netbox.

Legal

This project is released under MIT license, copyright 2018 ENIX SAS.

Contribute

Feel free to contribute to this project through Github pull-requests. We also accept well formatted git patches sent by email to the maintainer.

Current Maintainer: Antoine Millet <antoine.millet at enix.io>

Requirement

This project requires Python 3 and Pynetbox.

Also, this project requires a custom field to be created into your Netbox instance. By default, this custom field is named prom_labels and can be created in the Netbox admin page (Home -> Extras -> Custom fields) with the following settings:

  • Objects: select dcim > device and virtualization > virtual machine
  • Type: Text
  • Name: prom_labels

Usage

usage: netbox-prometheus-sd.py [-h] [-p PORT] [-f CUSTOM_FIELD]
                               url token output

positional arguments:
  url                   URL to Netbox
  token                 Authentication Token
  output                Output file

optional arguments:
  -h, --help            show this help message and exit
  -p PORT, --port PORT  Default target port; Can be overridden using the
                        __port__ label
  -f CUSTOM_FIELD, --custom-field CUSTOM_FIELD
                        Netbox custom field to use to get the target labels

The service discovery script requires the URL to the Netbox instance, an API token that can be generated into the user profile page of Netbox and a path to an output file.

Optionally, you can customize the custom field used to get target labels in Netbox using the --custom-field option. You can also customize the default port on which the target will point to using the --port option. Note that this port can be customized per target using the __port__ label set in the custom field.

The output will be generated in the file pointed by the output argument.

In the Prometheus configuration, declare a new scrape job using the file_sd_configs service discovery:

- job_name: 'netbox'
  file_sd_configs:
  - files:
    - '/path/to/my/output.json'

netbox-prometheus-sd's People

Contributors

naps avatar rosiak 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.