mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 01:41:22 -06:00
Add documentation for webhook_receiver
This commit is contained in:
parent
ae58af4bb7
commit
2357928e72
@ -71,3 +71,36 @@ If no body template is specified, the request body will be populated with a JSON
|
||||
When a change is detected, any resulting webhooks are placed into a Redis queue for processing. This allows the user's request to complete without needing to wait for the outgoing webhook(s) to be processed. The webhooks are then extracted from the queue by the `rqworker` process and HTTP requests are sent to their respective destinations. The current webhook queue and any failed webhooks can be inspected in the admin UI under Django RQ > Queues.
|
||||
|
||||
A request is considered successful if the response has a 2XX status code; otherwise, the request is marked as having failed. Failed requests may be retried manually via the admin UI.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
To assist with verifying that the content of outgoing webhooks is rendered correctly, NetBox provides a simple HTTP listener that can be run locally to receive and display webhook requests. First, modify the target URL of the desired webhook to `http://localhost:9000/`. This will instruct NetBox to send the request to the local server on TCP port 9000. Then, start the webhook receiver service from the NetBox root directory:
|
||||
|
||||
```no-highlight
|
||||
$ python netbox/manage.py webhook_receiver
|
||||
Listening on port http://localhost:9000. Stop with CONTROL-C.
|
||||
```
|
||||
|
||||
You can test the receiver itself by sending any HTTP request to it. For example:
|
||||
|
||||
```no-highlight
|
||||
$ curl -X POST http://localhost:9000 --data '{"foo": "bar"}'
|
||||
```
|
||||
|
||||
The server will print output similar to the following:
|
||||
|
||||
```no-highlight
|
||||
[1] Tue, 07 Apr 2020 17:44:02 GMT 127.0.0.1 "POST / HTTP/1.1" 200 -
|
||||
Host: localhost:9000
|
||||
User-Agent: curl/7.58.0
|
||||
Accept: */*
|
||||
Content-Length: 14
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
|
||||
{"foo": "bar"}
|
||||
------------
|
||||
```
|
||||
|
||||
Note that `webhook_receiver` does not actually _do_ anything with the information received: It merely prints the request headers and body for inspection.
|
||||
|
||||
Now, when the NetBox webhook is triggered and processed, you should see its headers and content appear in the terminal where the webhook receiver is listening. If you don't, check that the `rqworker` process is running and that webhook events are being placed into the queue (visible under the NetBox admin UI).
|
||||
|
@ -7,6 +7,7 @@
|
||||
* [#3676](https://github.com/netbox-community/netbox/issues/3676) - Reference VRF by name rather than RD during IP/prefix import
|
||||
* [#4147](https://github.com/netbox-community/netbox/issues/4147) - Use absolute URLs in rack elevation SVG renderings
|
||||
* [#4448](https://github.com/netbox-community/netbox/issues/4448) - Allow connecting cables between two circuit terminations
|
||||
* [#4460](https://github.com/netbox-community/netbox/issues/4460) - Add the `webhook_receiver` management command to assist in troubleshooting outgoing webhooks
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user