Are you affected by CVE-2024-3400?

The IP Fabric platform provides a standard Application Programming Interface (API), and this interface allows to integrate IP Fabric platform with any 3rd party software or build any custom scripts. See the official documentation for details on how to use our API.

Thanks to a unique discovery algorithm, IP Fabric is capable of collecting data about all active network devices automatically. It collects more than 1000 parameters from each individual device and provides the data in a standardized form. Those data can be viewed in GUI or accessed via API. Hence all available data serves as a perfect baseline for any automation or API integration efforts.

The goal of this article

This article demonstrates how to add devices to Zabbix monitoring software. Zabbix uses the SNMP protocol for monitoring; therefore, we have to check if a device has SNMP configured and if no, then we will configure it automatically using the Ansible tool.

Where to get API information in IP Fabric

The IP Fabric is a very flexible tool when it comes to getting information. The same applies to well-documented API fetch points. In every technology table, including the main device inventory, there's table description, that appears on request.

apiInventory
API Integration: URL for device inventory

The full device inventory can be accessed with a POST request to https://ipfabric.domain.com/api/v1/tables/inventory/devices. The response can be filtered by any column.

So let's say that we want to get all Cisco IOS, IOS-XE devices, the following code snippet will accomplish just that:

curl -k -s https://ipfabric.domain.com/api/v1/tables/inventory/devices \
   -u 'username:password' \
   -H 'Content-Type: application/json' \
   --data-binary '{"columns":["sn","hostname","loginIp","loginType"],"filters":{"or":[{"family":["eq", "ios"]},{"vendor":["eq","ios-xe"]}]},"snapshot":"$last"}'

Access the SNMP data from the IP Fabric

All data related to SNMP configuration for all discovered devices is presented in a different technology table related to SNMP. If in doubt, there's always the search box that will help with finding a specific target. Let's say we are looking for SNMP information, let's just type 'SNMP' and see results. The platform will provide us with information about tables, including SNMP information. We will navigate to SNMP Summary, where we again collect API link.

apiSnmp
API integration with Ansible and Zabbix 1

In the same way, we collected full device inventory, filtering IOS and IOS-XE, we can collect all devices with that has no SNMP community configured.

curl -k -s  https://ipfabric.domain.com/api/v1/tables/management/snmp/summary \
     -u 'username:password' \
     -H 'Content-Type: application/json' \
     --data-binary '{"columns":["id"],"filters":{"communitiesCount":["eq",0],"sn":["eq","'"$sn"'"]},"snapshot":"$last"}'

By comparing Inventory with IOS or IOS-XE devices and SNMP summary table information, where we can find devices with no configured SNMP community, we will get the full list of devices that need to be added to Zabbix and configured with Ansible.

The entire bash script can be seen in our public repository.

Ansible automation

YAMLCodeLogo 1
API integration with Ansible and Zabbix 2

Ansible is an open-source configuration management and application-deployment tool. It helps to automate configuration updates with templates called the 'playbooks' with various network vendors, including servers.

We used the Ansible version 2.5.1. Our simple Ansible playbook will add a new SNMP community and trap the host server as well.

Please note, that you may want to modify the YAML file to fit your environment, we only used 'dummy' SNMP server IP, which may be the Zabbix IP address and SNMP community as an example. The following snippet may need an update per case.

     - name: Add SNMP config
      ios_config:
        lines:
        - snmp-server community newCommunity ro
        - snmp-server host 10.10.10.10 version 2c snmpCommunity
      notify:
      - Save Configuration 

The entire Yaml file can be seen in our public repository.

Zabbix automation

ZABBIXCodeLogo
API integration with Ansible and Zabbix 3

The Zabbix configuration is updated with the help of powerful Zabbix-CLI, which was originally developed by members of the Department for IT Infrastructure at the Center for Information Technology at the University of Oslo, Norway. It's a very user-friendly and powerful solution for connecting to Zabbix's API.

The connector needs to be preinstalled and configured accordingly. For the full installation process, please, follow the documentation.

Thank you for reading!

If you have found this article helpful, please follow our company’s LinkedIn or Blog, where there will be more content emerging.

Groupe de masques 26

Get IP Fabric

Try our self-guided demo and discover how to increase 
your networks visibility & get better time efficiency.
Free Demo | Zero Obligation
Try our Demo
We're Hiring!
Join the Team and be part of the Future of Network Automation
Available Positions
98 North Washington Street
Suite 407
Boston, MA 02114
United States
This is a block of text. Double-click this text to edit it.
Phone : +1 617-821-3639
IP Fabric s.r.o.
Kateřinská 466/40
Praha 2 - Nové Město, 120 00
Czech Republic
This is a block of text. Double-click this text to edit it.
Phone : +420 720 022 997
IP Fabric UK Limited
Gateley Legal, 1 Paternoster Square, London,
England EC4M 7DX
This is a block of text. Double-click this text to edit it.
Phone : +420 720 022 997
IP Fabric, Inc. © 2024 All Rights Reserved