Automating Zabbix with Netbox and Ansible
Manual tasks can be time-consuming and prone to human errors. We leverage automation to configure, import and synchronize network devices to Zabbix. Netbox acts as a source of truth for our Zabbix desired state and the device snmp configuration. Ansible orchestrates and glues all the API component interactions together for a consistent, reliable and scalable automation chain.
Clone git repository
git clone https://github.com/jefvantongerloo/zabbix-automation-demo.git
Install dependencies
poetry install
poetry self add poetry-dotenv-plugin
Install Ansible collections
ansible-galaxy collection install -r collections/requirements.yml
# Ansible network related variables
# More info: https://docs.ansible.com/ansible/latest/network/getting_started/network_differences.html
ANSIBLE_USER=''
ANSIBLE_PASSWORD=''
ANSIBLE_CONNECTION=''
ANSIBLE_NETWORK_OS=''
# Netbox related variables
# More info: https://demo.netbox.dev/static/docs/rest-api/overview/
NETBOX_API=''
NETBOX_TOKEN=''
# Ansible Zabbix related variables
# More info: https://github.com/ansible-collections/community.zabbix
ZABBIX_API=''
ANSIBLE_ZABBIX_AUTH_KEY=''
# Switch snmp config related variables
CFG_SNMP_PASSPHRASE=''
-
Add Netbox device
zabbix
tag -
Check Ansible Netbox inventory plugin
ansible-playbook -i inventory/ --list
-
Run Ansible
zabbix-sync
playbookansible-playbook -i inventory/ playbooks/sync-zabbix.yml
- switch-config
- zabbix-config
- zabbix-hosts