netbox-inventory


Namenetbox-inventory JSON
Version 1.6.0 PyPI version JSON
download
home_pageNone
SummaryInventory asset management in NetBox
upload_time2024-04-18 14:53:25
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords netbox netbox-plugin inventory
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # NetBox Inventory Plugin

A [Netbox](https://github.com/netbox-community/netbox) plugin for hardware inventory.

## Features

Keep track of your hardware, whether it is installed or in storage. You can
define assets that represent hardware that can be used as a device, module or
inventory item in NetBox.

Each asset can have a storage location defined, when not in use. You can assign
an asset to a device, module or inventory item. The plugin can keep serial number
and asset tag between asset and device, module or inventory item in sync if
enabled in settings.

On Site and Location detail views there is a new tab Assets that can show assets
that are stored or installed at that location or both. Rack details view also has
a tab for installed Assets. This provides a unified view of all assets at a given
location.

To properly support inventory items (that are used in NetBox to model SFP and
similar modules) the plugin defines inventory item types that are equivalent to
device types and module types. 

Inventory item types can be assigned into inventory item groups. On a group detail
view you have an overview of the number of contained assets broken down by asset
status or inventory item type and status. This way you can quickly see how many
of a certain type of hardware you still have spare.

Inventory item groups can be nested, so you can for example model all pluggables
as one top-level group with child groups for SFP+ modules, SFP28 modules and so
on.

### Automatic management of asset status

Each asset has a status attribute that can indicate use of the asset. These
statuses can be set as needed by each NetBox installation.

Two statuses can have a special meaning. One to indicate asset is in storage and one
to indicate asset is in use.

netbox_inventory can automatically set status to the value specified in
`used_status_name` configuration item when an asset is assigned to a device, module
or inventory item.

When you remove an asset from device, module or inventory item the plugin will set
asset status to `stored_status_name` configuration item.

To disable automatically changing status, set these two config parameters to `None`.

### Prevent unwanted changes for tagged assets

With `asset_disable_editing_fields_for_tags` and `asset_disable_deletion_for_tags` you can prevent changes to specified asset data for assets that have certain tags attached. Changes are only prevented via web interface. API modifications are allowed.

The idea is that an external system uses some assets stored in netbox_inventory, and you want to prevent accidental changes to data directly in NetBox web interface. Only that external system should modify the data.

## Compatibility

This plugin requires netbox version 3.7.x to work. Older versions of the plugin
support older netbox version as per table below:

| NetBox Version | Plugin Version |
|----------------|----------------|
|       3.3      |      1.1.x     |
|       3.4      |      1.2.x     |
|       3.5      | 1.3.x & 1.4.x  |
|       3.6      |      1.5.x     |
|       3.7      |      1.6.x     |

## Installing

Review [official Netbox plugin documentation](https://docs.netbox.dev/en/stable/plugins/#installing-plugins) for installation instructions.

You install the plugin from pypi with pip. Make sure you activate Netbox's virtual
environment first:

```bash
$ source /opt/netbox/venv/bin/activate
(venv) $ pip install netbox-inventory
```

For adding to a NetBox Docker setup see
[the general instructions for using netbox-docker with plugins](https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins).

You can install a development version directly from GitHub:

```bash
pip install https://github.com/ArnesSI/netbox-inventory/archive/master.tar.gz
```

or by adding to your `local_requirements.txt` or `plugin_requirements.txt` (netbox-docker):

```bash
https://github.com/ArnesSI/netbox-inventory/archive/master.tar.gz
```

After installation, enable the plugin in `/opt/netbox/netbox/netbox/configuration.py`,
 or if you use netbox-docker, your `/configuration/plugins.py` file :

```python
PLUGINS = [
    'netbox_inventory'
]

PLUGINS_CONFIG = {
    "netbox_inventory": {},
}
```

Available configuration settings you can use in `PLUGINS_CONFIG` are described
below under [settings](#settings).

The last step is to apply database migrations and update netbox search index:

```bash
(venv) $ cd /opt/netbox/netbox/
(venv) $ python3 manage.py migrate
(venv) $ python3 manage.py reindex --lazy
```

If you're running under netbox-docker, you can skip this as migrations and index updates are applied if needed automatically when you bring up the containers.

### Settings

If you want to override the defaults for the plugin, you can do so in your via `/opt/netbox/netbox/netbox/configuration.py`,
 or if you use netbox-docker, your `/configuration/plugins.py` file :

```python
PLUGINS = [
    'netbox_inventory'
]

PLUGINS_CONFIG = {
    "netbox_inventory": {
        # Example settings below, see "Available settings"
        # in README.md for all possible settings
        "used_status_name": "used",
        "stored_status_name": "stored",
        "sync_hardware_serial_asset_tag": True,
    },
}
```

#### Available settings

| Setting | Default value | Description |
|---------|---------------|-------------|
| `top_level_menu` | `True`| Add netbox-inventory to the top level of netbox navigation menu under Inventory heading. If set to False the plugin will add a menu item under the Plugins menu item. This setting is only valid under netbox v3.4 and newer.
| `used_status_name` | `'used'`| Status that indicates asset is in use. See "Automatic management of asset status" below for more info on this setting.
| `stored_status_name` | `'stored'`| Status that indicates asset is in storage. See "Automatic management of asset status" below for more info on this setting.
| `sync_hardware_serial_asset_tag` | `False` | When an asset is assigned or unassigned to a device, module or inventory item, update its serial number and asset tag to be in sync with the asset? |
| `asset_import_create_purchase` | `False` | When importing assets, automatically create any given purchase, delivery or supplier if it doesn't exist already |
| `asset_import_create_device_type` | `False` | When importing a device type asset, automatically create manufacturer and/or device type if it doesn't exist |
| `asset_import_create_module_type` | `False` | When importing a module type asset, automatically create manufacturer and/or device type if it doesn't exist |
| `asset_import_create_inventoryitem_type` | `False` | When importing an inventory type asset, automatically create manufacturer and/or device type if it doesn't exist |
| `asset_import_create_tenant` | `False` | When importing an asset, with owner or tenant, automatically create tenant if it doesn't exist |
| `asset_disable_editing_fields_for_tags` | `{}` | A dictionary of tags and fields that should be disabled for editing. This is useful if you want to prevent editing of certain fields for certain assets. The dictionary is in the form of `{tag: [field1, field2]}`. Example: `{'no-edit': ['serial_number', 'asset_tag']}`. This only affects the UI, the API can still be used to edit the fields. |
| `asset_disable_deletion_for_tags` | `[]` | List of tags that will disable deletion of assets. This only affects the UI, not the API. |
| `asset_custom_fields_search_filters` | `{}` | A dictionary of custom fields and lookup types that will be added to the search filters for assets. The dictionary is in the form of `{field: [lookup_type]}`. Example: `{'asset_mac': ['icontains', 'exact']}`. |
| `asset_warranty_expire_warning_days` | `90` | Days from warranty expiration to show as warning in Warranty remaining field |
| `prefill_asset_name_create_inventoryitem` | `False` | When hardware inventory item is created from an asset, prefill the InventoryItem name to match the asset name. |
| `prefill_asset_tag_create_inventoryitem` | `False` | When hardware inventory item is created from an asset, prefill the tags to match the tags associated to the asset. |

You can extend or define your own status choices for Asset, via [`FIELD_CHOICES`](https://docs.netbox.dev/en/stable/configuration/data-validation/#field_choices) setting in Netbox:

```
FIELD_CHOICES = {
    'netbox_inventory.Asset.status+': (
        ('repair', 'In repair', 'orange'),
    ),
}
```

## Models

Current plugin data model:

![Working Model](docs/img/data_model.drawio.png)

## Screenshots

Asset - List View

![Asset - List View](docs/img/asset_list.png)

Asset - Individual View

![Asset - Individual View](docs/img/asset.png)

Asset - Edit / Add View

![Asset - Edit / Add View](docs/img/asset_edit.png)

Asset - Lots of filtering options

![Asset - Filters](docs/img/asset_filters.png)

Suppliers - Individual View

![Asset - Individual View](docs/img/supplier.png)

Inventory Item Type - List View

![Asset - List View](docs/img/inventoryitem_type_list.png)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "netbox-inventory",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "netbox, netbox-plugin, inventory",
    "author": null,
    "author_email": "Matej Vadnjal <matej.vadnjal@arnes.si>",
    "download_url": "https://files.pythonhosted.org/packages/56/2e/84c1d9ebb2ae8715d9e63bea0c827a65f2a0bcea1687aa3f2367979b58a1/netbox_inventory-1.6.0.tar.gz",
    "platform": null,
    "description": "# NetBox Inventory Plugin\n\nA [Netbox](https://github.com/netbox-community/netbox) plugin for hardware inventory.\n\n## Features\n\nKeep track of your hardware, whether it is installed or in storage. You can\ndefine assets that represent hardware that can be used as a device, module or\ninventory item in NetBox.\n\nEach asset can have a storage location defined, when not in use. You can assign\nan asset to a device, module or inventory item. The plugin can keep serial number\nand asset tag between asset and device, module or inventory item in sync if\nenabled in settings.\n\nOn Site and Location detail views there is a new tab Assets that can show assets\nthat are stored or installed at that location or both. Rack details view also has\na tab for installed Assets. This provides a unified view of all assets at a given\nlocation.\n\nTo properly support inventory items (that are used in NetBox to model SFP and\nsimilar modules) the plugin defines inventory item types that are equivalent to\ndevice types and module types. \n\nInventory item types can be assigned into inventory item groups. On a group detail\nview you have an overview of the number of contained assets broken down by asset\nstatus or inventory item type and status. This way you can quickly see how many\nof a certain type of hardware you still have spare.\n\nInventory item groups can be nested, so you can for example model all pluggables\nas one top-level group with child groups for SFP+ modules, SFP28 modules and so\non.\n\n### Automatic management of asset status\n\nEach asset has a status attribute that can indicate use of the asset. These\nstatuses can be set as needed by each NetBox installation.\n\nTwo statuses can have a special meaning. One to indicate asset is in storage and one\nto indicate asset is in use.\n\nnetbox_inventory can automatically set status to the value specified in\n`used_status_name` configuration item when an asset is assigned to a device, module\nor inventory item.\n\nWhen you remove an asset from device, module or inventory item the plugin will set\nasset status to `stored_status_name` configuration item.\n\nTo disable automatically changing status, set these two config parameters to `None`.\n\n### Prevent unwanted changes for tagged assets\n\nWith `asset_disable_editing_fields_for_tags` and `asset_disable_deletion_for_tags` you can prevent changes to specified asset data for assets that have certain tags attached. Changes are only prevented via web interface. API modifications are allowed.\n\nThe idea is that an external system uses some assets stored in netbox_inventory, and you want to prevent accidental changes to data directly in NetBox web interface. Only that external system should modify the data.\n\n## Compatibility\n\nThis plugin requires netbox version 3.7.x to work. Older versions of the plugin\nsupport older netbox version as per table below:\n\n| NetBox Version | Plugin Version |\n|----------------|----------------|\n|       3.3      |      1.1.x     |\n|       3.4      |      1.2.x     |\n|       3.5      | 1.3.x & 1.4.x  |\n|       3.6      |      1.5.x     |\n|       3.7      |      1.6.x     |\n\n## Installing\n\nReview [official Netbox plugin documentation](https://docs.netbox.dev/en/stable/plugins/#installing-plugins) for installation instructions.\n\nYou install the plugin from pypi with pip. Make sure you activate Netbox's virtual\nenvironment first:\n\n```bash\n$ source /opt/netbox/venv/bin/activate\n(venv) $ pip install netbox-inventory\n```\n\nFor adding to a NetBox Docker setup see\n[the general instructions for using netbox-docker with plugins](https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins).\n\nYou can install a development version directly from GitHub:\n\n```bash\npip install https://github.com/ArnesSI/netbox-inventory/archive/master.tar.gz\n```\n\nor by adding to your `local_requirements.txt` or `plugin_requirements.txt` (netbox-docker):\n\n```bash\nhttps://github.com/ArnesSI/netbox-inventory/archive/master.tar.gz\n```\n\nAfter installation, enable the plugin in `/opt/netbox/netbox/netbox/configuration.py`,\n or if you use netbox-docker, your `/configuration/plugins.py` file :\n\n```python\nPLUGINS = [\n    'netbox_inventory'\n]\n\nPLUGINS_CONFIG = {\n    \"netbox_inventory\": {},\n}\n```\n\nAvailable configuration settings you can use in `PLUGINS_CONFIG` are described\nbelow under [settings](#settings).\n\nThe last step is to apply database migrations and update netbox search index:\n\n```bash\n(venv) $ cd /opt/netbox/netbox/\n(venv) $ python3 manage.py migrate\n(venv) $ python3 manage.py reindex --lazy\n```\n\nIf you're running under netbox-docker, you can skip this as migrations and index updates are applied if needed automatically when you bring up the containers.\n\n### Settings\n\nIf you want to override the defaults for the plugin, you can do so in your via `/opt/netbox/netbox/netbox/configuration.py`,\n or if you use netbox-docker, your `/configuration/plugins.py` file :\n\n```python\nPLUGINS = [\n    'netbox_inventory'\n]\n\nPLUGINS_CONFIG = {\n    \"netbox_inventory\": {\n        # Example settings below, see \"Available settings\"\n        # in README.md for all possible settings\n        \"used_status_name\": \"used\",\n        \"stored_status_name\": \"stored\",\n        \"sync_hardware_serial_asset_tag\": True,\n    },\n}\n```\n\n#### Available settings\n\n| Setting | Default value | Description |\n|---------|---------------|-------------|\n| `top_level_menu` | `True`| Add netbox-inventory to the top level of netbox navigation menu under Inventory heading. If set to False the plugin will add a menu item under the Plugins menu item. This setting is only valid under netbox v3.4 and newer.\n| `used_status_name` | `'used'`| Status that indicates asset is in use. See \"Automatic management of asset status\" below for more info on this setting.\n| `stored_status_name` | `'stored'`| Status that indicates asset is in storage. See \"Automatic management of asset status\" below for more info on this setting.\n| `sync_hardware_serial_asset_tag` | `False` | When an asset is assigned or unassigned to a device, module or inventory item, update its serial number and asset tag to be in sync with the asset? |\n| `asset_import_create_purchase` | `False` | When importing assets, automatically create any given purchase, delivery or supplier if it doesn't exist already |\n| `asset_import_create_device_type` | `False` | When importing a device type asset, automatically create manufacturer and/or device type if it doesn't exist |\n| `asset_import_create_module_type` | `False` | When importing a module type asset, automatically create manufacturer and/or device type if it doesn't exist |\n| `asset_import_create_inventoryitem_type` | `False` | When importing an inventory type asset, automatically create manufacturer and/or device type if it doesn't exist |\n| `asset_import_create_tenant` | `False` | When importing an asset, with owner or tenant, automatically create tenant if it doesn't exist |\n| `asset_disable_editing_fields_for_tags` | `{}` | A dictionary of tags and fields that should be disabled for editing. This is useful if you want to prevent editing of certain fields for certain assets. The dictionary is in the form of `{tag: [field1, field2]}`. Example: `{'no-edit': ['serial_number', 'asset_tag']}`. This only affects the UI, the API can still be used to edit the fields. |\n| `asset_disable_deletion_for_tags` | `[]` | List of tags that will disable deletion of assets. This only affects the UI, not the API. |\n| `asset_custom_fields_search_filters` | `{}` | A dictionary of custom fields and lookup types that will be added to the search filters for assets. The dictionary is in the form of `{field: [lookup_type]}`. Example: `{'asset_mac': ['icontains', 'exact']}`. |\n| `asset_warranty_expire_warning_days` | `90` | Days from warranty expiration to show as warning in Warranty remaining field |\n| `prefill_asset_name_create_inventoryitem` | `False` | When hardware inventory item is created from an asset, prefill the InventoryItem name to match the asset name. |\n| `prefill_asset_tag_create_inventoryitem` | `False` | When hardware inventory item is created from an asset, prefill the tags to match the tags associated to the asset. |\n\nYou can extend or define your own status choices for Asset, via [`FIELD_CHOICES`](https://docs.netbox.dev/en/stable/configuration/data-validation/#field_choices) setting in Netbox:\n\n```\nFIELD_CHOICES = {\n    'netbox_inventory.Asset.status+': (\n        ('repair', 'In repair', 'orange'),\n    ),\n}\n```\n\n## Models\n\nCurrent plugin data model:\n\n![Working Model](docs/img/data_model.drawio.png)\n\n## Screenshots\n\nAsset - List View\n\n![Asset - List View](docs/img/asset_list.png)\n\nAsset - Individual View\n\n![Asset - Individual View](docs/img/asset.png)\n\nAsset - Edit / Add View\n\n![Asset - Edit / Add View](docs/img/asset_edit.png)\n\nAsset - Lots of filtering options\n\n![Asset - Filters](docs/img/asset_filters.png)\n\nSuppliers - Individual View\n\n![Asset - Individual View](docs/img/supplier.png)\n\nInventory Item Type - List View\n\n![Asset - List View](docs/img/inventoryitem_type_list.png)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Inventory asset management in NetBox",
    "version": "1.6.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/ArnesSI/netbox-inventory/issues/",
        "Homepage": "https://github.com/ArnesSI/netbox-inventory/"
    },
    "split_keywords": [
        "netbox",
        " netbox-plugin",
        " inventory"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b2d0a0de20700e2f0fead7694b2eb4239b49ff2bc65f1fd38983fbb7210ef6ed",
                "md5": "42cd7854a9dbdf6071802d955d475bf8",
                "sha256": "7a803e1751286de35268431cf6d64c7b2a3833a01e69d3eca6da4bce2ee57da8"
            },
            "downloads": -1,
            "filename": "netbox_inventory-1.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "42cd7854a9dbdf6071802d955d475bf8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 92615,
            "upload_time": "2024-04-18T14:53:23",
            "upload_time_iso_8601": "2024-04-18T14:53:23.777034Z",
            "url": "https://files.pythonhosted.org/packages/b2/d0/a0de20700e2f0fead7694b2eb4239b49ff2bc65f1fd38983fbb7210ef6ed/netbox_inventory-1.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "562e84c1d9ebb2ae8715d9e63bea0c827a65f2a0bcea1687aa3f2367979b58a1",
                "md5": "a34b6367852574721c20f9fa73a1b2ed",
                "sha256": "8b82bba8948574b36c9f28014a48fd02605690db16a33ed02baf34e76a12e3fe"
            },
            "downloads": -1,
            "filename": "netbox_inventory-1.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a34b6367852574721c20f9fa73a1b2ed",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 60434,
            "upload_time": "2024-04-18T14:53:25",
            "upload_time_iso_8601": "2024-04-18T14:53:25.500828Z",
            "url": "https://files.pythonhosted.org/packages/56/2e/84c1d9ebb2ae8715d9e63bea0c827a65f2a0bcea1687aa3f2367979b58a1/netbox_inventory-1.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-18 14:53:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ArnesSI",
    "github_project": "netbox-inventory",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "netbox-inventory"
}
        
Elapsed time: 0.87073s