#!/bin/bash # A script to generate Zabbix map XML from PNG images # depends on base64 echo "Generating XML" imagedir="$1" outputfile="$2" echo ' ' > "$outputfile" imagecount=$(ls $imagedir/*.png | wc -l) for imagefile in $imagedir/*.png; do ((imagesdone++)) echo " $(basename "${imagefile%.png}") 1 $(base64 --wrap=0 "$imagefile") " >> "$outputfile" echo -n "$[$imagesdone*100/$imagecount]% " done echo echo ' ' >> "$outputfile"