Importing images

When configuring network maps, we had a chance to upload our own icons. It is highly inefficient to upload a lot of images one by one. One could script the process using a utility such as curl, but that requires a new connection to the frontend for every image and could break if the Zabbix interface is changed in future versions. Images are supported in XML import, though, and we can also have a file with just the images. We could write our own script for this, but there is already a script shipped with Zabbix—look for the png_to_xml.sh script in the misc/images directory. This script accepts two parameters—the directory where the images are found and the output filename. For example, if we had images in a directory called map_icons, we would run the script as follows:

./png_to_xml.sh map_icons zabbix_images.xml 

To import the images, we would go to any page that has the Import button, such as Configuration | Maps, click the Import button, and mark the checkboxes next to the Images row. Only super admins can import images. Images are exported and imported in base64 format, so there's no binary data in the XML file. An example of an exported image is this:

<encodedImage>iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABmJLR0QA/wD/AP+gvaeTAAAM70lEQVR42u2ZeXBV133HP+cub9NDSGIR 
... 
</encodedImage> 

This output is significantly cut—the real base64 value would take a few pages here.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset