Giter Club home page Giter Club logo

icingaweb2-module-netbox's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

icingaweb2-module-netbox's Issues

v3.1.16.5 release discussion

Release v3.1.16.5 is out.

It deals with Netbox IP Ranges which are turning out to be rather handy for handling zone allocation at scale.

I'm creating this issue as a place to discuss or ask questions related to using Netbox IP Ranges to automate zone allocation in Icinga or deployment of Satellites/Agents from Netbox using other tools like Ansible.

Add support for FHRP groups

We have a bunch of VIPs and would love to be able to import the FHRP groups as Hosts in Icinga. This would allow us to create Host objects, and then apply rules to monitor these vips as "virtual" hosts. Would be neat to be able then have custom vars which showed the "real" machines associated with the fhrp group.

Get tags from device in device properties as array

Hello,
Sorry yet another issue/feature request from me - is it possible to get the tags assigned to a device in the device properties - so we can use the tags later to assign certain services,

I note that tags do show up in the preview/JSON output of it like so:

        "tags__0__id": 46,
        "tags__0__url": "https://netbox/api/extras/tags/46/",
        "tags__0__display": "icinga:check_md3060e",
        "tags__0__name": "icinga:check_md3060e",
        "tags__0__slug": "icingacheck_md3060e",
        "tags__0__color": "9e9e9e",

but it would be useful to have the following as something like

"tags": ["icinga:check_md3060e"] 

as well or instead. Then it would be possible to use the list of tags as a way to specify checks I want via service apply rules,
Thanks!

Flatten seperator problems with platform=null in Netbox

I have set the "Flatten seperator" to "_" without a "Flatten keys" filter, because all objects are better to handle in Icinga director when they are flat.
For my Netbox data this works flawless for Virtual Maschines import, but not for Devices, especially for "platform" info. I found out that the difference is that not all my devices have a platform assigned so the platform_id=null.

In preview I see when there is a platform_keyid="nbplatform ", then the field "platform"="" (empty string). When platform_keyid=null then platform=null.

When I remove the flatten seperator and import the data. I see platform filled with JSON Object data, so he gets the data from Netbox correct.
When I add the Search filter "platform_id__n=null" (not empty filter), I get the fields platform_display, platform_id, platform_keyid, platform_name, platform_slug, platform_url. (But not a workaround, because I also need devices without platform)

So TL;DR when not all platforms in Netbox are assigned, it broke the flatten feature.

I also tried a different Flatten seperator, but that don't change anything. Also, I think this is not only for "platform" field, but I only test with this.
I use latest plugin version 3.6.1.1
Together with director 1.11.0, icingadb 1.1.1, icingaweb 2.12.1

Sync rule stuck in loop of creating / deleting vars

So... we a sync rule

Screenshot 2024-05-28 at 10 59 17 PM

It creates the object fine as expected, happy days.

Issue:

Subsequent syncs will remove vars.tags

image

If you sync once again director shows modifications, even though it doesn't show what changed ( perhaps a clue to root cause of the issue )

Screenshot 2024-05-28 at 10 53 31 PM

This loop continues indefinitely, every time the sync rule runs

Thank you for your contributions 🥇

Uncaught TypeError with Unamed devices

In Netbox it is possible to create a device without a name. In Netbox it will be shown as "Unnamed device".
But when I try to import devices with such a device I get the following error:

Uncaught TypeError: Argument 1 passed to Icinga\Module\Netbox\Netbox::keymaker() must be of the type string, null given, called in /usr/share/icingaweb2/modules/netbox/library/Netbox/Netbox.php on line 122 and defined in /usr/share/icingaweb2/modules/netbox/library/Netbox/Netbox.php:100
Stack trace:
#0 /usr/share/icingaweb2/modules/netbox/library/Netbox/Netbox.php(122): Icinga\Module\Netbox\Netbox->keymaker()
#1 /usr/share/icingaweb2/modules/netbox/library/Netbox/Netbox.php(266): Icinga\Module\Netbox\Netbox->makeHelperKeys()
#2 /usr/share/icingaweb2/modules/netbox/library/Netbox/Netbox.php(342): Icinga\Module\Netbox\Netbox->transform()
#3 /usr/share/icingaweb2/modules/netbox/library/Netbox/Netbox.php(415): Icinga\Module\Netbox\Netbox->get_netbox()
#4 /usr/share/icingaweb2/modules/netbox/library/Netbox/ProvidedHook/Director/ImportSource.php(305): Icinga\Module\Netbox\Netbox->devices()
#5 /usr/share/icingaweb2/modules/director/library/Director/Import/Import.php(168): Icinga\Module\Netbox\ProvidedHook\Director\I (Netbox.php:100)

#0 [internal function]: Icinga\Application\Web->Icinga\Application\{closure}()
#1 {main}

The problemetic line in "library/Netbox/Netbox.php":

if (property_exists($row, 'name')) {
  $row->keyid = $this->keymaker($row->name);
}

The property exists, but it is null.
Quote from PHP Help: As opposed with isset(), property_exists() returns true even if the property has the value null.

So I changed line 121 and 167 from "property_exists($row, 'name')" to isset($row->name) which fixed the preview. But there is still the problem that, the imported object don't have a name. So it can't sync to icinga, which needs a unique name. So maybe the best fix, would be to ignore this items, because without a hostname they are useless for network monitoring?
Possible with following line after 113 (foreach):
if (!(isset($row->name))) { continue; }

In my case it is a radio amplifier which does not have any ip / hostname / network port, but it uses rack space and so it have to be in Netbox. I don't need the device in Icinga, but the import should not fail because of this device.

Netbox v3.3.2
icingaweb2-module-netbox Version: [email protected] (v3.1.16.5)
Icinga Director: 1.9.1
Icinga: r2.13.5-1

Add Support for IP Ranges

We want to map IP Ranges custom fields to Icinga zones. Please add support into Importsource.php for IP Ranges. Possibly more problems to come after that, but lets start there.

servicedb out of Netbox library

separation of concerns. Consumers of the library can build up a cache of services and use that as they like. The library doesn't really need to hold state like this.

In this repo that means building a cache by calling $netbox->allservices(), then assigning to devices returned by $netbox->devices(0).
We use a cache because getting all services for all devices is a lot of API calls which is slow.

Add option to get primary_ip DNS name

We usually use the DNS name (FQDN) of the device as the name of the host in Icinga. This does not seem to be possible at the moment, because the DNS name is associated with IP addresses in NetBox. I could not figure out how to import DNS name information with this module.
It would be great if it could be added (or explained if it is already possible).

Convenience headings missing

Some datasets are missing the generated convenience headings even though some row would contain values.
eg: platform_keyid doesn't exist as a heading even though some rows contain a plaform.

Creation of dynamic properties deprecated in PHP 8.2

Using this plugin on a new Icinga server running Debian 12 and PHP 8.2 from the Debian repos.

Getting this error when going to Import Source, select an import source and then Preview.

Deprecated
: Creation of dynamic property Icinga\Module\Netbox\Netbox::$baseurl is deprecated in
/usr/share/icingaweb2/modules/netbox/library/Netbox/Netbox.php
on line
23

Deprecated
: Creation of dynamic property Icinga\Module\Netbox\Netbox::$token is deprecated in
/usr/share/icingaweb2/modules/netbox/library/Netbox/Netbox.php
on line
24

And lots more of that.

This is due to the creation of dynamic properties being deprecated in PHP 8.2.
https://www.php.net/manual/en/migration82.deprecated.php

This will become an error exception in PHP 9.0 and will get removed completely at some point in the future.

A hacky work around is to add the attribute

#[\AllowDynamicProperties]
directly above the Netbox class

// use Icinga\Module\Director\Daemon\Logger;
#[\AllowDynamicProperties]
class Netbox
{

That resolved the issue for me.

According to the PHP 8.2 documentation the long term solution is to declare all used properties in the class declaration.

Enabling module "netbox" although it has unmet dependencies

How do I find the unmet dependencies and resolve them?

<homedir># curl -L https://github.com/sol1/icingaweb2-module-netbox/archive/v2.10.3.5.tar.gz | tar xz
<homedir># mv icingaweb2-module-netbox-2.10.3.5 /usr/share/icingaweb2/modules/netbox
<homedir># icingacli module enable netbox
Enabling module "netbox" although it has unmet dependencies

Import platform issues

Hello
Seems to be an issue importing plaforms from netbox.
Looking through ImportSource.php it seems to miss some code for PlatformMode in function fetchData.
Sorry if I'm wrong......
Terje

Monitoring vhosts , defined as Services in NetBox

Hi there, great module !

In NetBox, I've defined a list of services assigned to their relevant device/vm
Screenshot 2023-04-13 at 10 43 40 am

From NetBox, I'm trying to import the virtual machines "services" object into icinga as an array to iterate through,

Screenshot 2023-04-13 at 10 01 34 am

This generates the following host vars, as an object, which my Service Apply Rule is unable to iterate through

Screenshot 2023-04-13 at 10 23 45 am

I'd like to iterate through the devices services, using a Service Apply Rule and also be able to access the "port" from the host.var

I've currently got it working by importing the ${service_names} object instead, which contains an array of just the names, which I am iterating through assigning just the http_address part, without being able to access port information.

I've tried a couple of modifiers, including Decode a JSON string but this does not work.

Do you have a better solution for this ? Am I barking up the wrong tree :O ?

Netbox integration is not working

Icinga2 version: 2.8.2
PHP version: 7.3.20
Netbox version: 2.8.9

Installed the plugin and then provided the all required info requested by netbox module as show in the screenshot.
msedge_2020-12-21_20-53-55

Added sync rules as shown in below screenshot.

msedge_2020-12-21_20-54-44

When i click on "Check for changes" or "Trigger import run", an error is shown after sometime as shown in below screenshot.
msedge_2020-12-21_20-53-27

Restarted system and icinga2 daemon. No luck.

Connecting to https url with a self-signed certificate

Hello,
I' trying to connect to my netbox instance using a a self signed certificate.

I'm getting the error:
This Import Source failed when last checked at 2022-09-19 16:15:47: get https://netbox.xxxx.com/api/ipam/services/?status=active&limit=1000: status 0 SSL: unable to obtain common name from peer certificate

After some googling I added
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); to line 29 of Netbox.php

But now i'm getting the following error:
This Import Source failed when last checked at 2022-09-19 16:18:29: get https://netbox.xxxxxxx.com/api/ipam/services/?status=active&limit=1000: status 403

Can anyone help me out ?
The token and API url are correct.

Best regards

Import only active objects

A feature in the Netbox PHP library to only import objects from Netbox with status "Active".
At HTTP request means adding url param "status=active"

At UI can be exposed as a checkbox when selecting the type of object to import. For example:

Type of object to import: Devices
Import only "Active"? : true/false

This will mean commit 7aa6cc0 (not actually done by my username but git username set on a server...) will be reverted

Ability to import racks

Hi,
It doesn't seem like this module currently supports importing racks from Netbox (but almost everything else). Is that something that would be possible to support please?

Thanks,
Will.

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.