Provide Prometheus url_sd compatible API Endpoint with data from Netbox

Overview

netbox-plugin-prometheus-sd

Provide Prometheus http_sd compatible API Endpoint with data from Netbox.

HTTP SD is a new feature in Prometheus and not available at the moment. This project is an attempt to provide a compatible API endpoint.

⚠️ This is work in progress. The feature in Prometheus is still under development and so is this plugin.

See https://github.com/prometheus/prometheus/pull/8839 for more details.

Instalation

tbd.

Usage

The plugin only provides a new API endpoint on the Netbox API. There is no further action required after installation.

API

The plugin includes 4 API endpoints to manage the onbarding tasks

GET        /api/plugins/prometheus-sd/targets/       Get a list of prometheus compatible targets with lables

There is currently not authentication. It's planed to use the native Netbox API token method with filters for devices and VMs the user has access to.

Comments
  • Allow complex fields in custom field labels

    Allow complex fields in custom field labels

    Follow up PR to #34 with complex fields serialized as string representation.

    Requires some more testing with a real prometheus instance to make sure this works. I really want to make sure not to break peoples service discovery with custom fields in labels.

    opened by FlxPeters 11
  • Feature: Add new label

    Feature: Add new label "custom_field_data"

    Add new query with iregex search and add custom_fields data to the return.

    Example route : https://netbox.com/api/plugins/prometheus-sd/devices/?deviceModel=d.*nk -> this iregex can return all "dlink" models

    opened by oijkn 5
  • plugin not working under netbox v3.2

    plugin not working under netbox v3.2

    I tried to install this plugin under netbox v3.2 that was released a few days ago. Unfortunately the plugin fails with:

    netbox-worker_1        | Traceback (most recent call last):
    netbox-worker_1        |   File "/opt/netbox/netbox/manage.py", line 10, in <module>
    netbox-worker_1        |     execute_from_command_line(sys.argv)
    netbox-worker_1        |   File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    netbox-worker_1        |     utility.execute()
    netbox-worker_1        |   File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 440, in execute
    netbox-worker_1        |     self.fetch_command(subcommand).run_from_argv(self.argv)
    netbox-worker_1        |   File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/management/base.py", line 414, in run_from_argv
    netbox-worker_1        |     self.execute(*args, **cmd_options)
    netbox-worker_1        |   File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/management/base.py", line 455, in execute
    netbox-worker_1        |     self.check()
    netbox-worker_1        |   File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/management/base.py", line 487, in check
    netbox-worker_1        |     all_issues = checks.run_checks(
    netbox-worker_1        |   File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/checks/registry.py", line 88, in run_checks
    netbox-worker_1        |     new_errors = check(app_configs=app_configs, databases=databases)
    netbox-worker_1        |   File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/checks/urls.py", line 14, in check_url_config
    netbox-worker_1        |     return check_resolver(resolver)
    netbox-worker_1        |   File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/checks/urls.py", line 24, in check_resolver
    netbox-worker_1        |     return check_method()
    netbox-worker_1        |   File "/opt/netbox/venv/lib/python3.9/site-packages/django/urls/resolvers.py", line 480, in check
    netbox-worker_1        |     for pattern in self.url_patterns:
    netbox-worker_1        |   File "/opt/netbox/venv/lib/python3.9/site-packages/django/utils/functional.py", line 49, in __get__
    netbox-worker_1        |     res = instance.__dict__[self.name] = self.func(instance)
    netbox-worker_1        |   File "/opt/netbox/venv/lib/python3.9/site-packages/django/urls/resolvers.py", line 696, in url_patterns
    netbox-worker_1        |     patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
    netbox-worker_1        |   File "/opt/netbox/venv/lib/python3.9/site-packages/django/utils/functional.py", line 49, in __get__
    netbox-worker_1        |     res = instance.__dict__[self.name] = self.func(instance)
    netbox-worker_1        |   File "/opt/netbox/venv/lib/python3.9/site-packages/django/urls/resolvers.py", line 689, in urlconf_module
    netbox-worker_1        |     return import_module(self.urlconf_name)
    netbox-worker_1        |   File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    netbox-worker_1        |     return _bootstrap._gcd_import(name[level:], package, level)
    netbox-worker_1        |   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
    netbox-worker_1        |   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
    netbox-worker_1        |   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
    netbox-worker_1        |   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
    netbox-worker_1        |   File "<frozen importlib._bootstrap_external>", line 855, in exec_module
    netbox-worker_1        |   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
    netbox-worker_1        |   File "/opt/netbox/netbox/netbox/urls.py", line 9, in <module>
    netbox-worker_1        |     from extras.plugins.urls import plugin_admin_patterns, plugin_patterns, plugin_api_patterns
    netbox-worker_1        |   File "/opt/netbox/netbox/extras/plugins/urls.py", line 35, in <module>
    netbox-worker_1        |     urlpatterns = import_object(f"{plugin_path}.api.urls.urlpatterns")
    netbox-worker_1        |   File "/opt/netbox/netbox/extras/plugins/utils.py", line 31, in import_object
    netbox-worker_1        |     spec.loader.exec_module(module)
    netbox-worker_1        |   File "/opt/netbox/venv/lib/python3.9/site-packages/netbox_prometheus_sd/api/urls.py", line 2, in <module>
    netbox-worker_1        |     from .views import VirtualMachineViewSet, DeviceViewSet, IPAddressViewSet
    netbox-worker_1        |   File "/opt/netbox/venv/lib/python3.9/site-packages/netbox_prometheus_sd/api/views.py", line 4, in <module>
    netbox-worker_1        |     from extras.api.views import CustomFieldModelViewSet
    netbox-worker_1        | ImportError: cannot import name 'CustomFieldModelViewSet' from 'extras.api.views' (/opt/netbox/netbox/extras/api/views.py)
    

    It seems some changes are needed to make it compatible with newer netbox.

    There seems to be a ticket with changes that were made to the plugin framework.

    opened by matejv 4
  • Add extraction of contact information for VM's and Devices.

    Add extraction of contact information for VM's and Devices.

    When a contactAssignment is created the plugin will now extract the following fields when they are populated. If no value is present for email or role then the label will not be created.

            "__meta_netbox_contact_primary_name": "test contact",
            "__meta_netbox_contact_primary_email": "[email protected]",
            "__meta_netbox_contact_primary_comments": "comment",
            "__meta_netbox_contact_primary_role": "contact role",
            "__meta_netbox_contact_secondary_name": "Test Name 2",
            "__meta_netbox_contact_secondary_role": "contact role"
    

    Have also bumped the plugin version as shown in Netbox to 0.4 as it was still 0.1. (on assumption it gets a bump)

    I have not updated test cases as I cannot run them locally here to verify. Testing has been conducted against a running netbox instance and using to curl to verify plugin output.

    opened by streaming-pete 3
  • Single endpoint with union of devices and virtual-machines?

    Single endpoint with union of devices and virtual-machines?

    How hard would it be to make a single endpoint which exposes both devices and virtual-machines?

    Reason: AFAICS, currently every Prometheus scrape job needs to be duplicated, since prometheus http-sd can only scrape a single URL. If you've got a lot of rewriting rules, that can be painful.

    A union endpoint would solve this, and __meta_netbox_model can be used to distinguish between the objects if necessary.

    However, I can see there is much Django ORM queryset and serializer magic going on, so it may not be easy. Maybe this is relevant.

    opened by candlerb 2
  • multiple exporters on target

    multiple exporters on target

    is it possible to scrape multiple exporters on one target? i.e. node_exporter on port 2000, mariadb_exporter on port 2001

    how can i define exporter port?

    opened by cervajs 2
  • Bump pylint from 2.9.6 to 2.10.2

    Bump pylint from 2.9.6 to 2.10.2

    Bumps pylint from 2.9.6 to 2.10.2.

    Changelog

    Sourced from pylint's changelog.

    What's New in Pylint 2.10.2?

    Release date: 2021-08-21

    .. Put bug fixes that should not wait for a new minor version here

    • We now use platformdirs instead of appdirs since the latter is not maintained.

      Closes #4886

    • Fix a crash in the checker raising shallow-copy-environ when failing to infer on copy.copy

      Closes #4891

    What's New in Pylint 2.10.1?

    Release date: 2021-08-20

    • pylint does not crash when PYLINT_HOME does not exist.

      Closes #4883

    What's New in Pylint 2.10.0?

    Release date: 2021-08-20

    • pyreverse: add option to produce colored output.

      Closes #4488

    • pyreverse: add output in PlantUML format.

      Closes #4498

    • consider-using-with is no longer triggered if a context manager is returned from a function.

      Closes #4748

    • pylint does not crash with a traceback anymore when a file is problematic. It creates a template text file for opening an issue on the bug tracker instead. The linting can go on for other non problematic files instead of being impossible.

    • pyreverse: Show class has-a relationships inferred from the type-hint

      Closes #4744

    ... (truncated)

    Commits
    • 591a23a Bump pylint to 2.10.2, update changelog
    • d9dc89c Fix a crash from astroid.InferenceError raised on copy.copy
    • 5150d89 Updated mypy checks (#4889)
    • a3daf44 Require platformdirs 2.2.0 (#4890)
    • ad97338 Migrate from appdirs to platformdirs (#4887)
    • ba00fb2 Bump pylint to 2.10.2-dev0, update changelog
    • bf33282 Bump pylint to 2.10.1, update changelog
    • d701a97 pylint does not crash when PYLINT_HOME does not exist (#4884)
    • bbc4f66 Move back to a dev version following 2.10.0 release
    • ea448b8 Bump pylint to 2.10.0, update changelog
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 2
  • Bump pylint from 2.15.5 to 2.15.8

    Bump pylint from 2.15.5 to 2.15.8

    Bumps pylint from 2.15.5 to 2.15.8.

    Commits
    • 1f84ed9 Bump pylint to 2.15.8, update changelog (#7899)
    • 6178e41 Define Protocol as abstract to prevent abstract-method FP (#7839) (#7879)
    • 438025d add test and expl for line-too-long useless-supp FP (#7887)
    • 19c0534 Fix missing-param-doc for escaped underscores (#7878)
    • e1856b2 [github actions] Reinstate tests and check on maintenance branch
    • 5fb17e0 multiple-statements no longer triggers for function stubs using inlined `...
    • 5a96370 Bump pylint to 2.15.7, update changelog (#7845)
    • 43109b6 Revert "Fix crash when using enumerate with start and a class attribu...
    • ff73282 Fix logging-fstring-interpolation false positive (#7846) (#7854)
    • 86b8c64 Fix crash when using enumerate with start and a class attribute (#7824)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Bump pylint from 2.15.5 to 2.15.7

    Bump pylint from 2.15.5 to 2.15.7

    Bumps pylint from 2.15.5 to 2.15.7.

    Commits
    • 5a96370 Bump pylint to 2.15.7, update changelog (#7845)
    • 43109b6 Revert "Fix crash when using enumerate with start and a class attribu...
    • ff73282 Fix logging-fstring-interpolation false positive (#7846) (#7854)
    • 86b8c64 Fix crash when using enumerate with start and a class attribute (#7824)
    • ebf2824 Execute tests on maintenance branche's PR
    • 9ec1aa0 Do not crash if next() is called without arguments (#7831)
    • ac2da87 Upgrade the versions of astroid and dill (#7838)
    • 06d5d1a Add content: write rights for backporting job (#7826)
    • df5ebb5 Fix used-before-assignment for variable annotations guarded by TYPE_CHECKIN...
    • 1baf4be Deduplicate module file paths to prevent redundant scans. (#7747)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Bump pylint from 2.15.5 to 2.15.6

    Bump pylint from 2.15.5 to 2.15.6

    Bumps pylint from 2.15.5 to 2.15.6.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Custom fields

    Custom fields

    Based on on #69

    Add custom fields as labels. This is an early and simple approach, may be we need some more filters for more complex custom fields. For now only primitive types (bool, str, int) are exported. For more complex types like multiple choice or relations we need to investigate how to export them to labels.

    opened by FlxPeters 1
  • Netbox 3.4.0 - Prometheus-sd plugin doesn't work

    Netbox 3.4.0 - Prometheus-sd plugin doesn't work

    Hi everybody, I'm trying Netbox 3.4.0 with netbox-plugin-prometheus-sd and I can't see any device using the /api/plugins/prometheus-sd/devices API even if I have at least 1 device.

    This is the request:

    GET http://netbox.local:8000/api/plugins/prometheus-sd/devices/

    and this is the answer:

    ` HTTP 200 OK Allow: GET, POST, HEAD, OPTIONS Content-Type: application/json Vary: Accept

    [] `

    But I have at least 1 device (Dell R630 in state Active)

    opened by pasettifabio 1
  • Bump setuptools from 65.3.0 to 65.5.1

    Bump setuptools from 65.3.0 to 65.5.1

    Bumps setuptools from 65.3.0 to 65.5.1.

    Changelog

    Sourced from setuptools's changelog.

    v65.5.1

    Misc ^^^^

    • #3638: Drop a test dependency on the mock package, always use :external+python:py:mod:unittest.mock -- by :user:hroncok
    • #3659: Fixed REDoS vector in package_index.

    v65.5.0

    Changes ^^^^^^^

    • #3624: Fixed editable install for multi-module/no-package src-layout projects.
    • #3626: Minor refactorings to support distutils using stdlib logging module.

    Documentation changes ^^^^^^^^^^^^^^^^^^^^^

    • #3419: Updated the example version numbers to be compliant with PEP-440 on the "Specifying Your Project’s Version" page of the user guide.

    Misc ^^^^

    • #3569: Improved information about conflicting entries in the current working directory and editable install (in documentation and as an informational warning).
    • #3576: Updated version of validate_pyproject.

    v65.4.1

    Misc ^^^^

    v65.4.0

    Changes ^^^^^^^

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the Security Alerts page.
    dependencies 
    opened by dependabot[bot] 0
  • Bump pylint from 2.15.5 to 2.15.9

    Bump pylint from 2.15.5 to 2.15.9

    Bumps pylint from 2.15.5 to 2.15.9.

    Commits
    • 1ded4d0 Bump pylint to 2.15.9, update changelog (#7952)
    • 785c629 [testutil] More information in output for functional test fail (#7948)
    • 3c3ab98 [pypy3.8] Disable multiple-statements false positive on affected functional t...
    • dca3940 Fix inconsistent argument exit code when argparse exit with its own error cod...
    • 494e514 Fix ModuleNotFoundError when using pylint_django (#7940) (#7941)
    • 83668de fix: bump dill to >= 0.3.6, prevents tests hanging with python3.11 (#7918)
    • eadc308 [github actions] Fix enchant's install in the spelling job
    • 391323e Avoid hanging forever after a parallel job was killed (#7834) (#7930)
    • 4655b92 Prevent used-before-assignment in pattern matching with a guard (#7922) (#7...
    • 1f84ed9 Bump pylint to 2.15.8, update changelog (#7899)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • [Feature] - Add iregex filter for devices model and return custom_fields as labels

    [Feature] - Add iregex filter for devices model and return custom_fields as labels

    Hi, below is the Netbox API return from /api/dcim/devices/?name=router-01.example.com and I would like to know if you could implement in your API a filter on the model or model slug (using the model__iregex) that will return all devices matching this model as well as an option to return all custom_fields as labels, please.

    {
        "count": 1,
        "next": null,
        "previous": null,
        "results": [
            {
                "id": 8,
                "url": "https://netbox.example.com/api/dcim/devices/8/",
                "display": "router-01.example.com",
                "name": "router-01.example.com",
                "device_type": {
                    "id": 61,
                    "url": "https://netbox.example.com/api/dcim/device-types/61/",
                    "display": "Dlink xSeries",
                    "manufacturer": {
                        "id": 12,
                        "url": "https://netbox.example.com/api/dcim/manufacturers/12/",
                        "display": "DLINK",
                        "name": "DLINK",
                        "slug": "dlink"
                    },
                    "model": "Dlink xSeries",
                    "slug": "dlink-xseries"
                },
                "device_role": {
                    "id": 5,
                    "url": "https://netbox.example.com/api/dcim/device-roles/5/",
                    "display": "ROUTER",
                    "name": "ROUTER",
                    "slug": "ROUTER"
                },
                "tenant": {
                    "id": 1,
                    "url": "https://netbox.example.com/api/tenancy/tenants/1/",
                    "display": "HOME",
                    "name": "HOME",
                    "slug": "home"
                },
                "platform": null,
                "serial": "01234567890",
                "asset_tag": null,
                "site": {
                    "id": 1,
                    "url": "https://netbox.example.com/api/dcim/sites/1/",
                    "display": "Malakoff",
                    "name": "Paris",
                    "slug": "paris"
                },
                "location": null,
                "rack": {
                    "id": 8,
                    "url": "https://netbox.example.com/api/dcim/racks/8/",
                    "display": "RACK 11",
                    "name": "RACK 11"
                },
                "position": 6,
                "face": {
                    "value": "front",
                    "label": "Front"
                },
                "parent_device": null,
                "status": {
                    "value": "active",
                    "label": "Active"
                },
                "airflow": {
                    "value": "side-to-rear",
                    "label": "Side to rear"
                },
                "primary_ip": null,
                "primary_ip4": null,
                "primary_ip6": null,
                "cluster": null,
                "virtual_chassis": null,
                "vc_position": null,
                "vc_priority": null,
                "comments": "",
                "local_context_data": null,
                "tags": [],
                "custom_fields": {
                    "IP": "10.1.1.10",
                    "snmp_communaute": "read",
                    "snmp_communaute_alternate": null,
                    "snmp_version": "2c",
                    "snmp_port": "161",
                    "ping_frequence": "60",
                    "snmp_frequence": "60",
                    "client": null,
                    "exploitant": "Operator",
                    "partenaire": null
                },
                "config_context": {},
                "created": "2022-07-12T12:21:22.461170Z",
                "last_updated": "2022-07-12T12:23:18.688284Z"
            }
        ]
    }
    

    Thank you in advance.

    opened by oijkn 8
  • export custom fields as labels

    export custom fields as labels

    Hey @FlxPeters.

    I got this up and running and solved a few problems in testing. Ace work!

    I was just testing this out and noticed that the custom fields are not coming out where the netbox-prometheus-sd does pull them out and turn the fields into labels. (I'd patched a bug there with label txt). I think it would be nice to export them as I'd based some functionality around it based on the other tool and it allows people to pass some params outbound for things like escalation ownership etc.

    from the other closed issue about this - I'm just testing using tags etc, services looks like a right pain and not a fast way to turn it on.

    I'll have a look at the code and see if I can figure out something and use your logic from the other application. might look at a url option for customlablels=true to turn them on and off etc.

    happy to bounce a few things about.

    opened by streaming-pete 11
Releases(0.6.0rc1)
  • 0.6.0rc1(Oct 25, 2022)

    What's Changed

    • Custom fields by @FlxPeters / @oijkn in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/73
    • Allow complex fields in custom field labels by @FlxPeters in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/74
    • Bump pylint from 2.15.2 to 2.15.3 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/75
    • Bump invoke from 1.7.1 to 1.7.3 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/76
    • Bump black from 22.8.0 to 22.10.0 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/77
    • Bump pylint from 2.15.3 to 2.15.4 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/78
    • Bump pylint from 2.15.4 to 2.15.5 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/79

    Full Changelog: https://github.com/FlxPeters/netbox-plugin-prometheus-sd/compare/0.5.0...0.6.0rc1

    Source code(tar.gz)
    Source code(zip)
  • 0.5.0(Sep 14, 2022)

    Maintenance release with updates for dependencies and a new default Netbox version.

    What's Changed

    • Bump pylint from 2.13.7 to 2.13.8 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/49
    • Bump invoke from 1.7.0 to 1.7.1 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/52
    • Bump pylint from 2.13.8 to 2.13.9 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/53
    • Bump pylint from 2.13.9 to 2.14.5 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/64
    • Bump yamllint from 1.26.3 to 1.27.1 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/63
    • Bump black from 22.3.0 to 22.8.0 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/68
    • Bump pylint from 2.14.5 to 2.15.0 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/67
    • Bump typed-ast from 1.5.3 to 1.5.4 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/54
    • Bump pylint from 2.15.0 to 2.15.2 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/70
    • Bump yamllint from 1.27.1 to 1.28.0 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/71
    • Upgrade Netbox default version to Netbox 3.3 by @FlxPeters in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/72

    Full Changelog: https://github.com/FlxPeters/netbox-plugin-prometheus-sd/compare/0.4.0...0.5.0

    Source code(tar.gz)
    Source code(zip)
  • 0.4.0(May 9, 2022)

    This release introduces the compatibility with Netbox 3.2. We also have contact information as new labels.

    Thanks to all new and existing contributors! 🚀

    What's Changed

    • Bump pylint from 2.13.2 to 2.13.3 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/43
    • Bump pylint from 2.13.3 to 2.13.4 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/44
    • Bump pylint from 2.13.4 to 2.13.5 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/45
    • Bump typed-ast from 1.5.2 to 1.5.3 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/47
    • Add extraction of contact information for VM's and Devices. by @streaming-pete in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/35
    • Bump pylint from 2.13.5 to 2.13.7 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/48
    • Expose both IPv6 and IPv4 primary addresses by @johanfleury in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/37
    • Rename CustomFieldModelViewSet name for NetBox 3.2+ by @stephrdev in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/50

    New Contributors

    • @streaming-pete made their first contribution in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/35
    • @johanfleury made their first contribution in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/37
    • @stephrdev made their first contribution in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/50

    Full Changelog: https://github.com/FlxPeters/netbox-plugin-prometheus-sd/compare/0.3.1...0.4.0

    Source code(tar.gz)
    Source code(zip)
  • 0.3.1(Mar 29, 2022)

    Update dependencies - no new Features.

    What's Changed

    • Bump typed-ast from 1.5.1 to 1.5.2 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/31
    • Bump black from 21.12b0 to 22.1.0 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/32
    • Bump pylint-django from 2.5.0 to 2.5.1 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/33
    • Bump invoke from 1.6.0 to 1.7.0 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/38
    • Bump pylint-django from 2.5.1 to 2.5.2 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/36
    • Bump pylint from 2.12.2 to 2.13.0 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/39
    • Bump pylint-django from 2.5.2 to 2.5.3 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/40
    • Bump pylint from 2.13.0 to 2.13.2 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/41
    • Bump black from 22.1.0 to 22.3.0 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/42

    Full Changelog: https://github.com/FlxPeters/netbox-plugin-prometheus-sd/compare/0.3.0...0.3.1

    Source code(tar.gz)
    Source code(zip)
  • 0.3.0(Jan 18, 2022)

    What's Changed

    • Bump black from 21.7b0 to 21.10b0 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/20
    • Bump typed-ast from 1.4.3 to 1.5.0 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/21
    • Bump black from 21.10b0 to 21.11b0 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/22
    • Bump black from 21.11b0 to 21.11b1 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/23
    • Bump pylint from 2.9.6 to 2.12.1 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/25
    • Bump typed-ast from 1.5.0 to 1.5.1 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/26
    • Bump black from 21.11b1 to 21.12b0 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/27
    • Bump pylint from 2.12.1 to 2.12.2 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/28
    • Bump pylint-django from 2.4.4 to 2.5.0 by @dependabot in https://github.com/FlxPeters/netbox-plugin-prometheus-sd/pull/29

    Full Changelog: https://github.com/FlxPeters/netbox-plugin-prometheus-sd/compare/0.2.0...0.3.0

    Source code(tar.gz)
    Source code(zip)
  • 0.2.0(Oct 31, 2021)

    Improvements

    Pageing

    Remove paging from Prometheus APIs because Prometheus does not support them. Results over 50 items required a page size parameter in the earlier releases. Now paging is completely disabled.

    Full Changelog: https://github.com/FlxPeters/netbox-plugin-prometheus-sd/compare/0.1.0...0.2.0

    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(Oct 29, 2021)

  • 0.1.0rc1(Oct 27, 2021)

Owner
Felix Peters
Felix Peters
p5 is a Python package based on the core ideas of Processing.

p5 p5 is a Python library that provides high level drawing functionality to help you quickly create simulations and interactive art using Python. It c

p5py 645 Jan 04, 2023
A custom advent of code I am completing

advent-of-code-custom A custom advent of code I am doing in python. The link to the problems I am solving is here: https://github.com/seldoncode/Adven

Rocio PV 2 Dec 11, 2021
NGEBUG is a tool that sends viruses to victims

Ngebug NGEBUG adalah tools pengirim virus ke korban NGEBUG adalah tools virus terbaru yang berasal dari rusia Informasi lengkap ada didalam tools Run

Profesor Acc 3 Dec 13, 2021
Project Faros is a reference implimentation of Red Hat OpenShift 4 on small footprint, bare-metal clusters.

Project Faros Project Faros is a reference implimentation of Red Hat OpenShift 4 on small footprint, bare-metal clusters. The project includes referen

project: Faros 9 Jul 18, 2022
This is a backport of the BaseExceptionGroup and ExceptionGroup classes from Python 3.11.

This is a backport of the BaseExceptionGroup and ExceptionGroup classes from Python 3.11. It contains the following: The exceptiongroup.BaseExceptionG

Alex Grönholm 19 Dec 15, 2022
A NetBox Plugin that gives a UI for generating, comparing and deploying configurations to devices.

netbox_config_plugin - A plugin to generate, compare and deploy configurations This plugin allows you to execute your code to generate a config for a

Jo 11 Dec 21, 2022
A tool for generating skill map/tree like diagram

skillmap A tool for generating skill map/tree like diagram. What is a skill map/tree? Skill tree is a term used in video games, and it can be used for

Yue 98 Jan 07, 2023
Minutaria is a basic educational Python timer used to learn python and software testing libraries.

minutaria minutaria is a basic educational Python timer. The project is educational, it aims to teach myself programming, python programming, python's

1 Jul 16, 2021
A StarkNet project template based on a Pythonic environment

StarkNet Project Template This is an opinionated StarkNet project template. It is based around the Python's ecosystem and best practices. tox to manag

Francesco Ceccon 5 Apr 21, 2022
Junos PyEZ is a Python library to remotely manage/automate Junos devices.

The repo is under active development. If you take a clone, you are getting the latest, and perhaps not entirely stable code. DOCUMENTATION Official Do

Juniper Networks 623 Dec 10, 2022
This is a simple analogue clock made with turtle in python...

Analogue-Clock This is a simple analogue clock made with turtle in python... Requirements None, only you need to have windows 😉 ...Enjoy! Installatio

Abhyush 3 Jan 14, 2022
Persian Kaldi profile for Rhasspy built from open speech data

Persian Kaldi Profile A Rhasspy profile for Persian (fa). Installation Get started by first installing Vosk: # Create virtual environment python3 -m v

Rhasspy 12 Aug 08, 2022
Rates how pog a word or user is. Not random and does have *some* kind of algorithm to it.

PogRater :D Rates how pogchamp a word is :D A fun project coded by JBYT27 using Python3 Have you ever wondered how pog a word is? Well, congrats, you

an aspirin 2 Jun 25, 2022
Some basic sorting algos

Sorting-Algos Some basic sorting algos HacktoberFest 2021 This repository consists of mezzo-level projects that undertake a simple task and perform it

Manthan Ghasadiya 7 Dec 13, 2022
Repo created for the purpose of adding any kind of programs and projects

Programs and Project Repository A repository for adding programs and projects of any kind starting from beginners level to expert ones Contributing to

Unicorn Dev Community 3 Nov 02, 2022
TMTC Commander Core

This commander application was first developed by KSat for the SOURCE project to test the on-board software but has evolved into a more generic tool for satellite developers to perform TMTC (Telemetr

robamu 8 Dec 14, 2022
Nesse repositório serão armazenados os conteúdos de aula

Lets_Code_DS_Degree_Alunos Nesse repositório serão armazenados os conteúdos de aula Formato das aulas: Notebook de aula já vem comentado para reduzir

Patricia Bongiovanni Catandi 6 Jan 21, 2022
PORTSCANNING-IN-PYTHON - A python threaded portscanner to scan websites and ipaddresses

PORTSCANNING-IN-PYTHON This is a python threaded portscanner to scan websites an

1 Feb 16, 2022
The program converts Swiss notes into American notes

Informatik-Programmieren Einleitung: Das Programm rechnet Schweizer Noten in das Amerikanische Noten um. Der Benutzer kann seine Note eingeben und der

2 Dec 16, 2021
NYCU(NCTU)-差勤-助教

NCTU-TA-fill 填寫 差勤-助教時數 有沒有覺得在差勤系統填助教時數有點浪費生命? 今天有個懶鬼浪費好多時間幫大家寫了code 只要填好的必要的資料,就可以讓電腦自動幫你完成差勤助教的時數填寫喔! https://pt-attendance.nctu.edu.tw/verify/userL

14 Dec 21, 2021