Merge pull request #109 from mathieumd/patch-1

Update README.md
This commit is contained in:
Raymond Kuiper 2025-03-28 09:54:19 +01:00 committed by GitHub
commit aa6be1312e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,7 +7,7 @@ A script to create, update and delete Zabbix hosts using NetBox device objects.
To pull the latest stable version to your local cache, use the following docker To pull the latest stable version to your local cache, use the following docker
pull command: pull command:
``` ```sh
docker pull ghcr.io/thenetworkguy/netbox-zabbix-sync:main docker pull ghcr.io/thenetworkguy/netbox-zabbix-sync:main
``` ```
@ -15,7 +15,7 @@ Make sure to specify the needed environment variables for the script to work
(see [here](#set-environment-variables)) on the command line or use an (see [here](#set-environment-variables)) on the command line or use an
[env file](https://docs.docker.com/reference/cli/docker/container/run/#env). [env file](https://docs.docker.com/reference/cli/docker/container/run/#env).
``` ```sh
docker run -d -t -i -e ZABBIX_HOST='https://zabbix.local' \ docker run -d -t -i -e ZABBIX_HOST='https://zabbix.local' \
-e ZABBIX_TOKEN='othersecrettoken' \ -e ZABBIX_TOKEN='othersecrettoken' \
-e NETBOX_HOST='https://netbox.local' \ -e NETBOX_HOST='https://netbox.local' \
@ -30,7 +30,7 @@ The image uses the default `config.py` for it's configuration, you can use a
volume mount in the docker run command to override with your own config file if volume mount in the docker run command to override with your own config file if
needed (see [config file](#config-file)): needed (see [config file](#config-file)):
``` ```sh
docker run -d -t -i -v $(pwd)/config.py:/opt/netbox-zabbix/config.py ... docker run -d -t -i -v $(pwd)/config.py:/opt/netbox-zabbix/config.py ...
``` ```
@ -38,7 +38,7 @@ docker run -d -t -i -v $(pwd)/config.py:/opt/netbox-zabbix/config.py ...
### Cloning the repository ### Cloning the repository
``` ```sh
git clone https://github.com/TheNetworkGuy/netbox-zabbix-sync.git git clone https://github.com/TheNetworkGuy/netbox-zabbix-sync.git
``` ```
@ -48,9 +48,15 @@ Make sure that you have a python environment with the following packages
installed. You can also use the `requirements.txt` file for installation with installed. You can also use the `requirements.txt` file for installation with
pip. pip.
``` ```sh
# Packages:
pynetbox pynetbox
pyzabbix pyzabbix
# Install them through requirements.txt from a venv:
virtualenv .venv
source .venv/bin/activate
.venv/bin/pip --require-virtualenv install -r requirements.txt
``` ```
### Config file ### Config file
@ -58,7 +64,7 @@ pyzabbix
First time user? Copy the `config.py.example` file to `config.py`. This file is First time user? Copy the `config.py.example` file to `config.py`. This file is
used for modifying filters and setting variables such as custom field names. used for modifying filters and setting variables such as custom field names.
``` ```sh
cp config.py.example config.py cp config.py.example config.py
``` ```
@ -66,26 +72,26 @@ cp config.py.example config.py
Set the following environment variables: Set the following environment variables:
``` ```sh
ZABBIX_HOST="https://zabbix.local" export ZABBIX_HOST="https://zabbix.local"
ZABBIX_USER="username" export ZABBIX_USER="username"
ZABBIX_PASS="Password" export ZABBIX_PASS="Password"
NETBOX_HOST="https://netbox.local" export NETBOX_HOST="https://netbox.local"
NETBOX_TOKEN="secrettoken" export NETBOX_TOKEN="secrettoken"
``` ```
Or, you can use a Zabbix API token to login instead of using a username and Or, you can use a Zabbix API token to login instead of using a username and
password. In that case `ZABBIX_USER` and `ZABBIX_PASS` will be ignored. password. In that case `ZABBIX_USER` and `ZABBIX_PASS` will be ignored.
``` ```sh
ZABBIX_TOKEN=othersecrettoken export ZABBIX_TOKEN=othersecrettoken
``` ```
If you are using custom SSL certificates for NetBox and/or Zabbix, you can set If you are using custom SSL certificates for NetBox and/or Zabbix, you can set
the following environment variable to the path of your CA bundle file: the following environment variable to the path of your CA bundle file:
```bash ```sh
REQUEST_CA_BUNDLE=/path/to/your/ca-bundle.crt export REQUESTS_CA_BUNDLE=/path/to/your/ca-bundle.crt
``` ```
### NetBox custom fields ### NetBox custom fields