-
Notifications
You must be signed in to change notification settings - Fork 20
Home
intrepidsilence edited this page Apr 1, 2015
·
12 revisions
Welcome to the zabbix_tool wiki!
Screen Creator
Below is an example of how you might use the screen_creator tool to create a screen that consists of multiple hosts and multiple graphs for each host. There is a config file for this script that sets the location of the zabbix_tool and screen_creator binaries. The script will fail if that config file does not exist.
CONFIG FILE
cat ~/.zabbix_tool.cfg
ZABBIX_TOOL=/usr/local/bin/zabbix_tool
SCREEN_CREATOR=/usr/local/bin/screen_creator
SCRIPT
#! /bin/sh
if [ -f ~/.zabbix_tool.cfg ]
then
source ~/.zabbix_tool.cfg
else
echo "No config file found at ~/.zabbix_tool.cfg! Exiting..."
exit 1
fi
#How many graphs across the page?
HSIZE=6
#Width and Height for each graph
GRAPHWIDTH=520
GRAPHHEIGHT=140
#What to name the Screen
SCREENNAME="My Screen Name"
#Name of the hostgroup to use to get hosts - graphs will be created for all hosts in this group
HOSTGROUP="My Hostgroup"
#List of Graphs to Use - The number of these must match the HSIZE variable above and you must also include a single line below in the loop for each GRAPH<NUM> variable that you create here.
GRAPHONE="CPU Utilization %"
GRAPHTWO="CPU load"
GRAPHTHREE="VM CPU Usage"
GRAPHFOUR="Number of Processes"
GRAPHFIVE="Disk Read/Write Queue"
GRAPHSIX="Read/Write Bytes/sec"
#Delete the screen prior to re-creating it
${SCREEN_CREATOR} --delete "${SCREENNAME}"
#Loop to create the screen - be sure you have one line per GRAPH<NUM> variable set above and the HSIZE variable matches that total count
let HEIGHT=1
for HOST in `${ZABBIX_TOOL} get_hostgroup_hosts "${HOSTGROUP}" --filter name|sort -f `;
do
${SCREEN_CREATOR} --hsize="${HSIZE}" --vsize="$HEIGHT" --width="${GRAPHWIDTH}" --height ${GRAPHHEIGHT} --add-all-host "$HOST" --filter "${GRAPHONE}" "${SCREENNAME}";
${SCREEN_CREATOR} --hsize="${HSIZE}" --vsize="$HEIGHT" --width="${GRAPHWIDTH}" --height ${GRAPHHEIGHT} --add-all-host "$HOST" --filter "${GRAPHTWO}" "${SCREENNAME}";
${SCREEN_CREATOR} --hsize="${HSIZE}" --vsize="$HEIGHT" --width="${GRAPHWIDTH}" --height ${GRAPHHEIGHT} --add-all-host "$HOST" --filter "${GRAPHTHREE}" "${SCREENNAME}";
${SCREEN_CREATOR} --hsize="${HSIZE}" --vsize="$HEIGHT" --width="${GRAPHWIDTH}" --height ${GRAPHHEIGHT} --add-all-host "$HOST" --filter "${GRAPHFOUR}" "${SCREENNAME}";
${SCREEN_CREATOR} --hsize="${HSIZE}" --vsize="$HEIGHT" --width="${GRAPHWIDTH}" --height ${GRAPHHEIGHT} --add-all-host "$HOST" --filter "${GRAPHFIVE}" "${SCREENNAME}";
${SCREEN_CREATOR} --hsize="${HSIZE}" --vsize="$HEIGHT" --width="${GRAPHWIDTH}" --height ${GRAPHHEIGHT} --add-all-host "$HOST" --filter "${GRAPHSIX}" "${SCREENNAME}";
let HEIGHT+=1
done;