#!/bin/bash
today=$(date +%Y-%m-%d)
crit=`jetbackup5api -F listAlerts -D "sort[created]=-1&find[level]=4&limit=1" -O json | jq --arg today "$today" '.data.alerts[] | select(.owner_name == "root" and (.created | tostring | startswith($today)) and (.title | contains ("JetBackup Config") | not)) | .level'`
if [ -z $crit ]; then
zabbix=1
elif [ $crit == 4 ]; then
zabbix=0
fi
echo $zabbix