Coder Social home page Coder Social logo

uberspace / icingaweb2-module-netboximport Goto Github PK

View Code? Open in Web Editor NEW
21.0 6.0 10.0 80 KB

Import devices and virtual machines from netbox into icinga2 to monitor them.

License: MIT License

PHP 100.00%
monitoring icinga2 icinga2-plugin netbox dcim importer

icingaweb2-module-netboximport's Issues

Invalid argument supplied for foreach()

Cannot run an import from NetBox to Icingaweb2:

#0 /usr/share/icingaweb2/modules/netboximport/library/Netboximport/ProvidedHook/Director/ImportSource.php(93): Icinga\Application\ApplicationBootstrap->Icinga\Application\{closure}(Integer, String, String, Integer, Array)
#1 /usr/share/icingaweb2/modules/netboximport/library/Netboximport/ProvidedHook/Director/ImportSource.php(167): Icinga\Module\Netboximport\ProvidedHook\Director\ImportSource->fetchInterfaces()
#2 /usr/share/icingaweb2/modules/director/library/Director/Web/Table/ImportsourceHookTable.php(109): Icinga\Module\Netboximport\ProvidedHook\Director\ImportSource->fetchData()
#3 /usr/share/icingaweb2/modules/director/library/vendor/ipl/Web/Table/SimpleQueryBasedTable.php(29): Icinga\Module\Director\Web\Table\ImportsourceHookTable->prepareQuery()
#4 /usr/share/icingaweb2/modules/director/library/vendor/ipl/Web/Table/SimpleQueryBasedTable.php(15): dipl\Web\Table\SimpleQueryBasedTable->getQuery()
#5 /usr/share/icingaweb2/modules/director/library/vendor/ipl/Web/Table/QueryBasedTable.php(56): dipl\Web\Table\SimpleQueryBasedTable->getPaginationAdapter()
#6 /usr/share/icingaweb2/modules/director/library/vendor/ipl/Web/Table/QueryBasedTable.php(237): dipl\Web\Table\QueryBasedTable->getPaginator(Object(dipl\Web\Url))
#7 /usr/share/icingaweb2/modules/director/application/controllers/ImportsourceController.php(74): dipl\Web\Table\QueryBasedTable->renderTo(Object(Icinga\Module\Director\Controllers\ImportsourceController))
#8 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Module\Director\Controllers\ImportsourceController->previewAction()
#9 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch(String)
#10 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#11 /usr/share/php/Icinga/Application/Web.php(409): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#12 /usr/share/php/Icinga/Application/webrouter.php(104): Icinga\Application\Web->dispatch()
#13 /usr/share/icingaweb2/public/index.php(4): require_once(String)
#14 {main}

Settings:
image

Missing License?

Hey guys,
we love this tool, and its super handy. We have cloned the repo privately and added some features and fixes we needed. Happy to contribute or fork or whatever, can you please let us know what license you want to use? Thanks for your work in creating it, it has really helped with a few projects.

FR: Add option to add filters to NetBox requests

Collection all the information in our current NetBox environment takes too long and runs into a timeout.

As Icinga might need different attributes from different devices I would propose to add a filter option to this module.

Appending a ?role=Server (as an example) to the request URL would be great. This limits the amount of returned data and we can change the imported data based on the device type.

A text field should be sufficient. The content should be added to the URL upon request.

Just putting this here as a reminder. Currently on Holidays but will try to give it a shot myself once I'm back. From what I've seen it should not be too difficult to implement.

Flattening causes Import failure because of Context Data

Expected Behavior

Import should work.

Current Behavior

If you try to import data from Netbox 2.4.7 it doesn't allow you to import because of the long names produced by the context_data in netbox like local_context_data__last_inform__port_table__3__mac_table__0__uptime.
The Director team doesn't want to increase the limit of the names for performance reasons and also because they think this module shouldn't flatten the data at all because the director supports structured data.

Possible Solution

A. Don't flatten the data
B. Dont expose the context_data to Icinga

I did try to disable the flattening in the module but this resulted in probably invalid JSON (see Icinga/icingaweb2-module-director#1711 (comment))

Steps to Reproduce (for bugs)

See Icinga/icingaweb2-module-director#1711

Your Environment

  • Icinga Web 2 Netboximport version (System - About): 1.0.0
  • Director version (System - About): master (e895978ff243c007a2a50a1c34ea54bd5ef59411)
  • Icinga Web 2 version and modules (System - About): 2.6.1, icingaweb2-module-netboximport
  • Netbox version (System - About): 2.4.7
  • Icinga 2 version (icinga2 --version): r2.9.2-1
  • Operating System and version: Ubuntu 16.04
  • Webserver, PHP versions: Apache (behind nginx reverse), PHP7.2

current version (dfd907928c309441b0307bf83bbc211b843d2b20) ends in a stacktrace

Trying to use this plugin with different versions of NetBox (2.8.3 and 2.9.3). Unfortunately it always ends in the same stack trace.

#0 /usr/share/icingaweb2/modules/netboximport/library/Netboximport/ProvidedHook/Director/ImportSource.php(138): Icinga\Application\ApplicationBootstrap->Icinga\Application\{closure}(Integer, String, String, Integer, Array)
#1 /usr/share/icingaweb2/modules/netboximport/library/Netboximport/ProvidedHook/Director/ImportSource.php(236): Icinga\Module\Netboximport\ProvidedHook\Director\ImportSource->fetchInterfaces()
#2 /usr/share/icingaweb2/modules/director/library/Director/Web/Table/ImportsourceHookTable.php(100): Icinga\Module\Netboximport\ProvidedHook\Director\ImportSource->fetchData()
#3 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Table/SimpleQueryBasedTable.php(29): Icinga\Module\Director\Web\Table\ImportsourceHookTable->prepareQuery()
#4 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Table/SimpleQueryBasedTable.php(15): gipfl\IcingaWeb2\Table\SimpleQueryBasedTable->getQuery()
#5 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Table/QueryBasedTable.php(56): gipfl\IcingaWeb2\Table\SimpleQueryBasedTable->getPaginationAdapter()
#6 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Table/QueryBasedTable.php(255): gipfl\IcingaWeb2\Table\QueryBasedTable->getPaginator(Object(gipfl\IcingaWeb2\Url))
#7 /usr/share/icingaweb2/modules/director/application/controllers/ImportsourceController.php(159): gipfl\IcingaWeb2\Table\QueryBasedTable->renderTo(Object(Icinga\Module\Director\Controllers\ImportsourceController))
#8 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Module\Director\Controllers\ImportsourceController->previewAction()
#9 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch(String)
#10 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#11 /usr/share/php/Icinga/Application/Web.php(300): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#12 /usr/share/php/Icinga/Application/webrouter.php(99): Icinga\Application\Web->dispatch()
#13 /usr/share/icingaweb2/public/index.php(4): require_once(String)
#14 {main}

Current settings:
image

Expected Behavior

Fetch the NetBox data successfully

Current Behavior

Fetching Data fails

Possible Solution

Steps to Reproduce (for bugs)

Can't really tell. Tried with different commits in this repo and the issue does not disappear.

Context

Your Environment

  • Icinga Web 2 Netboximport version (System - About): dfd9079 (current master)
  • Icinga Web 2 Director version (System - About): dfd9079 (current master)
  • Icinga Web 2 version and modules (System - About): 2.8.2
  • Netbox version (System - About): 2.8.3 and 2.9.3
  • Version used (icinga2 --version): 2.12.0-1
  • Operating System and version: CentOS 7.8.2003
  • Enabled features (icinga2 feature list):
  • Config validation (icinga2 daemon -C):

Thank You

Requesting unknown URL

For GET /api/virtualization/clusters/ HTTP/1.1 the result is

{ "count": 1, "next": null, "previous": null, "results": [ { "id": 4, "name": "Proxmox", "type": { "id": 7, "url": "http://x-aachen.de/api/virtualization/cluster-types/7/", "name": "Proxmox", "slug": "proxmox" }, "group": null, "site": { "id": 1, "url": "http://x-aachen.de/api/dcim/sites/1/", "name": "x-aachen.de", "slug": "kullen" }, "comments": "", "tags": [], "custom_fields": {}, "created": "2017-12-21", "last_updated": "2017-12-21T15:12:49.124749+01:00" } ]

See https://pastebin.com/nTdUsQeJ for correct layout.

and the Script requests

GET /api/virtualization/clusters/4?limit=1000000 HTTP/1.1

gets redirected (301) to (see #3)

GET /api/virtualization/clusters/4/?limit=1000000 HTTP/1.1

This request results in a 404 because the page doesn't exist

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.