Zabbix Share

Zabbix templates, modules & more
Log in
Choose social to login:
Login With Google
Login With Github

Nav view search

Navigation

Advanced Search
  • Applications
  • Cloud
  • Databases
  • Network Appliances
  • Network Devices
  • Official Templates
  • Operating Systems
  • Power (UPS)
  • Printers
  • SCADA, IoT, Energy, Home Automation, Industrial monitoring
  • Server Hardware
  • Storage Devices
  • Telephony
  • Unsorted
  • Virtualization
  • Zabbix
    • API Libraries
    • DB (Partitioning, storage solutions)
    • Icon sets
    • Installers
    • Notifications
    • Provisioning and deploy
    • Tools and utilities
    • Web Addons
    • Zabbix module language bindings
  • Recently Added
  • Recently Updated
  • Popular
  • Most Rated
  • Top Rated
  • Most Reviewed

How to use CSV module of Zaf

Do you have lot of devices and you want to monitor them not only physically but from inventory point of view?

Do you have CMDB and you want to correlate data from it into Zabbix? Zaf CSV plugin is

here for you!

More info at my site.


This example will show how to use this plugin and demonstrate its capabilities.

Let us use example CSV file devices.csv which contains data

Name,Primary IP,Type,Status,OS,OS Version,Platform
host1,1.2.3.4,server,verified,Windows,10,win64
host2,2.3.4.5,server,verified,Ubuntu,14.4,linux64
host3,2.3.4.6,workstation,verified,Ubuntu,14.4,linux64

Format of CSV file is not important because CSV module can select any column of it so it is highly customizable.

Now we want to create all this devices in Zabbix. To do so, we have to create auto registration action in Zabbix frontend. Best way how to do it is to use some specific metadata to be able to classify discovered hosts into right groups and templates. You can find more info about hosts autoregistration in Zabbix manual pages. Let us use metadata value "ZAF".

Now we want to do magic. Zaf csv register will read data from devices.csv and get field 'Name' from it. For each line it will try to register host with name (lowercased) and metadata 'ZAF'. Metadata can be any column too, using some of macros below.

zaf install csv

zaf csv register
Missing arguments!
register file.csv delim host metadata
host and metadata are strings where:
{COLUMN:x} is replaced by value of column x
{column:x} is replaced by lowercased value of column x
x can be column index (x starts with zero) or header name.
CSV must include header line.

zaf csv register devices.csv ',' {column:Name} ZAF

# To use more sophisticated action, you can prepend hosts with some prefix or append some postfix. Macros are powerful!

#zaf csv register devices.csv ',' test_{column:Name} ZAF
#zaf csv register devices.csv ',' {column:Name}_postfix ZAF

#To use metadata specific per host (to classify by OS)
#zaf csv register devices.csv ',' test_{column:Name} 'ZAF:{column:OS}'




If autoregistration process is OK, we should see all hosts in Zabbix frontend with needed templates linked in. For our example, you have to define two trapper items for that hosts with name os and platform. Of course you can create your own keys and templates.

Next to this, we want to show data generated from CSV suitable for zabbix_sender.

zaf csv send
Missing arguments!
send file.csv delim mode hostfield [item1=field1] [item2=field2] ...
mode is stdout or send,
hostfield is host for item to send,
itemx is key for item to send,
fieldx is data to send send,
In hostfield, itemx and fieldx are replaced this macros:

Rating
500
0 vote

Listing Details

Type
Integration
Min Zabbix version
2.2.x
Features
  • Low Level Discovery (LLD)
  • Zabbix Agent
  • Zabbix Agent Active
  • Zabbix Trapper
  • Other
Link
macura.cz/node/36
Created
2017-01-30
Modified
Never
Owner
Lukas Macura
RecommendReportOwner's listing
All resources created by third parties; use at your own risk
© 2001-2018 by Zabbix SIA. All rights reserved. Trademark Policy · Contact us