meraki-netbox-plugin-pdu


Namemeraki-netbox-plugin-pdu JSON
Version 0.0.10 PyPI version JSON
download
home_pagehttps://github.com/minitriga/axians-netbox-plugin-pdu
SummaryA plugin for NetBox to easily display PDU information.
upload_time2023-06-09 20:41:27
maintainer
docs_urlNone
authorAlex Houlton
requires_python>=3.6,<4.0
licenseApache-2.0
keywords netbox network pdu django apc
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Netbox PDU Plugin

A plugin for [Netbox](https://github.com/netbox-community/netbox) to get power distribution unit Information.

`axians-netbox-plugin-pdu` is using [Easy SNMP](https://easysnmp.readthedocs.io/en/latest/), [Django-RQ](https://github.com/rq/django-rq) and [RQ-Scheduler](https://github.com/rq/rq-scheduler) to display PDU information within Netbox.

## Installation
The plugin is available as a Python package in pypi and can be installed with pip

```
pip install axians-netbox-plugin-pdu
```

> The plugin is compatible with NetBox 2.9.1 and higher

Once installed, the plugin needs to be enabled in your `configuration.py`

```python
PLUGINS = ["axians_netbox_pdu"]

# PLUGINS_CONFIG = {
#   "axians_netbox_pdu": {
#     ADD YOUR SETTINGS HERE
#   }
# }
```

There are a number of default settings that can be altered using the following list of settings:

* `schedule`: Boolean (default True). If True, this will enable automatic polling of your PDU Devices.
* `schedule_interval`: Integer (default 300 seconds). Length of time between each scheduled poll.
* `snmp_read`: String (default public) SNMP read value for your SNMP enabled PDU's.
* `snmp_write`: String (default private) SNMP write value for your SNMP enabled PDU's.
* `rack_view_pdu_devices`: Boolean (default True), if True, the power usage per PDU will be displayed on the rack page.
* `rack_view_usage_summary`: Boolean (default True), if True, the a summary information tile will appear within the rack page to show true power utilization within the rack.
* `rack_view_summary_unit`: String (default watts), option to display watts/kilowatts on the rack summary view. If "kilowatts" is used the power usage summary will display in Kilowatts.

## Usage
### Preparation
For this plugin to work there must be a new worker added to your Netbox installation. The new worker is a custom scheduler that will schedule the PDU Tasks to run on an interval and utilize the django-rq library.

> You can utilize this library without the automated tasks by feeding Netbox the power usage information via the `axians_netbox_pdu` API.

### Default Environment
For the standard install please use the included [netbox-pdu.service](contrib/netbox-pdu.service) and install using the standard [Netbox Documentation](https://netbox.readthedocs.io/en/stable/installation/migrating-to-systemd/).

### Docker Environment
To use within Docker make sure you have a container running that runs the following command: `python manage.py pduschedule`

### Adding a new PDU Configuration
Once installed and the `pduscheduler` is running you can attach a `PDUConfig` to a DeviceType. To do this you must have a DeviceType configured with PowerOutlets. You can specify the DeviceType, PDU SNMP OID and the Unit. This enables the plugin to know what SNMP OID to collect per DeviceType.

Now a PDUConfig has been created a device must be created with a management IP. Once this is done the plugin can poll the PDU via SNMP and save the power usage.

This can also be done via Bulk Import or via the API.

> If a a PDUConfig is not created for a DeviceType and the Device does not have a Primary IP no data will be collected.

### API
The plugin includes several endpoints to manage the PDUConfig and PDUStatus.

```
GET       /api/plugins/pdu/pdu-config/         List PDUConfig
POST      /api/plugins/pdu/pdu-config/         Create PDUConfig
PATCH/PUT /api/plugins/pdu/pdu-config/{id}/    Edit a specific PDUConfig
DELETE /api/plugins/pdu/pdu-config/{id}/       Delete a specific PDUConfig

GET       /api/plugins/pdu/pdu-status/         List PDUStatus
POST      /api/plugins/pdu/pdu-status/         Create PDUStatus
PATCH/PUT /api/plugins/pdu/pdu-status/{id}/    Edit a specific PDUStatus
DELETE /api/plugins/pdu/pdu-status/{id}/       Delete a specific PDUStatus
```

## Screen Shots
List of PDUConfig Instances
![PDUConfig List View](docs/images/PDUConfig_list.png)

Import PDUConfig Instances
![PDUConfig Import View](docs/images/PDUConfig_import.png)

Edit PDUConfig Instances
![PDUConfig Edit View](docs/images/PDUConfig_edit.png)

View PDUStatus Device View
![PDUStatus Device View](docs/images/PDUStatus_device.png)

View PDUStatus Rack View
![PDUStatus Rack View](docs/images/PDUStatus_rack.png)

## Contributing

Pull requests are welcomed.

The project is packaged with a light development environment based on `docker-compose` to help with the local development of the project.

- Black, Pylint, Bandit and pydockstyle for Python linting and formatting.
- Django unit test to ensure the plugin is working properly.

### CLI Helper Commands

The project comes with a CLI helper based on [invoke](http://www.pyinvoke.org/) to help setup the development environment. The commands are listed below in 3 categories `dev environment`, `utility` and `testing`.

Each command can be executed with `invoke <command>`. All commands support the arguments `--netbox-ver` and `--python-ver` if you want to manually define the version of Python and Netbox to use. Each command also has its own help `invoke <command> --help`.

#### Local dev environment
```
  build            Build all docker images.
  debug            Start NetBox and its dependencies in debug mode.
  destroy          Destroy all containers and volumes.
  start            Start NetBox and its dependencies in detached mode.
  stop             Stop NetBox and its dependencies.
```


#### Utility
```
  cli              Launch a bash shell inside the running NetBox container.
  create-user      Create a new user in django (default: admin), will prompt for password.
  makemigrations   Run Make Migration in Django.
  nbshell          Launch a nbshell session.
```
#### Testing

```
  tests            Run all tests for this plugin.
  pylint           Run pylint code analysis.
  pydocstyle       Run pydocstyle to validate docstring formatting adheres to NTC defined standards.
  bandit           Run bandit to validate basic static code security analysis.
  black            Run black to check that Python files adhere to its style standards.
  unittest         Run Django unit tests for the plugin.
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/minitriga/axians-netbox-plugin-pdu",
    "name": "meraki-netbox-plugin-pdu",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6,<4.0",
    "maintainer_email": "",
    "keywords": "netbox,network,pdu,django,apc",
    "author": "Alex Houlton",
    "author_email": "bob@meraki.com",
    "download_url": "https://files.pythonhosted.org/packages/1f/f9/93640b3128c012221c1aaa6f61c844f6e1e120151d2e560d4a0100552e99/meraki_netbox_plugin_pdu-0.0.10.tar.gz",
    "platform": null,
    "description": "# Netbox PDU Plugin\n\nA plugin for [Netbox](https://github.com/netbox-community/netbox) to get power distribution unit Information.\n\n`axians-netbox-plugin-pdu` is using [Easy SNMP](https://easysnmp.readthedocs.io/en/latest/), [Django-RQ](https://github.com/rq/django-rq) and [RQ-Scheduler](https://github.com/rq/rq-scheduler) to display PDU information within Netbox.\n\n## Installation\nThe plugin is available as a Python package in pypi and can be installed with pip\n\n```\npip install axians-netbox-plugin-pdu\n```\n\n> The plugin is compatible with NetBox 2.9.1 and higher\n\nOnce installed, the plugin needs to be enabled in your `configuration.py`\n\n```python\nPLUGINS = [\"axians_netbox_pdu\"]\n\n# PLUGINS_CONFIG = {\n#   \"axians_netbox_pdu\": {\n#     ADD YOUR SETTINGS HERE\n#   }\n# }\n```\n\nThere are a number of default settings that can be altered using the following list of settings:\n\n* `schedule`: Boolean (default True). If True, this will enable automatic polling of your PDU Devices.\n* `schedule_interval`: Integer (default 300 seconds). Length of time between each scheduled poll.\n* `snmp_read`: String (default public) SNMP read value for your SNMP enabled PDU's.\n* `snmp_write`: String (default private) SNMP write value for your SNMP enabled PDU's.\n* `rack_view_pdu_devices`: Boolean (default True), if True, the power usage per PDU will be displayed on the rack page.\n* `rack_view_usage_summary`: Boolean (default True), if True, the a summary information tile will appear within the rack page to show true power utilization within the rack.\n* `rack_view_summary_unit`: String (default watts), option to display watts/kilowatts on the rack summary view. If \"kilowatts\" is used the power usage summary will display in Kilowatts.\n\n## Usage\n### Preparation\nFor this plugin to work there must be a new worker added to your Netbox installation. The new worker is a custom scheduler that will schedule the PDU Tasks to run on an interval and utilize the django-rq library.\n\n> You can utilize this library without the automated tasks by feeding Netbox the power usage information via the `axians_netbox_pdu` API.\n\n### Default Environment\nFor the standard install please use the included [netbox-pdu.service](contrib/netbox-pdu.service) and install using the standard [Netbox Documentation](https://netbox.readthedocs.io/en/stable/installation/migrating-to-systemd/).\n\n### Docker Environment\nTo use within Docker make sure you have a container running that runs the following command: `python manage.py pduschedule`\n\n### Adding a new PDU Configuration\nOnce installed and the `pduscheduler` is running you can attach a `PDUConfig` to a DeviceType. To do this you must have a DeviceType configured with PowerOutlets. You can specify the DeviceType, PDU SNMP OID and the Unit. This enables the plugin to know what SNMP OID to collect per DeviceType.\n\nNow a PDUConfig has been created a device must be created with a management IP. Once this is done the plugin can poll the PDU via SNMP and save the power usage.\n\nThis can also be done via Bulk Import or via the API.\n\n> If a a PDUConfig is not created for a DeviceType and the Device does not have a Primary IP no data will be collected.\n\n### API\nThe plugin includes several endpoints to manage the PDUConfig and PDUStatus.\n\n```\nGET       /api/plugins/pdu/pdu-config/         List PDUConfig\nPOST      /api/plugins/pdu/pdu-config/         Create PDUConfig\nPATCH/PUT /api/plugins/pdu/pdu-config/{id}/    Edit a specific PDUConfig\nDELETE /api/plugins/pdu/pdu-config/{id}/       Delete a specific PDUConfig\n\nGET       /api/plugins/pdu/pdu-status/         List PDUStatus\nPOST      /api/plugins/pdu/pdu-status/         Create PDUStatus\nPATCH/PUT /api/plugins/pdu/pdu-status/{id}/    Edit a specific PDUStatus\nDELETE /api/plugins/pdu/pdu-status/{id}/       Delete a specific PDUStatus\n```\n\n## Screen Shots\nList of PDUConfig Instances\n![PDUConfig List View](docs/images/PDUConfig_list.png)\n\nImport PDUConfig Instances\n![PDUConfig Import View](docs/images/PDUConfig_import.png)\n\nEdit PDUConfig Instances\n![PDUConfig Edit View](docs/images/PDUConfig_edit.png)\n\nView PDUStatus Device View\n![PDUStatus Device View](docs/images/PDUStatus_device.png)\n\nView PDUStatus Rack View\n![PDUStatus Rack View](docs/images/PDUStatus_rack.png)\n\n## Contributing\n\nPull requests are welcomed.\n\nThe project is packaged with a light development environment based on `docker-compose` to help with the local development of the project.\n\n- Black, Pylint, Bandit and pydockstyle for Python linting and formatting.\n- Django unit test to ensure the plugin is working properly.\n\n### CLI Helper Commands\n\nThe project comes with a CLI helper based on [invoke](http://www.pyinvoke.org/) to help setup the development environment. The commands are listed below in 3 categories `dev environment`, `utility` and `testing`.\n\nEach command can be executed with `invoke <command>`. All commands support the arguments `--netbox-ver` and `--python-ver` if you want to manually define the version of Python and Netbox to use. Each command also has its own help `invoke <command> --help`.\n\n#### Local dev environment\n```\n  build            Build all docker images.\n  debug            Start NetBox and its dependencies in debug mode.\n  destroy          Destroy all containers and volumes.\n  start            Start NetBox and its dependencies in detached mode.\n  stop             Stop NetBox and its dependencies.\n```\n\n\n#### Utility\n```\n  cli              Launch a bash shell inside the running NetBox container.\n  create-user      Create a new user in django (default: admin), will prompt for password.\n  makemigrations   Run Make Migration in Django.\n  nbshell          Launch a nbshell session.\n```\n#### Testing\n\n```\n  tests            Run all tests for this plugin.\n  pylint           Run pylint code analysis.\n  pydocstyle       Run pydocstyle to validate docstring formatting adheres to NTC defined standards.\n  bandit           Run bandit to validate basic static code security analysis.\n  black            Run black to check that Python files adhere to its style standards.\n  unittest         Run Django unit tests for the plugin.\n```\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A plugin for NetBox to easily display PDU information.",
    "version": "0.0.10",
    "project_urls": {
        "Homepage": "https://github.com/minitriga/axians-netbox-plugin-pdu",
        "Repository": "https://github.com/minitriga/axians-netbox-plugin-pdu"
    },
    "split_keywords": [
        "netbox",
        "network",
        "pdu",
        "django",
        "apc"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6bf6c1e3a1de5b2bacb1bbe1af6464a957582e2c92fed8d94184c5244f3d5d1b",
                "md5": "2f9fc19af5a3c0abf932970a4ab5aeb3",
                "sha256": "f472502bf6e1000fbb645dcce731bebeb7323630971fb2f45e978f6300956d3c"
            },
            "downloads": -1,
            "filename": "meraki_netbox_plugin_pdu-0.0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2f9fc19af5a3c0abf932970a4ab5aeb3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6,<4.0",
            "size": 27920,
            "upload_time": "2023-06-09T20:41:25",
            "upload_time_iso_8601": "2023-06-09T20:41:25.721231Z",
            "url": "https://files.pythonhosted.org/packages/6b/f6/c1e3a1de5b2bacb1bbe1af6464a957582e2c92fed8d94184c5244f3d5d1b/meraki_netbox_plugin_pdu-0.0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1ff993640b3128c012221c1aaa6f61c844f6e1e120151d2e560d4a0100552e99",
                "md5": "77e48df208d75fdd1008ea18d02bf6a6",
                "sha256": "6e9aa4af5fc96d3a71a074c85e3609d6400f316f142c77500b9401c7925f533d"
            },
            "downloads": -1,
            "filename": "meraki_netbox_plugin_pdu-0.0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "77e48df208d75fdd1008ea18d02bf6a6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6,<4.0",
            "size": 17139,
            "upload_time": "2023-06-09T20:41:27",
            "upload_time_iso_8601": "2023-06-09T20:41:27.368107Z",
            "url": "https://files.pythonhosted.org/packages/1f/f9/93640b3128c012221c1aaa6f61c844f6e1e120151d2e560d4a0100552e99/meraki_netbox_plugin_pdu-0.0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-09 20:41:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "minitriga",
    "github_project": "axians-netbox-plugin-pdu",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "meraki-netbox-plugin-pdu"
}
        
Elapsed time: 0.18790s