Skip to content

Commit 1a7e5d9

Browse files
authored
Merge branch 'master' into issue_7_edit
2 parents 6ee34c4 + f26a5a7 commit 1a7e5d9

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

README.md

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,15 @@ def metric_prefix_utilization():
6060
The new function can be imported in the `configuration.py` file and registered with the plugin.
6161
```python
6262
# configuration.py
63-
from .metrics import metric_prefix_utilization
63+
from netbox.metrics import metric_prefix_utilization
6464
PLUGINS_CONFIG = {
65-
"netbox_app_metrics": {
65+
"netbox_metrics_ext": {
66+
"app_metrics": {
6667
"extras": [
67-
metric_prefix_utilization
68+
metric_prefix_utilization
6869
]
70+
}
71+
}
6972
},
7073
```
7174

@@ -76,8 +79,8 @@ Third party plugins can register their own function(s) using the `ready()` funct
7679

7780
```python
7881
# my_plugin/__init__.py
79-
from netbox_app_metrics import register_metric_func
80-
from .metrics import metric_circuit_bandwidth
82+
from netbox_metrics_ext import register_metric_func
83+
from netbox.metrics import metric_circuit_bandwidth
8184

8285
class MyPluginConfig(PluginConfig):
8386
name = "netbox_myplugin"
@@ -96,11 +99,11 @@ In the future it will be possible to add metrics by adding them in a predefined
9699

97100
The behavior of the app_metrics feature can be controlled with the following list of settings (under `netbox_metrics_ext > app_metrics`):
98101
- `reports` boolean (default True), publish stats about the reports (success, warning, info, failure)
99-
- `queues` boolean (default True), publish stats about RQ Worker (nbr of worker, nbr and type of job in the different queues)
100-
- `models` nested dict, publish the count for a given object (Nbr Device, Nbr IP etc.. ). The first level must be the name of the module in lowercase (dcim, ipam etc..), the second level must be the name of the object (usually starting with a uppercase)
102+
- `queues` boolean (default True), publish stats about RQ Worker (nbr of worker, nbr and type of job in the different queues)
103+
- `models` nested dict, publish the count for a given object (Nbr Device, Nbr IP etc.. ). The first level must be the name of the module in lowercase (dcim, ipam etc..), the second level must be the name of the object (usually starting with a uppercase)
101104
```python
102105
{
103-
"dcim": {"Site": True, "Rack": True, "Device": True,},
106+
"dcim": {"Site": True, "Rack": True, "Device": True,},
104107
"ipam": {"IPAddress": True, "Prefix": True}
105108
}
106109
```
@@ -120,15 +123,15 @@ scrape_configs:
120123

121124
# RQ Worker Metrics Endpoint
122125

123-
This plugin add a new django management command `rqworker_metrics` that is behaving identically to the default `rqworker` command except that this command also exposes a prometheus endpoint (default port 8001).
126+
This plugin add a new django management command `rqworker_metrics` that is behaving identically to the default `rqworker` command except that this command also exposes a prometheus endpoint (default port 8001).
124127

125-
With this endpoint it become possible to instrument the tasks running asyncronously in the worker.
128+
With this endpoint it become possible to instrument the tasks running asyncronously in the worker.
126129

127130
## Usage
128131

129132
The new command needs to be executed on the worker as a replacement for the default `rqworker`
130133
```
131-
python manage.py rqworker_metrics
134+
python manage.py rqworker_metrics
132135
```
133136

134137
The port used to expose the prometheus endpoint can be configured for each worker in CLI.
@@ -147,7 +150,7 @@ pip install ntc-netbox-plugin-metrics-ext
147150
```
148151

149152
> The plugin is compatible with NetBox 2.8.1 and higher
150-
153+
151154
To ensure Application Metrics Plugin is automatically re-installed during future upgrades, create a file named `local_requirements.txt` (if not already existing) in the NetBox root directory (alongside `requirements.txt`) and list the `ntc-netbox-plugin-metrics-ext` package:
152155

153156
```no-highlight
@@ -174,6 +177,12 @@ PLUGINS = ["netbox_metrics_ext"]
174177
# }
175178
```
176179

180+
## Included Grafana Dashboard
181+
182+
Included within this plugin is a Grafana dashboard which will work with the example configuration above. To install this dashboard import the JSON from [Grafana Dashboard](netbox_grafana_dashboard.json) into Grafana.
183+
184+
![Netbox Grafana Dashboard](netbox_grafana_dashboard.png)
185+
177186
# Contributing
178187

179188
Pull requests are welcomed and automatically built and tested against multiple version of Python and multiple version of NetBox through TravisCI.
@@ -186,7 +195,7 @@ The project is following Network to Code software development guideline and is l
186195

187196
### CLI Helper Commands
188197

189-
The project is coming 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`.
198+
The project is coming 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`.
190199

191200
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`
192201

@@ -199,14 +208,14 @@ Each command can be executed with `invoke <command>`. All commands support the a
199208
stop Stop NetBox and its dependencies.
200209
```
201210

202-
#### Utility
211+
#### Utility
203212
```
204213
cli Launch a bash shell inside the running NetBox container.
205214
create-user Create a new user in django (default: admin), will prompt for password.
206215
makemigrations Run Make Migration in Django.
207216
nbshell Launch a nbshell session.
208217
```
209-
#### Testing
218+
#### Testing
210219

211220
```
212221
tests Run all tests for this plugin.

netbox_grafana_dashboard.png

254 KB
Loading

0 commit comments

Comments
 (0)