Convert human time to epoch, deliver to Zabbix item

Sample line:
echo "line content 12/24/2019"
visudo:
# Defaults        requiretty
zabbix ALL=(ALL) NOPASSWD: /usr/bin/grep expires /path/to/filename
UserParameter:
UserParameter=licence.status,/usr/bin/grep expires /path/to/filename | grep -Eo "....\/..\/.." | awk -F'/' '{ print $2"/"$3"/"$1}' | xargs date +"%s" -d
Define the days in Template/Host level:
{$DAYS_LEFT}=365d
Trigger expression:
{check lincence:licence.status[/path/to/file.dat].last()}-{check lincence:licence.status[/path/to/file.dat].now()}<{$DAYS_LEFT}

No comments: