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 ^^^^

    • #3613: Fixed encoding errors in expand.StaticModule when system default encoding doesn't match expectations for source files.
    • #3617: Merge with pypa/distutils@6852b20 including fix for pypa/distutils#181.

    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
Plugin to manage site, circuit and device diagrams and documents in Netbox

Netbox Documents Plugin A plugin designed to faciliate the storage of site, circuit and device specific documents within NetBox Note: Netbox v3.2+ is

Jason Yates 38 Dec 24, 2022
Import some key/value data to Prometheus custom-built Node Exporter in Python

About the app In one particilar project, i had to import some key/value data to Prometheus. So i have decided to create my custom-built Node Exporter

Hamid Hosseinzadeh 1 May 19, 2022
Prometheus exporter for chess.com player data

chess-exporter Prometheus exporter for chess.com player data implemented via chess.com's published data API and Prometheus Python Client Example use c

Mário Uhrík 7 Feb 28, 2022
Simple web application, which has a single endpoint, dedicated to annotation parsing and convertion.

Simple web application, which has a single endpoint, dedicated to annotation parsing and conversion.

Pavel Paranin 1 Nov 1, 2021
InfiniPy has some neat features - like the endpoint for function

InfiniPy has some neat features - like the endpoint for function

ZeroTwo 7 Nov 20, 2022
Push Prometheus metrics to VictoriaMetrics or other exporters

Push metrics from your periodic long-running jobs to existing Prometheus/VictoriaMetrics monitoring system.

olegm 14 Nov 4, 2022
Prometheus exporter for Spigot accounts

SpigotExporter Prometheus exporter for Spigot accounts What it provides SpigotExporter will output metrics for each of your plugins and a cumulative d

Jacob Bashista 5 Dec 20, 2021
The purpose of this script is to bypass disablefund, provide some useful information, and dig the hook function of PHP extension.

The purpose of this script is to bypass disablefund, provide some useful information, and dig the hook function of PHP extension.

Firebasky 14 Aug 2, 2021
A project to explore and provide useful code for Mango Markets

?? Mango Explorer A project to explore and provide useful code for Mango Markets

Blockworks Foundation 160 Dec 19, 2022
A simple project which is a ecm to found a good way to provide a path to img_dir in gooey

ECM to find a good way for img_dir Path in Gooey This code is just an ECM to find a good way to indicate a path of image in image_dir variable. We loo

Jean-Emmanuel Longueville 1 Oct 25, 2021
1cak - An Indonesian web that provide lot of fun.

An unofficial API of 1cak.com 1cak - An Indonesian web that provide lot of fun. Endpoint Lol -> 10 Recent stored posts on database Example: https://on

Dicky Mulia Fiqri 5 Sep 27, 2022
Terminal compatible with ansi-bbs. Meant to be a prototype, but published because why not.

pybbsterm: Terminal emulator for calling BBSs. Use cases (non-exhaustive) Explore terminal protocols. Connect to BBSs. Highlights Python 3.8+ code. Bu

Roc Vallès i Domènech 9 Apr 29, 2022
Aerial Ace is a helper bot for poketwo which provide various functionalities on top of being a pokedex.

Aerial Ace is a helper bot for poketwo which provide various functionalities on top of being a pokedex.

Devanshu Mishra 1 Dec 1, 2021
Provide error messages for Python exceptions, even if the original message is empty

errortext is a Python package to provide error messages for Python exceptions, even if the original message is empty.

Thomas Aglassinger 0 Dec 7, 2021
A collection of existing KGQA datasets in the form of the huggingface datasets library, aiming to provide an easy-to-use access to them.

KGQA Datasets Brief Introduction This repository is a collection of existing KGQA datasets in the form of the huggingface datasets library, aiming to

Semantic Systems research group 21 Jan 6, 2023
edgetest is a tox-inspired python library that will loop through your project's dependencies, and check if your project is compatible with the latest version of each dependency

Bleeding edge dependency testing Full Documentation edgetest is a tox-inspired python library that will loop through your project's dependencies, and

Capital One 16 Dec 7, 2022
Package to provide translation methods for pyramid, and means to reload translations without stopping the application

Package to provide translation methods for pyramid, and means to reload translations without stopping the application

Grzegorz Śliwiński 4 Nov 20, 2022
This collection is to provide an easier way to interact with Juniper

Ansible Collection - cremsburg.apstra Overview The goal of this collection is to provide an easier way to interact with Juniper's Apstra solution. Whi

Calvin Remsburg 1 Jan 18, 2022
Supply Chain will be a SAAS platfom to provide e-logistic facilites with most optimal

Shipp It Welcome To Supply Chain App [ Shipp It ] In "Shipp It" we are creating a full solution[web+app] for a entire supply chain from receiving orde

SAIKAT_CLAW 25 Dec 26, 2022