#!/bin/bash

discovery_string_1='{"data":[{"{#OVMM_SERVER_ID}":"4c.4c.45.44.00.4b.36.10.80.58.c2.c0.4f.43.35.4b", "{#OVMM_SERVER_NAME}":"ovm01test", "{#OVMM_SERVER_IP}":"XXX.XXX.XXX.XXX", "{#OVMM_SERVER_HOSTNAME}":"ovm01.domain.be", "{#OVMM_SERVER_SERVERPOOL_ID}":"0004fb0000020000a84fc28506e67b9f", "{#OVMM_SERVER_SERVERPOOL_NAME}":"TestPooltest", "{#OVMM_SERVER_LOCAL_FILESERVER_ID}":"0004fb00000900001a95d04b1b89d455", "{#OVMM_SERVER_LOCAL_FILESERVER_NAME}":"Local FS ovm01.domain.be"}]}'

discovery_string_2='{"data":[{"{#OVMM_SERVER_ID}":"4c.4c.45.44.00.4b.36.10.80.58.c2.c0.4f.43.35.4b", "{#OVMM_SERVER_NAME}":"ovm01test", "{#OVMM_SERVER_IP}":"XXX.XXX.XXX.XXX", "{#OVMM_SERVER_HOSTNAME}":"ovm01.domain.be", "{#OVMM_SERVER_SERVERPOOL_ID}":"Unassignedtest", "{#OVMM_SERVER_SERVERPOOL_NAME}":"Unassignedtest", "{#OVMM_SERVER_LOCAL_FILESERVER_ID}":"0004fb00000900001a95d04b1b89d455", "{#OVMM_SERVER_LOCAL_FILESERVER_NAME}":"Local FS ovm01.domain.be"}]}'

[ -f /tmp/zabbix_ovmm_test.state ] && . /tmp/zabbix_ovmm_test.state || idx=1

echo "idx=$(($idx%2+1))" > /tmp/zabbix_ovmm_test.state

eval "echo \$discovery_string_$idx"
